# How to find relationship between 2 variables?

#### Sparsh

##### New member
I have 2 variables 'i' and 'z'. The value of z depends on the value of i as:

If i=6, z=7
If i=7, z=5
If i=8, z=3
If i=9, z=1

How to find an equation involving i and z that satisfies all the values above for i and z?

#### MarkFL

##### Super Moderator
Staff member
It appears that every time $$i$$ increases by 1, $$z$$ decreases by 2, so a linear relationship would work. Can you state the slope of such a line?

• Otis

So z = -2i +??

#### HallsofIvy

##### Elite Member
Given any "n" values, there exist a unique polynomial of degree n-1 or less that gives those values. Here you are given 4 values so there exist a unique polynomial of degree 3 or less such, which we can write as $$\displaystyle z= ai^3+ bi^2+ ci+ d$$. The four given values give four equations to solve for a, b, c, and d:
216a+ 36b+ 6c+ d= 7
343a+ 49b+ 7c+ d= 5
512a+ 64b+ 8c+ d= 3
729a+ 81b+ 9a+ d= 1

Of course, here that's overkill. Solving those equations we quickly find that a and b are 0.