Math for Computer Science

Introduction

Geometry can be seen in the world around us: our buildings are made strong by the rigidity of triangles; beehives are built with hexagons; our roads appear to converge at a point as they stretch away from us toward the horizon. While it is possible to describe these geometric figures with words, it is useful to describe them with numbers. For this, we use coordinates.

Every point in space can be described by a set of coordinates. Points on a plane, or flat surface, can be described using two coordinates. In the classic example of a coordinate system, the first coordinate gives a vertical position and the second coordinate gives a horizontal position.

What is a coordinate system?

• A coordinate system uses numbers, or coordinates, to describe locations.
• The classic example of a coordinate system is the Cartesian coordinate system.
• In two dimensions, each set of Cartesian coordinates describes a location on the coordinate plane.
• The coordinate plane consists of a horizontal number line, the x-axis, and a vertical number line, the y-axis.
• Points on the coordinate plane are given in ordered pairs of the form (x, y).
• The point where the x-axis and y-axis intersect is called the origin.
• The coordinates at the origin are (0, 0).

How are coordinate systems used in computer science?

The locations of graphical elements in a computer program or objects in a video game can be described by coordinates. These coordinates are used to calculate movements or interactions with other elements or objects.

Examples

Your browser does not support the canvas element.

x- and y-coordinates

Q: Classify the x- and y-coordinates as positive, negative or zero.

A: The x-coordinate of the blue point is positive. The y-coordinate of the blue point is negative.

Ordered pairs

Q: What are the coordinates of the blue point?

A: The coordinates of the blue point are (3, -2).

Ordered pair translations

Q: Translate the blue point up 6 units.

A: If the blue point were translated up 6 units, its new location would be (3, 4).