In the context of a
triangle, barycentric coordinates are also known as
area coordinates or
areal coordinates, because the coordinates of
P with respect to triangle
ABC are equivalent to the (signed) ratios of the areas of
PBC,
PCA and
PAB to the area of the reference triangle
ABC. Areal and
trilinear coordinates are used for similar purposes in geometry. Barycentric or areal coordinates are extremely useful in engineering applications involving
triangular subdomains. These make analytic
integrals often easier to evaluate, and
Gaussian quadrature tables are often presented in terms of area coordinates. Consider a triangle ABC with vertices A=(a_1,a_2), B=(b_1,b_2), C=(c_1,c_2) in the x,y-plane, \mathbb{R}^2. One may regard points in \mathbb{R}^2 as vectors, so it makes sense to add or subtract them and multiply them by scalars. Each triangle ABC has a
signed area or
sarea, which is plus or minus its area: \operatorname{sarea}(ABC) = \pm \operatorname{area}(ABC). The sign is plus if the path from A to B to C then back to A goes around the triangle in a counterclockwise direction. The sign is minus if the path goes around in a clockwise direction. Let P be a point in the plane, and let (\lambda_1,\lambda_2,\lambda_3) be its
normalized barycentric coordinates with respect to the triangle ABC, so P = \lambda_1 A + \lambda_2 B + \lambda_3 C and 1 = \lambda_1 + \lambda_2 + \lambda_3. Normalized barycentric coordinates (\lambda_1,\lambda_2,\lambda_3) are also called
areal coordinates because they represent ratios of signed areas of triangles: \begin{align}\lambda_1 &= \operatorname{sarea}(PBC)/\operatorname{sarea}(ABC)\\ \lambda_2 &= \operatorname{sarea}(APC)/\operatorname{sarea}(ABC)\\ \lambda_3 &= \operatorname{sarea}(ABP)/\operatorname{sarea}(ABC).\end{align} One may prove these ratio formulas based on the facts that a triangle is half of a
parallelogram, and the area of a parallelogram is easy to compute using a
determinant. Specifically, let D = -A+B+C. ABCD is a parallelogram because its pairs of opposite sides, represented by the pairs of displacement vectors D-C=B-A, and D-B=C-A, are parallel and congruent. Triangle ABC is half of the parallelogram ABDC, so twice its
signed area is equal to the signed area of the parallelogram, which is given by the 2\times 2 determinant \det(B-A,C-A) whose
columns are the displacement vectors B-A and C-A: \operatorname{sarea}(ABCD)=\det\begin{pmatrix}b_1-a_1 & c_1-a_1 \\ b_2-a_2 & c_2-a_2\end{pmatrix} Expanding the determinant, using its
alternating and multilinear properties, one obtains \begin{align}\det(B-A,C-A) &= \det(B,C)-\det(A,C)-\det(B,A)+\det(A,A) \\ &= \det(A,B)+\det(B,C)+\det(C,A) \end{align} so 2 \operatorname{sarea}(ABC) = \det(A,B)+\det(B,C)+\det(C,A). Similarly, 2 \operatorname{sarea}(PBC) = \det(P,B)+\det(B,C)+\det(C,P) , To obtain the ratio of these signed areas, express P in the second formula in terms of its barycentric coordinates: \begin{align}2 \operatorname{sarea}(PBC) &= \det(\lambda_1 A + \lambda_2 B + \lambda_3 C, B) + \det(B,C) + \det(C,\lambda_1 A + \lambda_2 B + \lambda_3 C)\\ &= \lambda_1 \det(A,B) + \lambda_3 \det(C,B) + \det(B,C) + \lambda_1 \det(C,A) + \lambda_2 \det(C,B)\\ &= \lambda_1 \det(A,B) + \lambda_1 \det(C,A) + (1-\lambda_2 - \lambda_3) \det(B,C) \end{align}. The barycentric coordinates are normalized so 1 = \lambda_1 + \lambda_2 + \lambda_3, hence \lambda_1 = (1-\lambda_2 - \lambda_3) . Plug that into the previous line to obtain \begin{align}2 \operatorname{sarea}(PBC) &= \lambda_1 (\det(A,B)+\det(B,C)+\det(C,A)) \\ &= (\lambda_1)(2 \operatorname{sarea}(ABC)).\end{align} Therefore \lambda_1 = \operatorname{sarea}(PBC)/\operatorname{sarea}(ABC). Similar calculations prove the other two formulas \lambda_2 = \operatorname{sarea}(APC)/\operatorname{sarea}(ABC) \lambda_3 = \operatorname{sarea}(ABP)/\operatorname{sarea}(ABC).
Trilinear coordinates (\gamma_1,\gamma_2,\gamma_3) of P are signed distances from P to the lines BC, AC, and AB, respectively. The sign of \gamma_1 is positive if P and A lie on the same side of BC, negative otherwise. The signs of \gamma_2 and \gamma_3 are assigned similarly. Let a = \operatorname{length}(BC), b = \operatorname{length}(CA), c = \operatorname{length}(AB). Then \begin{align}\gamma_1 a &= \pm 2\operatorname{sarea}(PBC)\\ \gamma_2 b &= \pm 2\operatorname{sarea}(APC)\\ \gamma_3 c &= \pm 2\operatorname{sarea}(ABP)\end{align} where, as above, sarea stands for signed area. All three signs are plus if triangle ABC is positively oriented, minus otherwise. The relations between trilinear and barycentric coordinates are obtained by substituting these formulas into the above formulas that express barycentric coordinates as ratios of areas. Switching back and forth between the barycentric coordinates and other coordinate systems makes some problems much easier to solve.
Conversion between barycentric and Cartesian coordinates Edge approach Given a point \mathbf{r} in a triangle's plane one can obtain the barycentric coordinates \lambda_1, \lambda_2 and \lambda_3 from the
Cartesian coordinates (x, y) or vice versa. We can write the Cartesian coordinates of the point \mathbf{r} in terms of the Cartesian components of the triangle vertices \mathbf{r}_1, \mathbf{r}_2, \mathbf{r}_3 where \mathbf{r}_i = (x_i, y_i) and in terms of the barycentric coordinates of \mathbf{r} as \begin{align} x &= \lambda_1 x_1 + \lambda_2 x_2 + \lambda_3 x_3 \\[2pt] y &= \lambda_1 y_1 + \lambda_2 y_2 + \lambda_3 y_3 \end{align} That is, the Cartesian coordinates of any point are a weighted average of the Cartesian coordinates of the triangle's vertices, with the weights being the point's barycentric coordinates summing to unity. To find the reverse transformation, from Cartesian coordinates to barycentric coordinates, we first substitute \lambda_3 = 1 - \lambda_1 - \lambda_2 into the above to obtain \begin{align} x &= \lambda_1 x_1 + \lambda_2 x_2 + (1 - \lambda_1 - \lambda_2) x_3 \\[2pt] y &= \lambda_1 y_1 + \lambda_2 y_2 + (1 - \lambda_1 - \lambda_2) y_3 \end{align} Rearranging, this is \begin{align} \lambda_1(x_1 - x_3) + \lambda_2(x_2 - x_3) + x_3 - x &= 0 \\[2pt] \lambda_1(y_1 - y_3) + \lambda_2(y_2 -\, y_3) + y_3 - \, y &= 0 \end{align} This
linear transformation may be written more succinctly as \mathbf{T} \cdot \lambda = \mathbf{r}-\mathbf{r}_3 where \lambda is the
vector of the first two barycentric coordinates, \mathbf{r} is the
vector of
Cartesian coordinates, and \mathbf{T} is a
matrix given by \mathbf{T} = \left(\begin{matrix} x_1-x_3 & x_2-x_3 \\ y_1-y_3 & y_2-y_3 \end{matrix}\right) Now the matrix \mathbf{T} is
invertible, since \mathbf{r}_1-\mathbf{r}_3 and \mathbf{r}_2-\mathbf{r}_3 are
linearly independent (if this were not the case, then \mathbf{r}_1, \mathbf{r}_2, and \mathbf{r}_3 would be
collinear and would not form a triangle). Thus, we can rearrange the above equation to get \left(\begin{matrix}\lambda_1 \\ \lambda_2\end{matrix}\right) = \mathbf{T}^{-1} ( \mathbf{r}-\mathbf{r}_3 ) Finding the barycentric coordinates has thus been reduced to finding the
2×2 inverse matrix of \mathbf{T}, an easy problem. Explicitly, the formulae for the barycentric coordinates of point \mathbf{r} in terms of its Cartesian coordinates (
x, y) and in terms of the Cartesian coordinates of the triangle's vertices are: \begin{align} \lambda_1 =&\ \frac{(y_2-y_3)(x-x_3) + (x_3-x_2)(y-y_3)}{\det(\mathbf T)} \\[4pt] &= \frac{(y_2-y_3)(x-x_3) + (x_3-x_2)(y-y_3)}{(y_2-y_3)(x_1-x_3) + (x_3-x_2)(y_1-y_3)} \\[4pt] &= \frac{(\mathbf{r}-\mathbf{r_3})\times(\mathbf{r_2}-\mathbf{r_3})}{(\mathbf{r_1}-\mathbf{r_3})\times(\mathbf{r_2}-\mathbf{r_3})} \\[12pt] \lambda_2 =&\ \frac{(y_3-y_1)(x-x_3) + (x_1-x_3)(y-y_3)}{\det(\mathbf T)} \\[4pt] &= \frac{(y_3-y_1)(x-x_3) + (x_1-x_3)(y-y_3)}{(y_2-y_3)(x_1-x_3) + (x_3-x_2)(y_1-y_3)} \\[4pt] &= \frac{(\mathbf{r}-\mathbf{r_3})\times(\mathbf{r_3}-\mathbf{r_1})}{(\mathbf{r_1}-\mathbf{r_3})\times(\mathbf{r_2}-\mathbf{r_3})} \\[12pt] \lambda_3 =&\ 1 - \lambda_1 - \lambda_2 \\[4pt] &= 1-\frac{(\mathbf{r}-\mathbf{r_3})\times(\mathbf{r_2}-\mathbf{r_1})}{(\mathbf{r_1}-\mathbf{r_3})\times(\mathbf{r_2}-\mathbf{r_3})} \\[4pt] &= \frac{(\mathbf{r}-\mathbf{r_1})\times(\mathbf{r_1}-\mathbf{r_2 })}{(\mathbf{r_1}-\mathbf{r_3})\times(\mathbf{r_2}-\mathbf{r_3})} \end{align}When understanding the last line of equation, note the identity (\mathbf{r_1}-\mathbf{r_3})\times(\mathbf{r_2}-\mathbf{r_3})=(\mathbf{r_3}-\mathbf{r_1})\times(\mathbf{r_1}-\mathbf{r_2}).
Vertex approach Another way to solve the conversion from Cartesian to barycentric coordinates is to write the relation in the
matrix form \mathbf{R} \boldsymbol{\lambda} = \mathbf{r}with \mathbf{R} = \left(\, \mathbf{r}_1 \,|\, \mathbf{r}_2 \,|\, \mathbf{r}_3 \right) and \boldsymbol{\lambda} = \left(\lambda_1,\lambda_2,\lambda_3\right)^\top, i.e. \begin{pmatrix} x_1 & x_2 & x_3\\ y_1 & y_2 & y_3 \end{pmatrix} \begin{pmatrix} \lambda_1 \\ \lambda_2 \\ \lambda_3 \end{pmatrix} = \begin{pmatrix}x\\y\end{pmatrix} To get the unique normalized solution we need to add the condition \lambda_1 + \lambda_2 + \lambda_3 = 1. The barycentric coordinates are thus the solution of the
linear system \left(\begin{matrix} 1 & 1 & 1 \\ x_1 & x_2 & x_3\\ y_1 & y_2 & y_3 \end{matrix}\right) \begin{pmatrix} \lambda_1 \\ \lambda_2 \\ \lambda_3 \end{pmatrix} = \left(\begin{matrix} 1\\x\\y \end{matrix}\right) which is \begin{pmatrix} \lambda_1 \\ \lambda_2 \\ \lambda_3 \end{pmatrix} = \frac{1}{2A} \begin{pmatrix} x_2y_3-x_3y_2 & y_2-y_3 & x_3-x_2 \\ x_3y_1-x_1y_3 & y_3-y_1 & x_1-x_3 \\ x_1y_2-x_2y_1 & y_1-y_2 & x_2-x_1 \end{pmatrix}\begin{pmatrix} 1\\x\\y \end{pmatrix} where 2A = \det(1|R) = x_1(y_2-y_3) + x_2(y_3-y_1) + x_3(y_1-y_2)is twice the signed area of the triangle. The area interpretation of the barycentric coordinates can be recovered by applying
Cramer's rule to this linear system.
Conversion between barycentric and trilinear coordinates A point with
trilinear coordinates x :
y :
z has barycentric coordinates
ax :
by :
cz where
a,
b,
c are the side lengths of the triangle. Conversely, a point with barycentrics \lambda_1 : \lambda_2 : \lambda_3 has trilinears \lambda_1/a:\lambda_2/b:\lambda_3/c.
Equations in barycentric coordinates The three sides
a, b, c respectively have equations \begin{array}{rccccc} A = & 1 &:& 0 &:& 0 \\ B = & 0 &:& 1 &:& 0 \\ C = & 0 &:& 0 &:& 1 \end{array} The
centroid would be at \tfrac{1}{3}:\tfrac{1}{3}:\tfrac{1}{3} \begin{array}{rccccc} & \sin 2\alpha &:& \sin 2\beta &:& \sin 2\gamma \\[2pt] =& 1-\cot\beta\cot\gamma &:& 1-\cot\gamma\cot\alpha &:& 1-\cot\alpha\cot\beta \\[2pt] =& a^2(-a^2+b^2+c^2) &:& b^2(a^2-b^2+c^2) &:& c^2(a^2+b^2-c^2) \end{array} The
orthocenter has coordinates The
excenters have coordinates \begin{array}{rrcrcr} J_A = & -a &:& b &:& c \\ J_B = & a &:& -b &:& c \\ J_C = & a &:& b &:& -c \end{array} The
nine-point center has coordinates \begin{array}{rccccc} & a\cos(\beta-\gamma) &:& b\cos(\gamma-\alpha) &:& c\cos(\alpha-\beta) \\[4pt] =& 1+\cot\beta\cot\gamma &:& 1+\cot\gamma\cot\alpha &:& 1+\cot\alpha\cot\beta \\[4pt] =& a^2(b^2+c^2) - (b^2-c^2)^2 &:& b^2(c^2+a^2) - (c^2-a^2)^2 &:& c^2(a^2+b^2) - (a^2-b^2)^2 \end{array} The
Gergonne point has coordinates (s-b)(s-c):(s-c)(s-a):(s-a)(s-b). The
Nagel point has coordinates s-a:s-b:s-c. The
symmedian point has coordinates a^2:b^2:c^2. ==Barycentric coordinates on tetrahedra==