# The Orthocenter's Cartesian Formulas

## Abstract

Every triangle has an orthocenter, which is the intersection point of the triangle's three altitudes, each of which is a line segment from a vertex orthogonally to the altitude's extended base. Formulas for the orthocenter are derived using the Cartesian coordinates of the triangle.

## Introduction

In two-dimensional Euclidean geometry, a triangle is defined by its three vertices and the three sides that connect them. For the analysis that follows, imagine a triangle whose vertices, in the clockwise direction, are at the distinct Cartesian coordinates (A_x,A_y), (B_x,B_y), and (C_x,C_y).

Each side determines an extended side (also referred to as a sideline), which is the line that contains that side. (The need for this concept will be seen in a moment, regarding obtuse triangles.) Each vertex has a side opposite, referred to as its base, which is simply the side that does not intersect that vertex. For the vertex A of triangle ABC, its extended base is the line defined by the vertices B and C.

From each vertex, a line segment, referred to as its altitude, can be drawn to its extended base such that the altitude is orthogonal to the extended base. For any acute triangle or right triangle, each altitude intersects its base side.

For an obtuse triangle, only for its single obtuse angle, the altitude from its vertex similarly intersects its base side. However, for each of the two acute angles, the altitude from its vertex does not intersect its base side, but does intersect its extended base, outside the triangle.

For any triangle, the three altitudes intersect at a point referred to as the orthocenter, usually labeled H.

Throughout mathematics literature, the orthocenter is typically represented using trigonometric or vector notation, either of which result in far more work needed to calculate the Cartesian coordinates of an orthocenter than if Cartesian formulas were available. Here it is shown that such formulas can be derived from the definition of the orthocenter — specifically, the extended bases, their slopes, the orthogonal altitudes, and the vertices.

## Formulas for Lines

In the analysis below, two well-known formulas for lines on the Cartesian plane are used — one derivable from the other.

To begin, the line passing through the two points A and B may be written as the standard point-slope formula

(y - A_y) (B_x - A_x) = (x - A_x) (B_y - A_y).

From this equation, the variable y can be expressed as a function of x and the coordinates of the two points:

(y - A_y) = (x - A_x) (B_y - A_y) / (B_x - A_x),

assuming that B_x is not equal to A_x. In turn,

y = x (B_y - A_y) / (B_x - A_x) - A_x (B_y - A_y) / (B_x - A_x) + A_y (B_x - A_x) / (B_x - A_x),

which simplifies to the standard slope-intercept formula

y = x (B_y - A_y) / (B_x - A_x) + (A_y B_x - A_x B_y) / (B_x - A_x).

## The Altitudes

Firstly, consider the vertex A in the triangle ABC. Its extended base is determined by the other two vertices, B and C, and hence that line can be written using the standard point-slope formula as

(y - B_y) (C_x - B_x) = (x - B_x) (C_y - B_y).

If B_x = C_x, then B_y != C_y, because then B and C would be the same point, and the three points A, B, and C would define merely a line segment from A to B/C, and not a triangle.

If B_x = C_x, then B is exactly above or below C, and the extended base of A can be expressed as x = B_x (or as x = C_x), a vertical line. The altitude of A is orthogonal to it, and hence is a horizontal line, which intersects A and therefore has the equation y = A_y.

If B_y = C_y, then similarly B_x != C_x, because then B and C would again be the same point.

If B_y = C_y, then B is exactly to the left or right of C, and the extended base of A can be expressed as y = B_y (or as y = C_y), a horizontal line. The altitude of A is orthogonal to it, and hence is a vertical line, which intersects A and therefore has the equation x = A_x.

The remaining case is that B_x != C_x and B_y != C_y. The extended base of A can be expressed as a function of x and the coordinates of B and C, in the slope-intercept form of

y = x (C_y - B_y) / (C_x - B_x) + (B_y C_x - B_x C_y) / (C_x - B_x).

Thus the slope of the extended base is (C_y - B_y) / (C_x - B_x). The altitude is orthogonal to the extended base, and therefore its slope is the negative reciprocal, (B_x - C_x) / (C_y - B_y).

