# Math Help - Help with elipsid and points

1. ## Help with elipsid and points

Hi I new here and I hope to get som help with a problem i cant seem to figur out.

I need to find the ellipsoid of the form ax^2 + by^2 + cz^2 = 1 that fits best to a bunch of points:

p1: x=2 y=2 z=-1
p2: x=1 y=2 z=0
p3: x=-3 y=1 z=2
p4: x=-1 y=2 z=2
p5: x=3 y=-3 z=2
p6: x=2 y=0 z=2
p7: x=1 y=-2 z=2
p8: x=1 y=-1 z=1
p9: x=-3 y=2 z=2

I really hope you can help me solve this problem!

2. Think of that as 9 separate equations:
4a+ 4y+ zc= 1
a+ 4y= 1
9a+ b+ 4c= 1
a+ 4b+ 4c= 1
9a+ 9y+ 4c= 1
4a+ 4z= 1
a+ 4b+ 4c= 1
a+ b+ c= 1
9a+ 4b+ 4c= 1
By setting x, y, and z equal to each or those 9 sets of values in the equation $ax^2+ by^2+ cz^2= 1$.

Now write that as a matrix equation:
$\begin{bmatrix}4 & 4 & 1 \\ 1 & 4 & 0 \\ 9 & 1 & 4 \\ 1 & 4 & 4 \\ 9 & 9 & 2\\ 4 & 0 & 4 \\ 1 & 4 & 4 \\ 1 & 1 & 1\\ 9 & 4 & 4\end{bmatrix}\begin{bmatrix}x \\ y \\ z\end{bmatrix}= \begin{bmatrix} 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \end{bmatrix}$ or AX= B.

A maps $R^3$ into a 3 dimensional subspace of $R^9$. You can solve that equation if and only if B happens to lie in that subspace. If it does not, you can try to find X such that AX, while still in the subspace, is as close to B as possible (the "best fit"). That will be true when the difference, B- AX, is perpendicular to Ax. In fact, it will be orthogonal to the entire subspace. In terms of the inner product, <Au, B-AX>= 0 where u is any vector in $R^3$. Let A' be the adjoint of A.

(For A a linear transformation from inner product space U to inner product space V, the "adjoint", A', is defined as the linear transformation from V back to U such that $_V= _U$ where the subscript indicates the space in which the inner product is taken. For a matrix with real number entries the adjoint is just the transpose.)

Then <Au, B- AX>= <u, A'(B- AX)>= 0. The difference now is that since u could be any vector in $R^3$, we must have A'(B- AX)= A'B- A'AX= 0 or A'AX= A'B. While A, being a "9 by 3" matrix is not invertible, A'A is a 3 by 3 matrix and may be invertible. If it is then $X= (A'A)^{-1}(A'B)$ is the "best fit". This is essentially a "least squares" best fit.