1. ## Series elimination

In doing least squares, I end up with a system of linear equations consisting of series that I have no idea how to eliminate. The system of linear equations consists of the following:

C*n + D*∑ $Ai$ = ∑ $Bi$
C*∑ $Ai$ + D*∑ $(Ai)^2$ = ∑ $AiBi$

I need to solve for C and D. All series are from i = 1:n. My calculus is rusty so I don't quite recall how I can eliminate any of the series. Any help would be appreciated, thanks.

2. Originally Posted by algorith
In doing least squares, I end up with a system of linear equations consisting of series that I have no idea how to eliminate. The system of linear equations consists of the following:

C*n + D*∑ $Ai$ = ∑ $Bi$
C*∑ $Ai$ + D*∑ $(Ai)^2$ = ∑ $AiBi$

I need to solve for C and D. All series are from i = 1:n. My calculus is rusty so I don't quite recall how I can eliminate any of the series. Any help would be appreciated, thanks.
$Cn + D\sum{Ai} = \sum{Bi}$
$C\sum{Ai} + D\sum{(Ai)^2} = \sum{AiBi}$.

Multiply equation 1 by $\sum{Ai}$ and multiply equation 2 by $n$.

Then you get

$Cn\sum{Ai} + D\left[\sum{Ai}\right]^2 = \sum{Ai}\sum{Bi}$
$Cn\sum{Ai} + Dn\sum{(Ai)^2} = n\sum{AiBi}$.

Now you should be able to eliminate the $C$ terms.

3. Awesome, thanks a bunch.