1. Formula & Example-1
Formula
Straight line equation is `y = a + bx`.
The normal equations are
`sum y = an + b sum x`
`sum xy = a sum x + b sum x^2`
|
Examples
1. Calculate Fitting straight line - Curve fitting using Least square method
Solution: Method-1 of solution : Straight line equation is `y = a + bx`.
The normal equations are `sum y = an + b sum x`
`sum xy = a sum x + b sum x^2`
The values are calculated using the following table
`x` | `y` | `x^2` | `x*y` | 5 | 1 | 25 | 5 | 4 | 2 | 16 | 8 | 3 | 3 | 9 | 9 | 2 | 4 | 4 | 8 | 1 | 5 | 1 | 5 | --- | --- | --- | --- | `sum x=15` | `sum y=15` | `sum x^2=55` | `sum x*y=35` |
Substituting these values in the normal equations `5a+15b=15`
`15a+55b=35`
Solving these two equations using Elimination method, `5a+15b=15`
`5(a+3b)=5 * 3`
`a+3b=3`
and `15a+55b=35`
`5(3a+11b)=5 * 7`
`3a+11b=7`
`a+3b=3 ->(1)`
`3a+11b=7 ->(2)`
equation`(1) xx 3 =>3a+9b=9`
equation`(2) xx 1 =>3a+11b=7`
Substracting `=>-2b=2`
`=>2b=-2`
`=>b=-2/2`
`=>b=-1/1`
`=>b=-1`
Putting `b=-1` in equation `(1)`, we have
`a+3(-1)=3`
`=>a=3+3`
`=>a=6`
`:.a=6" and "b=-1`
Now substituting this values in the equation is `y = a + bx`, we get
`y = 6 -x`
Method-2 of solution :Equation of straight line is `y=mx+b`, where Slope is m and Intercept is b `m=(n sum xy - sum x sum y) / (n sum(x^2) - (sum x)^2)` `b=(sum y - m sum x)/n` The values are calculated using the following table `x` | `y` | `x^2` | `x*y` | 5 | 1 | 25 | 5 | 4 | 2 | 16 | 8 | 3 | 3 | 9 | 9 | 2 | 4 | 4 | 8 | 1 | 5 | 1 | 5 | --- | --- | --- | --- | `sum x=15` | `sum y=15` | `sum x^2=55` | `sum x*y=35` |
Find the value of Slope `m` `m=(n sum xy - sum x sum y) / (n sum(x^2) - (sum x)^2)` `:.m=(5 * 35 - 15*15) / (5* 55 - (15)^2)` `:.m=(175 - 225) / (275 - 225)` `:.m=(-50) / (50)` `:.m=-1` Find the value of Intercept `b` `b=(sum y - m sum x)/n` `:.b=(15 - (-1) * 15)/5` `:.b=(15 +15)/5` `:.b=(30)/5` `:.b=6` So the required equation is `y=mx+b` `y=-1x+6`
The (x,y) points and line `y = 6 -x` on a graph
This material is intended as a summary. Use your textbook for detail explanation. Any bug, improvement, feedback then
|