The altitude drawn from the vertex A intercepts the point (A_x,A_y) and has a slope of (B_x - C_x) / (C_y - B_y). Therefore, the standard point-slope formula for the line containing the altitude of A is

y - A_y = (x - A_x) (B_x - C_x) / (C_y - B_y).

Secondly, consider the altitude drawn from the vertex B, and follow the same reasoning as above for A. The extended base of B is determined by A and C, and hence can be expressed as

(y - A_y) (C_x - A_x) = (x - A_x) (C_y - A_y).

If A_x = C_x, then A_y != C_y, and the altitude of B has the equation y = B_y. If A_y = C_y, then A_x != C_x, and the altitude of B has the equation x = B_x. The remaining case is that A_x != C_x and A_y != C_y, and thus the extended base of B can be expressed as

y = x (C_y - A_y) / (C_x - A_x) + (A_y C_x - A_x C_y) / (C_x - A_x).

Hence, the altitude of B has a slope of (A_x - C_x) / (C_y - A_y). It intercepts (B_x,B_y), and therefore can be expressed using the standard point-slope formula as

y - B_y = (x - B_x) (A_x - C_x) / (C_y - A_y).

Lastly, consider the altitude drawn from the vertex C, and again follow the same reasoning as above for A and B. The extended base of C is determined by A and B, and hence can be expressed as

(y - A_y) (B_x - A_x) = (x - A_x) (B_y - A_y).

If A_x = B_x, then A_y != B_y, and the altitude of B has the equation y = C_y. If A_y = B_y, then A_x != B_x, and the altitude of B has the equation x = C_x. The remaining case is that A_x != B_x and A_y != B_y, and thus the extended base of C can be expressed as

y = x (B_y - A_y) / (B_x - A_x) + (A_y B_x - A_x B_y) / (B_x - A_x).

Hence, the altitude of C has a slope of (A_x - B_x) / (B_y - A_y). It intercepts (C_x,C_y), and therefore can be expressed as

y - C_y = (x - C_x) (A_x - B_x) / (B_y - A_y).

## The X Coordinate

Any two of the three general altitude equations derived above contain two variables, x and y, and thus can be solved for the intersection point C of the altitudes.

To begin solving for x, use a variation of the equation for the altitude of A that expresses y in terms of x and the vertices' coordinates:

y = (x - A_x) (B_x - C_x) / (C_y - B_y) + A_y.

Then substitute that value of y into the equation for the altitude of B:

(x - A_x) (B_x - C_x) / (C_y - B_y) + A_y - B_y = (x - B_x) (A_x - C_x) / (C_y - A_y).

Regarding the denominators having nonzero values, the special cases of A_y = C_y and B_y = C_y were addressed earlier.

Eliminate the denominator (C_y - A_y):

(x - A_x) (B_x - C_x) (C_y - A_y) / (C_y - B_y) + A_y (C_y - A_y) - B_y (C_y - A_y) = (x - B_x) (A_x - C_x).

Eliminate the denominator (C_y - B_y):

(x - A_x) (B_x - C_x) (C_y - A_y) + A_y (C_y - A_y) (C_y - B_y) - B_y (C_y - A_y) (C_y - B_y) = (x - B_x) (A_x - C_x) (C_y - B_y).

Multiply the factors with similar terms and alphabetize within each addend for readability (here and henceforth):

(x - A_x) (B_x - C_x) (C_y - A_y) + A_y C_y^2 - A_y B_y C_y - A_y^2 C_y + A_y^2 B_y - B_y C_y^2 + B_y^2 C_y + A_y B_y C_y - A_y B_y^2 = (x - B_x) (A_x - C_x) (C_y - B_y).

Simplify the equation by removing the addends that negate one another:

(x - A_x) (B_x - C_x) (C_y - A_y) + A_y C_y^2 - A_y^2 C_y + A_y^2 B_y - B_y C_y^2 + B_y^2 C_y - A_y B_y^2 = (x - B_x) (A_x - C_x) (C_y - B_y).

