Compute orthocenter (intersection of altitudes), centroid, triangle type, and Euler line from vertex coordinates. Visualize the triangle, its altitudes, and centers on an interactive canvas. Perfect for geometry students, teachers, and professionals.
In triangle geometry, the orthocenter (H) is the point where the three altitudes intersect. An altitude is a line through a vertex perpendicular to the opposite side. The orthocenter is one of the four classic triangle centers (with centroid, circumcenter, incenter) and plays a key role in the Euler line and the nine‑point circle.
If A(x₁,y₁), B(x₂,y₂), C(x₃,y₃) are vertices, then orthocenter H satisfies:
(x - x₁)·(x₃ - x₂) + (y - y₁)·(y₃ - y₂) = 0 (altitude through A)
and similarly for B.
The concept of altitudes dates back to ancient Greek mathematicians (Euclid, Archimedes). However, the term “orthocenter” was introduced in the 19th century. Leonhard Euler proved that the orthocenter, centroid, and circumcenter are always collinear (Euler line) for any non‑equilateral triangle. This discovery unified many properties of triangles and is a cornerstone of modern triangle geometry. The orthocenter also appears in surprising contexts: it is the isogonal conjugate of the circumcenter, and its reflections across the sides lie on the circumcircle.
Given coordinates, we compute orthocenter H by solving two altitude equations. Using the perpendicular condition, altitude through A is:
(Bx - Cx)(x - Ax) + (By - Cy)(y - Ay) = 0.
Altitude through B: (Ax - Cx)(x - Bx) + (Ay - Cy)(y - By) = 0.
These form two linear equations in x and y, solved via Cramer’s rule. The centroid G is simply the arithmetic mean: ((x₁+x₂+x₃)/3 , (y₁+y₂+y₃)/3).
The triangle type (acute/right/obtuse) is determined by the signs of the dot products of the side vectors at each vertex. For example, at A, compute vectors AB and AC: if their dot product is positive → acute angle; zero → right; negative → obtuse.
The Euler line (H, G, and circumcenter O) exists for all non‑equilateral triangles, and satisfies HG = 2·GO. In an equilateral triangle all centers coincide.
The following data have all undergone real-time verification and are completely consistent with the results obtained by clicking the example buttons.
| Triangle type | Vertices (example) | Orthocenter H | Centroid G | Location of H |
|---|---|---|---|---|
| Acute | A(1,2), B(5,3), C(2,6) | (2.60, 3.60) | (2.67, 3.67) | Inside triangle |
| Right (∠C=90°) | A(0,0), B(4,0), C(0,3) | (0.00, 0.00) | (1.33, 1.00) | At right‑angled vertex C |
| Obtuse (∠C > 90°) | A(0,0), B(5,0), C(2,1) | (2.00, 6.00) | (2.33, 0.33) | Outside triangle |
| Equilateral | A(0,0), B(2,0), C(1,1.732) | (1.00, 0.577) | (1.00, 0.577) | Same as centroid |
An architect designs a symmetrical triangular roof truss with vertices A(0,0), B(8,0), C(4,5). To place a vertical support (king post) from the apex C to the base AB, the optimal load‑bearing point is the foot of the altitude, not the orthocenter. However, understanding the orthocenter helps in analyzing force distribution: the intersection of altitudes corresponds to the common point where all three “heights” meet, useful for graphical statics (Cremona diagram). Our calculator gives H = (4.00, 3.20) and G = (4.00, 1.67). Both points lie on the same vertical line (the Euler line), with the centroid located between the orthocenter and the circumcenter (not shown). The difference in y‑coordinates illustrates the Euler line property.
For any non‑equilateral triangle, the orthocenter H, centroid G, and circumcenter O are collinear, and HG = 2·GO. This remarkable line is called the Euler line. The midpoints of the sides, the feet of the altitudes, and the midpoints of the segments from the orthocenter to the vertices all lie on a single circle – the nine‑point circle – whose center is the midpoint of OH. Our interactive graph helps you visualize these relationships.
function orthocenter(ax, ay, bx, by, cx, cy) {
// Coefficients from altitude equations
let a1 = cx - bx; // (Cx - Bx)
let b1 = cy - by; // (Cy - By)
let c1 = a1 * ax + b1 * ay; // right-hand side for first equation
let a2 = cx - ax; // (Cx - Ax)
let b2 = cy - ay; // (Cy - Ay)
let c2 = a2 * bx + b2 * by; // RHS for second equation
let det = a1 * b2 - a2 * b1;
if (Math.abs(det) < 1e-12) return null; // degenerate
let x = (c1 * b2 - c2 * b1) / det;
let y = (a1 * c2 - a2 * c1) / det;
return [x, y];
}