Help with Cramer's rule and barycentric coordinates I'm trying to learn about barycentric coordinates so after a Google search found this PDF file which didn't look too scary. I'm only on page 3 and getting confused so hope I can get help here...
A triangle has vertices $p_1$, $p_2$, $p_3$ and a barycentric combination of the three points takes the form $$p = up_1 + vp_2 + wp_3$$ where $$u + v + w = 1$$ It says p can be rewritten $$p=up_1 + vp_2 + (1 - u - v)p_3$$
Then it asks "How can we find the barycentric coordinates of a given point p?" The claim is that there are 3 equations and the following linear system is setup:
$$\begin{bmatrix}p_1&p_2&p_3\\1&1&1\end{bmatrix}\begin{bmatrix}u\\v\\w\end{bmatrix} = \begin{bmatrix}p\\1\end{bmatrix}$$ for the unknown $u,v,w$. The system is then solved using Cramer's rule:
$$A = \begin{vmatrix}p_1&p_2&p_3\\1&1&1\end{vmatrix}$$
$$A_1 = \begin{vmatrix}p&p_2&p_3\\1&1&1\end{vmatrix}$$
$$A_2 = \begin{vmatrix}p_1&p&p_3\\1&1&1\end{vmatrix}$$
$$A_3 = \begin{vmatrix}p_1&p_2&p\\1&1&1\end{vmatrix}$$
My 2 points of confusion: 1) Is there 3 equations as claimed? I can see $p = \dots$ and $u + v + w = 1$ which is 2 equations. 2) Cramer's rule uses determinants, i.e. a value linked to a square matrix. The coefficient matrix here is 2-by-3, not square. Can someone help me see what the author is doing here please?
 A: The system is 3x3, not 2x3; what's written there is shorthand for
$$\left[\begin{array}{ccc} p^1_x & p^2_x & p^3_x \\
p^1_y & p^2_y & p^3_y\\
1 & 1 & 1\end{array}\right]\left[\begin{array}{c}u\\v\\w\end{array}\right] = \left[\begin{array}{c} p_x\\p_y \\1\end{array}\right].$$
It should be clear what the three equations are here and why they make sense. You can now solve for $u, v, w$ using Cramer's Rule, if you're so inclined, but I'd reduce the problem to two dimensions instead:
$$\left[\begin{array}{cc}p^1_x - p^3_x & p^2_x - p^3_x\\p^1_y - p^3_y & p^2_y - p^3_y\end{array}\right]\left[\begin{array}{c}u\\v\end{array}\right] = \left[\begin{array}{c} p_x - p^3_x\\p_y-p^3_y\end{array}\right],$$
and then invert the matrix on the left to get
$$\left[\begin{array}{c}u\\v\end{array}\right] = \frac{1}{2A} \left[\begin{array}{cc} p_y^2-p_y^3 & p_x^3-p_x^2\\p_y^3-p_y^1 & p_x^1 -p_x^3\end{array}\right]\left[\begin{array}{c} p_x - p^3_x\\p_y-p^3_y\end{array}\right],$$
where $A$, half the determinant of the matrix, is the (signed) area of the triangle.