Factor out the squares:

(x - A_x) (B_x - C_x) (C_y - A_y) + A_y^2 (B_y - C_y) + B_y^2 (C_y - A_y) + C_y^2 (A_y - B_y) = (x - B_x) (A_x - C_x) (C_y - B_y).

Separate the elements containing x so that they can be grouped together:

x (B_x - C_x) (C_y - A_y) - A_x (B_x - C_x) (C_y - A_y) + A_y^2 (B_y - C_y) + B_y^2 (C_y - A_y) + C_y^2 (A_y - B_y) = x (A_x - C_x) (C_y - B_y) - B_x (A_x - C_x) (C_y - B_y).

Group the x components on the left side of the equation and group the others on the right side of the equation:

x (B_x - C_x) (C_y - A_y) - x (A_x - C_x) (C_y - B_y) = A_x (B_x - C_x) (C_y - A_y) - B_x (A_x - C_x) (C_y - B_y) - A_y^2 (B_y - C_y) - B_y^2 (C_y - A_y) - C_y^2 (A_y - B_y).

Multiply the products with similar terms and alphabetize within each addend for readability:

x (B_x C_y - A_y B_x - C_x C_y + A_y C_x - A_x C_y + A_x B_y + C_x C_y - B_y C_x) = A_x B_x C_y - A_x A_y B_x - A_x C_x C_y + A_x A_y C_x - A_x B_x C_y + A_x B_x B_y + B_x C_x C_y - B_x B_y C_x - A_y^2 (B_y - C_y) - B_y^2 (C_y - A_y) - C_y^2 (A_y - B_y).

Simplify by again removing the addends that negate one another:

x (B_x C_y - A_y B_x + A_y C_x - A_x C_y + A_x B_y - B_y C_x) = - A_x A_y B_x - A_x C_x C_y + A_x A_y C_x + A_x B_x B_y + B_x C_x C_y - B_x B_y C_x - A_y^2 (B_y - C_y) - B_y^2 (C_y - A_y) - C_y^2 (A_y - B_y).

The equation can be made more symmetric, as

x ( A_x (B_y - C_y) + B_x (C_y - A_y) + C_x (A_y - B_y) ) = B_x C_x (C_y - B_y) + A_x C_x (A_y - C_y) + A_x B_x (B_y - A_y) - A_y^2 (B_y - C_y) - B_y^2 (C_y - A_y) - C_y^2 (A_y - B_y).

Then the factors themselves can be grouped by identical products:

x ( A_x (B_y - C_y) + B_x (C_y - A_y) + C_x (A_y - B_y) ) = A_y^2 (C_y - B_y) + B_x C_x (C_y - B_y) + B_y^2 (A_y - C_y) + A_x C_x (A_y - C_y) + C_y^2 (B_y - A_y) + A_x B_x (B_y - A_y).

Therefore, the formula of the x coordinate is

x = ( A_y^2 (C_y - B_y) + B_x C_x (C_y - B_y) + B_y^2 (A_y - C_y) + A_x C_x (A_y - C_y) + C_y^2 (B_y - A_y) + A_x B_x (B_y - A_y) ) / ( A_x (B_y - C_y) + B_x (C_y - A_y) + C_x (A_y - B_y) ).

The only exceptions to this formula are the three special cases noted earlier: If B_y = C_y, then x = A_x. If A_y = C_y, then x = B_x. If A_y = B_y, then x = C_x. Those cases are evident in the denominator of the general formula above.

## The Y Coordinate

The y coordinate can be derived in the same manner. Begin with the point-slope formula for the line containing the altitude of A:

y - A_y = (x - A_x) (B_x - C_x) / (C_y - B_y).

It can be rewritten to express x in terms of y and the vertices' coordinates:

x = (y - A_y) (C_y - B_y) / (B_x - C_x) + A_x.

Substitute that value of x into the equation for the altitude of B, which is

y - B_y = (x - B_x) (A_x - C_x) / (C_y - A_y).

That substitution results in

