# Solve linear system with $A_{i,j} = \langle e_i, e_j\rangle^2$, edges of a triangle

I have three vectors in $e_i\in\mathbb{R}^3$ that form a triangle. Let us consider now the linear equation system $Ax=b$ with $$A_{i,j} = \langle e_i, e_j\rangle^2,\\ b_i = \langle e_i, e_i\rangle.$$ I can solve these problems numerically, but somehow I feel I'm missing out. Perhaps the solution can even be constructed explicitly from $e_i$?

Any ideas?

• Just a clarification of your notation. $A_{i,j}$ is a matrix whose element $a_{i,j}=\langle e_i,e_j\rangle^2$ and $b_j$ a vector whose $i$th element is the inner product $\langle e_i,e_i\rangle$? Jul 9, 2016 at 18:42
• The elements of $A$ are $A_{i,j}$, the elements of $b$ are $b_i$. Jul 9, 2016 at 18:47
• I would start by reviewing Numerical Linear Algebra by Lloyd N. Trefethen and David Bau. I have seeing these kind things but I don't regularly work in Numerical Analysis so I am just giving you the typical reference for such sort of problems. I think you will want to start by reading Cholesky decomposition if you have sufficient background to read the book. Jul 9, 2016 at 18:52
• I am curious whether a solution $x$ has a nice geometric interpretation.
– Neal
Jul 11, 2016 at 23:48
• It has: It's the distance between the circumcenter and the edge midpoint divided by the triangle volume and the edge length. The number is negative the circumcenter it is on the "wrong" side of the edge (outside of the triangle). Jul 13, 2016 at 14:38

Just so you know, it is possible to write $P^T A P = D$ diagonal with the entries of $P$ being rational expressions in the entries of $A.$ If desired, we can take a diagonal matrix $Q$ involving square roots of the absolute values of the entries of $D$ to get $Q P^T A P Q = W,$ where $W$ is diagonal and all entries are $0,1,-1.$ Note that there is no need for $A$ to be positive, just symmetric.

Here is the idea in symbols; one may change the order of operations if convenient.

? m = [ a,f,e; f,b,d; e,d,c]
%1 =
[a f e]

[f b d]

[e d c]

? m - mattranspose(m)
%2 =
[0 0 0]

[0 0 0]

[0 0 0]

? p1 = [ 1, -f/a, -e/a; 0,1,0; 0,0,1]
%6 =
[1 -f/a -e/a]

[0 1 0]

[0 0 1]

? m1 = mattranspose(p1) * m * p1
%7 =
[a 0 0]

[0 (b*a - f^2)/a (d*a - e*f)/a]

[0 (d*a - e*f)/a (c*a - e^2)/a]

? p2 = [ 1,0,0; 0,1, (a * d - e * f) / (f^2 - a * b); 0,0,1]
%9 =
[1 0 0]

[0 1 (d*a - e*f)/(-b*a + f^2)]

[0 0 1]

? m2 = mattranspose(p2) * m1 * p2
%10 =
[a 0 0]

[0 (b*a - f^2)/a 0]

[0 0 ((-c*b + d^2)*a + (c*f^2 - 2*d*e*f + b*e^2))/(-b*a + f^2)]

? m
%11 =
[a f e]

[f b d]

[e d c]

? matdet(m)
%12 = (c*b - d^2)*a + (-c*f^2 + 2*d*e*f - b*e^2)
?


Let's first assume that the triangle is in the $z=0$-plane. After some computation SymPy spits out

(b0*c0 + b1*c1)/(a0*a0*b1*c1 - a0*a1*b0*c1 - a0*a1*b1*c0 + a1**2*b0*c0)
(a0*c0 + a1*c1)/(a0*b1*b1*c0 - a0*b0*b1*c1 - a1*b0*b1*c0 + a1*b0*b0*c1)
(a0*b0 + a1*b1)/(a0*b0*c1*c1 - a0*b1*c0*c1 - a1*b0*c0*c1 + a1*b1*c0*c0)


as a solution (where (a0, a1), (b0, b1), (c0, c1) are the edge coordinates). Clearly the numerator is the dot-product of the two "other" edges; the denominator of the first component equals (a0*b1 - a1*b0) * (a0*c1 - a1*c0). Together, this can be written as $$x_1 = \frac{\langle e_2, e_3\rangle}{\langle e_1\times e_2, e_1\times e_3\rangle}$$ for the solution in the first component. (The other components likewise.)

The result holds true if the triangle is rotated in space since $$\langle R a, R b\rangle = \langle a, b\rangle \text{ and}\\ (R a)\times (R b) = R(a\times b)$$ for any two vectors $a, b$ and any rotation matrix $R$.