# Computing scalars numerically [closed]

I have a formula like this

x1 * Vector1 + x2 * Vector2 + ... + xn * Vectorn = NewVector


where Vectorn and NewVector contain three numbers each and xn a single scalar. Vectorn and NewVector are given.

How do I compute x1...xn numerically in c#?

• What does this have to do with differential equations? – amd May 16 '18 at 0:00
• @amd I corrected it – Aurelius Schnitzler May 16 '18 at 0:02
• What is the value of $n$ comparing with 3? – user May 16 '18 at 9:10

The equation is $Ax = b$, or $$\pmatrix{ u_1 & u_2 & \cdots & u_n \\ v_1 & v_2 & \cdots & v_n \\ w_1 & w_2 & \cdots & w_n \\ } \pmatrix{ x_1 \\ x_2 \\ \vdots \\ x_n \\ } = \pmatrix{ u \\ v \\ w \\ }$$ Since $A$ is $3 \times n$ and so rectangular, this is a linear least squares and reduces to solving the normal equations $A^T A x = A^T b$.