y - B_y = ( (y - A_y) (C_y - B_y) / (B_x - C_x) + A_x - B_x) (A_x - C_x) / (C_y - A_y).

Regarding the denominators having nonzero values, the special cases of B_x = C_x and A_y = C_y were addressed earlier.

To continue solving for y, eliminate the denominator (C_y - A_y):

(y - B_y) (C_y - A_y) = ( (y - A_y) (C_y - B_y) / (B_x - C_x) + A_x - B_x) (A_x - C_x).

Distribute the (A_x - C_x) into the right side of the equation:

(y - B_y) (C_y - A_y) = (y - A_y) (C_y - B_y) (A_x - C_x) / (B_x - C_x) + A_x (A_x - C_x) - B_x (A_x - C_x).

Eliminate the denominator (B_x - C_x):

(y - B_y) (C_y - A_y) (B_x - C_x) = (y - A_y) (C_y - B_y) (A_x - C_x) + A_x (A_x - C_x) (B_x - C_x) - B_x (A_x - C_x) (B_x - C_x).

Multiply the factors with similar terms:

(y - B_y) (C_y - A_y) (B_x - C_x) = (y - A_y) (C_y - B_y) (A_x - C_x) + A_x^2 B_x - A_x^2 C_x - A_x B_x C_x + A_x C_x^2 - A_x B_x^2 + A_x B_x C_x + B_x^2 C_x - B_x C_x^2.

Simplify the equation by removing the addends that negate one another:

(y - B_y) (C_y - A_y) (B_x - C_x) = (y - A_y) (C_y - B_y) (A_x - C_x) + A_x^2 B_x - A_x^2 C_x + A_x C_x^2 - A_x B_x^2 + B_x^2 C_x - B_x C_x^2.

Factor out the squares:

(y - B_y) (C_y - A_y) (B_x - C_x) = (y - A_y) (C_y - B_y) (A_x - C_x) + A_x^2 (B_x - C_x) + B_x^2 (C_x - A_x) + C_x^2 (A_x - B_x).

Separate the elements containing y so that they can be grouped together:

y (C_y - A_y) (B_x - C_x) - B_y (C_y - A_y) (B_x - C_x) = y (C_y - B_y) (A_x - C_x) - A_y (C_y - B_y) (A_x - C_x) + A_x^2 (B_x - C_x) + B_x^2 (C_x - A_x) + C_x^2 (A_x - B_x).

Group the y components on the left side of the equation and group the others on the right side of the equation:

y (C_y - A_y) (B_x - C_x) - y (C_y - B_y) (A_x - C_x) = B_y (C_y - A_y) (B_x - C_x) - A_y (C_y - B_y) (A_x - C_x) + A_x^2 (B_x - C_x) + B_x^2 (C_x - A_x) + C_x^2 (A_x - B_x).

Multiply the products with similar terms:

y (B_x C_y - C_x C_y - A_y B_x + A_y C_x - A_x C_y + C_x C_y + A_x B_y - B_y C_x) = B_x B_y C_y - B_y C_x C_y - A_y B_x B_y + A_y B_y C_x - A_x A_y C_y + A_y C_x C_y + A_x A_y B_y - A_y B_y C_x + A_x^2 (B_x - C_x) + B_x^2 (C_x - A_x) + C_x^2 (A_x - B_x).

Simplify by again removing the addends that negate one another:

y (B_x C_y - A_y B_x + A_y C_x - A_x C_y + A_x B_y - B_y C_x) = B_x B_y C_y - B_y C_x C_y - A_y B_x B_y - A_x A_y C_y + A_y C_x C_y + A_x A_y B_y + A_x^2 (B_x - C_x) + B_x^2 (C_x - A_x) + C_x^2 (A_x - B_x).

The equation can be made more symmetric, as

y ( A_y (C_x - B_x) + B_y (A_x - C_x) + C_y (B_x - A_x) ) = A_x^2 (B_x - C_x) + B_y C_y (B_x - C_x) + B_x^2 (C_x - A_x) + A_y C_y (C_x - A_x) + C_x^2 (A_x - B_x) + A_y B_y (A_x - B_x ).

