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*∑$\displaystyle Ai$ = ∑$\displaystyle Bi$
C*∑$\displaystyle Ai$ + D*∑$\displaystyle (Ai)^2$ = ∑$\displaystyle 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*∑$\displaystyle Ai$ = ∑$\displaystyle Bi$
C*∑$\displaystyle Ai$ + D*∑$\displaystyle (Ai)^2$ = ∑$\displaystyle 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.
$\displaystyle Cn + D\sum{Ai} = \sum{Bi}$
$\displaystyle C\sum{Ai} + D\sum{(Ai)^2} = \sum{AiBi}$.

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

Then you get

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

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

3. Awesome, thanks a bunch.