CALENDAR AND GEOMETRY BOUNDARY CHECKS

Checking perpendicular line slopes in matching axis units

Two nonvertical lines at right angles have slopes whose product is minus one. This guide checks that with two lines through the origin and a second pair with different numbers.

The slope criterion

The slope of a line is the change in y divided by the change in x. For two nonvertical lines in a Cartesian plane with equal scales on both axes, the lines are perpendicular exactly when the product of their slopes is −1. Equivalently, one slope is the negative reciprocal of the other: if one line has slope m, a perpendicular line has slope −1 over m. The criterion is short and easy to check, which makes it a common test in coordinate geometry, drafting and computer graphics. It gives a yes or no answer without needing to measure any angles.

The first line

The segment from (0, 0) to (2, 4) rises 4 as it runs 2. The Slope Calculator divides the rise by the run and returns 2. The line y equals 2x passes through the origin and climbs steeply to the right. Because the slope is positive, the perpendicular line will have to fall as x increases, and because the slope is greater than 1 in size, the perpendicular line will be flatter than 45 degrees. These qualitative expectations are useful for catching a sign error before the numbers are checked.

Why the product is minus one

The product rule follows from a quarter turn. Rotating a direction vector (a, b) by 90 degrees gives (−b, a), or (b, −a) for the other direction. The slope of the original is b over a. The slope of the rotated vector is a over −b, which is −a over b. Multiplying b over a by −a over b gives −1, as long as neither a nor b is zero. If a is zero, the original is vertical, and if b is zero, the rotated vector is vertical. Those are the cases the rule excludes. Seeing the derivation also explains why a pair of slopes such as 2 and −0.5 works while 2 and 0.5 does not: swapping the sign alone gives a mirror image across the vertical axis, not a right angle.

The second line

The segment from (0, 0) to (4, −2) falls 2 over a run of 4, and its slope is −0.5, which is negative one half. The line y equals −x over 2 drops gently to the right. It is the negative reciprocal of 2, because the reciprocal of 2 is one half and the negative of that is minus one half. Both lines pass through the origin, so they cross there, and the claim to be verified is that the angle between them is 90 degrees. The slope product will confirm it.

The product check

Multiplying the two slopes, 2 times −0.5, gives −1. The Basic calculator returns that value with the multiply operation. The result matches the criterion, so the two lines are perpendicular. This also explains the dot product test used in vector geometry: the direction vectors (2, 4) and (4, −2) have a dot product of 2 times 4 plus 4 times −2, which is 8 minus 8, or zero. A zero dot product means perpendicular direction vectors, and the slope criterion is the same statement rewritten for lines that are not vertical.

A second pair of lines

Take a line through the origin and (4, 2), with slope 0.5. A perpendicular line has slope −2, and the segment from (0, 0) to (1, −2) provides it. Multiplying 0.5 by −2 gives −1. Another pair uses slope 0.75, from (0, 0) to (4, 3), and the segment from (0, 0) to (3, −4), which has slope −4 over 3, about −1.333333. The product is about −1. These examples relate to the well-known 3-4-5 right triangle: the legs of 3 and 4 produce the slopes 3 over 4 and −4 over 3 when turned a quarter turn.

A line that does not pass through the origin

The origin was used to keep the arithmetic simple, and the criterion does not need it. Only the slopes matter, not where a line crosses the axes. A line through (1, 1) and (3, 5) has slope 4 over 2, which is 2. Any line with slope −0.5 is perpendicular to it, whether it passes through (4, 7), (0, 10) or any other point. Two such lines are perpendicular wherever they meet, and parallel lines with the same slope stay parallel. This makes it practical to test lines taken from different parts of a drawing: compute each slope from any two points on the line, multiply the two results, and compare the product with minus one.

Vertical and horizontal lines

A horizontal line has slope 0, and a vertical line has no slope, since its run is zero and the division is undefined. The two are perpendicular, but the product test cannot show it because 0 times an undefined value is not −1. This is the exception the criterion lists: it applies to lines that are nonvertical, which means the slope exists for both. For a pair with one horizontal and one vertical line, check the orientation directly: all y values equal on one segment and all x values equal on the other.

Equal axis scales

The criterion assumes the same geometric unit on both axes. A chart that shows time on the horizontal axis in days and price on the vertical axis in dollars has no shared unit, and the lines that look perpendicular on the screen do not correspond to a right angle in any meaningful sense. Even on a plot with stretched axes, perpendicular lines on screen can have slopes whose product is not −1. If the picture has been scaled differently in two directions, convert back to equal units before applying the test.

Using the test in practice

The test appears in surveying to check that a fence runs at a right angle to a wall, in graphics to find the normal to a line, and in construction layouts to confirm square corners from coordinates. Roof pitch, ramp grade and road cross-slope calculations use the same idea whenever a line has to be turned a quarter turn from another. For a line from a point on a wall, take its slope m, compute −1 over m, and place the second point by that rise and run. Rounding matters when slopes are decimals, so compare the product against −1 with a small tolerance rather than expecting an exact match from rounded measurements.

Reproduce the checks

First slope

Open the Slope Calculator and enter:

First x coordinate
0
First y coordinate
0
Second x coordinate
2
Second y coordinate
4

Expected output:

slope

2

The first line rises two units per unit run.

Second slope

Open the Slope Calculator and enter:

First x coordinate
0
First y coordinate
0
Second x coordinate
4
Second y coordinate
-2

Expected output:

slope

-0.5

The second line has the opposite reciprocal slope.

Product control

Open the Basic calculator and enter:

First number
2
Operation
multiply
Second number
-0.5

Expected output:

Result

-1

The product verifies the stated nonvertical criterion.

References and implementation scope

The examples describe the behavior of the linked Computandum tools. A successful local check does not establish that another application accepts the same format or applies the same limits.

Sources

Related tasks