# Linear Algebra for Least Square Lines for Data

Find the least-squares line for the data below by following the steps after the data.

Data Given

The year 1880 1910 1940 1970 2000

Global Mean Temperature 13.73O 13.72O 13.98O 14.00O 14.51O

A) Give the entries of A and bin Ax=b for this data.

For this part, I put A as v1=(1,1,1,1,1) and v2= (1880,1910,1940,1970,2000) and for b I have (13.73,13.72,13.98,14,14.51)

B) Give the equation whose solution will give the coefficients of the least-squares line.

I got A^tAx=A^tb

Matrix A^t* I have v1= (5,9700) and v2=(9700, 18,827,000) Matrix A^tb I have (96.94, 135,738,80)

C)Use some appropriate technology to find the coefficients of the least-squares line.

After plugging it in I have x to be (11,298.289 , -5.813)

Can anyone confirm if I did this entire problem correctly or if I missed something.

• You have to left-multiply both sides by $A^T$. This new equation will give you the least squares solution. Here’s a resource: math.mit.edu/~gs/linearalgebra/ila0403.pdf – DevrimA Apr 27 at 17:08
• But multiplying A*A^T (Year time transpose Year) I get a ridiculously big matrix with big numbers – user769545 Apr 27 at 17:10
• @Displayer123 you have the order backwards. "Left-multiply by $A$" means that you end up with $A^TA$. – Omnomnomnom Apr 27 at 17:14
• Oh duh, thanks! But it corrected to have A as 1 or 2 vectors? 1 vector just being the given data and 2 vectors being V1 as only 1's and V2 being the data given – user769545 Apr 27 at 17:16
• @displayer123 you can multiply A*A^T. The dimensions that don't match. You want to solve $A^{T}A \hat{x}=A^{T}b$ – DevrimA Apr 27 at 17:16