Whats the relationship between x and y
(1,-1) (2,1) (3,3) I got y=2x-3
(1,2) (2,5) (3,10) I dont know how to do
many thanks
In the first example you were lucky in that differences were the same, that is
\(\displaystyle \frac{1-(-1)}{2-1}\, =\, \frac{3-1}{3-2}\, =\, 2\).
Since that is the case, you get a linear function as one relationship between x and y [there are others which will work].
In the second case, you are not so lucky. Fortunately there is a 'formula' you can use called the Lagrange Interpolating Polynominal, see
http://mathworld.wolfram.com/LagrangeInterpolatingPolynomial.html
for example. Take your case (1) for example. You would get
y = \(\displaystyle \frac{(x\, -\, 3)\, (x\, -\, 2)\, (-1)}{(1\, -\, 3)\, (1\, -\, 2)}\, +\, \frac{(x\, -\, 3)\, (x\, -\, 1)\, (1)}{(2\, -\, 3)\, (2\, -\, 1)}\, +\, \frac{(x\, -\, 1)\, (x\, -\, 2)\, (3)}{(3\, -\, 1)\, (3\, -\, 2)}\)
= \(\displaystyle \frac{-\, (x\, -\, 3)\, (x\, -\, 2)}{2}\, -\, \frac{2\, (x\, -\, 3)\, (x\, -\, 1)}{2}\, +\, \frac{3\, (x\, -\, 1)\, (x\, -\, 2)\, (3)}{2}\)
= \(\displaystyle \frac{1}{2}\, [-\, (x\, -\, 3)\, (x\, -\, 2)\, -\, 2\, (x\, -\, 3)\, (x\, -\, 1)\, +\, 3\, (x\, -\, 1)\, (x\, -\, 2)\, (3)]\)
= \(\displaystyle \frac{1}{2}\, [-\, x^2\, +\, 5x\, -\, 6\,\,\, -\, 2x^2\, +\, 8x\, -\, 6\,\,\, +\, 3x^2\, -\, 9x\, +\, 6]\)
= 2x - 3
Now do the same type of thing for (2)
EDIT: You can do the same sort of thing a different way. Again, we'll do your example (1): Start with the first point (1,-1)
y(x) = -1 + (x-1) g
1(x)
Add the second point (2,1)
y(2) = 1 = -1 + (2-1) g
1(2) = -1 + g
1(2)
So g
1(2) = 2 and
y(x) = -1 + (x-1) [ 2 + (x-2) g
2(x) ]
Add the third point (3,3)
y(3) = 3 = -1 + (3-1) [ 2 + (3-2) g
2(3) ] = -1 + 2 [ 2 + g
2(3) ] = 3 + 2 g
2(3)
So g
2(3) = 0 and
y(x) = -1 + (x-1) [ 2 + (x-2) [0 + (x-3) g
3(x)] ]
Which we can write as
y(x) = 2x - 3 + (x-1) (x-2) (x-3) g
3(x)
Since we have all three points, we can take g
3(x) as what ever we want. The 'obvious' value is g
3(x)=0.