Therefore, the formula of the y coordinate is

y = ( A_x^2 (B_x - C_x) + B_y C_y (B_x - C_x) + B_x^2 (C_x - A_x) + A_y C_y (C_x - A_x) + C_x^2 (A_x - B_x) + A_y B_y (A_x - B_x) ) / ( A_y (C_x - B_x) + B_y (A_x - C_x) + C_y (B_x - A_x) ).

The only exceptions to this formula are the three special cases noted earlier: If B_x = C_x, then y = A_y. If A_x = C_x, then y = B_y. If A_x = B_x, then y = C_y. Those cases are evident in the denominator of the general formula above.

Throughout this process of deriving the various equations, the symmetry of the terms that compose them is unmistakable, and reflects the beauty of geometry.

## Examples

Consider a triangle whose coordinates have the values illustrated in Figure 1: (1,2), (6,6), (7,1). Plugging these values into the general formulas, the x and y coordinates of the orthocenter should be (to eight significant digits):

x = ( 2^2 (1 - 6) + 6*7 (1 - 6) + 6^2 (2 - 1) + 1*7 (2 - 1) + 1^2 (6 - 2) + 1*6 (6 - 2) ) / ( 1 (6 - 1) + 6 (1 - 2) + 7 (2 - 6) ) = 5.4827586

y = ( 1^2 (6 - 7) + 6*1 (6 - 7) + 6^2 (7 - 1) + 2*1 (7 - 1) + 7^2 (1 - 6) + 2*6 (1 - 6) ) / ( 2 (7 - 6) + 6 (1 - 7) + 1 (6 - 1) ) = 2.8965517

Those coordinates are indeed what are seen in that figure.

Next, consider a triangle whose coordinates have the values such that B_x = C_x: (1,3), (7,6), (7,1):

According to the general formula for the x coordinate and the relevant special case for the y coordinate, that triangle's orthocenter should be:

x = ( 3^2 (1 - 6) + 7*7 (1 - 6) + 6*6 (3 - 1) + 1*7 (3 - 1) + 1*1 (6 - 3) + 1*7 (6 - 3) ) / ( 1 (6 - 1) + 7 (1 - 3) + 7 (3 - 6) ) = 6

y = 3

Again, the altitudes in the figure intersect at that exact point.

Lastly, consider a triangle with coordinates such that B_y = C_y: (3,1), (1,6), (7,6):

The x and y coordinates of its orthocenter should be:

x = 3

y = ( 3^2 (1 - 7) + 6*6 (1 - 7) + 1^2 (7 - 3) + 1*6 (7 - 3) + 7^2 (3 - 1) + 1*6 (3 - 1) ) / ( 1 (7 - 1) + 6 (3 - 7) + 6 (1 - 3) ) = 4.4

These results are consistent with the graph in the figure.

## Conclusion

For any triangle defined by the vertices (A_x,A_y), (B_x,B_y), and (C_x,C_y), the Cartesian coordinates of its orthocenter can be representated by these formulas:

If B_y = C_y, then x = A_x. If A_y = C_y, then x = B_x. If A_y = B_y, then x = C_x. Otherwise,

x = ( A_y^2 (C_y - B_y) + B_x C_x (C_y - B_y) + B_y^2 (A_y - C_y) + A_x C_x (A_y - C_y) + C_y^2 (B_y - A_y) + A_x B_x (B_y - A_y) ) / ( A_x (B_y - C_y) + B_x (C_y - A_y) + C_x (A_y - B_y) ).

If B_x = C_x, then y = A_y. If A_x = C_x, then y = B_y. If A_x = B_x, then y = C_y. Otherwise,

y = ( A_x^2 (B_x - C_x) + B_y C_y (B_x - C_x) + B_x^2 (C_x - A_x) + A_y C_y (C_x - A_x) + C_x^2 (A_x - B_x) + A_y B_y (A_x - B_x) ) / ( A_y (C_x - B_x) + B_y (A_x - C_x) + C_y (B_x - A_x) ).