[phpBB Debug] PHP Notice: in file /viewtopic.php on line 988: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone.
[phpBB Debug] PHP Notice: in file /viewtopic.php on line 988: getdate(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone.
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4509: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3706)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4511: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3706)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4512: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3706)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4513: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3706)
Exercise set 6.5 question 8 Elementary Linear Algebra 10E

## Exercise set 6.5 question 8 Elementary Linear Algebra 10E

All Linear Algebra and matrix questions here.

Moderator: ChangBroot

Forum rules
To type use \`int\` and the same way to type simply type \`sqrt\` or Please view the examples forum.

As you type, live preview is displayed so you know exactly what are you typing.

### Exercise set 6.5 question 8 Elementary Linear Algebra 10E

Exercise set 6.5 question 8 Elementary Linear Algebra 10E Anton/Rorres

8. The owner of the rapidly expanding business finds that for the first five months of the year the sales (in thousands) are \$4.0, \$4.4, \$5.2, \$6.4 and \$8.0. The owner plots these figures on the graph and conjectures that for the rest of the year, the sales curve can be approximated by a quadratic polynomial. Find the least squares quadratic fit to the sales curve, and use it to project the sale for the twelfth month of the year.

Solution:
The graph of the sales of the first 5 months:

Let's write the above information as points.
We know the sales is about the the first 5 months from month 1, 2,3, 4 and 5 and then we have the sales figures of \$4.0, \$4.4, \$5.2, \$6.4 and \$8.0. Writing them in (x,y) point form we have:
(1, 4), (2, 4.4), (3, 5.2), (4, 6.4) and (5, 8).

clearly we see that it is a parabola which is a polynomial in the form `y=a_0+a_1x+a_2x^2` and we want to find the `a_0, a_1 and a_2`.
our equation for finding `a_0, a_1 and a_2` is v*`=(M^TM)^-1M^Ty` so we are going to setup the matrix M and y
`M=[[1,x_1,x_1^2],[1,x_2,x_2^2],[1,x_3,x_3^2],[1,x_4,x_4^2],[1,x_5,x_5^2]]`

we can use the x values for x1, x2, x3, x4 and x5 and square them for the `x_1^2, x_2^2, x_3^2,x_4^2 and x_5^2` as follow:
`M=[[1,1,1],[1,2,4],[1,3,9],[1,4,16],[1,5,25]]`

set up the y matrix with all y values from the points (1, 4), (2, 4.4), (3, 5.2), (4, 6.4) and (5, 8).
`y=[[4],[4.4],[5.2],[6.4],[8]]`

Using our y and M we can solve the v*`=(M^TM)^-1M^Ty` as follow:

First the M transpose `M^T=[[1,1,1,1,1],[1,2,3,4,5],[1,4,9,16,25]]` and multiply it by M
`M^TM=[[1,1,1,1,1],[1,2,3,4,5],[1,4,9,16,25]]*[[1,1,1],[1,2,4],[1,3,9],[1,4,16],[1,5,25]]=[[5,15,55],[15,55,225],[55,225,979]]`

To then inverse of `[[5,15,55],[15,55,225],[55,225,979]]^-1=[[23/5, -33/10, 1/2],[-33/10, 187/70, -3/7],[1/2,-3/7,1/14]]`

Now got the inverse, the last part is to multiply it by `M^Ty` which we write :
We already have `M^T` to be `M^T=[[1,1,1,1,1],[1,2,3,4,5],[1,4,9,16,25]]`
*`=(M^TM)^-1M^Ty=[[23/5, -33/10, 1/2],[-33/10, 187/70, -3/7],[1/2,-3/7,1/14]] * [[1,1,1,1,1],[1,2,3,4,5],[1,4,9,16,25]] * [[1,1,1],[1,2,4],[1,3,9],[1,4,16],[1,5,25]]*[[4],[4.4],[5.2],[6.4],[8]]=`

using MATLAB we can solve this:
Code: Select all
`>> M=[1 1 1; 1 2 4; 1 3 9; 1 4 16; 1 5 25]M =     1     1     1     1     2     4     1     3     9     1     4    16     1     5    25y=[4, 4.4, 5.2, 6.4, 8]>> rats( inv( transpose(M)*M ) * transpose(M) * y)ans =       4           -1/5           1/5 `

so we got a vectot `[[a_0],[ a_1],[ a_2]]=[[4],[ -1/5],[ 1/5]]`
`:. a_0 = 4, a_1=-1/5 and a_2=1/5` and our polynomial equation is `y=4 -1/5x + 1/5x^2`

Now if for the purpose of test, graph the 12 month sales
Explore and know. That is asked.

barnamah

Posts: 102
Joined: Mon 14 March, 2011 08:37