How to find relationship between 2 variables? I have $2$ variables $i$ and $z$. The value of $z$ depends on the value of $i$ as:
$$i=6 \implies z=7
\\
i=7 \implies z=5
\\
i=8\implies z=3
\\
i=9\implies z=1
$$
How to find an equation involving $i$ and $z$ that satisfies all the values above for $i$ and $z$?
 A: Notice that as $i$ increases by $1$, $z$ decreases by $2$.  Therefore there is a linear relationship that can be represented as $z=-2i+b$ for some currently unknown $b$.  But since you know that you have points to replace $z$ and $i$ with, you can solve for the unknown $b$ as
$$z=-2i+b$$
$$7=-2(6)+b$$
$$7=-12+b$$
$$7+12=b$$
$$19=b$$
And therefore you have that $z=-2i+19$.  Does it work for the remaining points?  You can check to see it does.  
Now is the the ONLY function with this property? Certainly not, but this is most likely the simplest one, and since we deduced the relation contains linear changes, then we have found an equation where the givens are satisfied.
A: The easiest way is finding an interpolating function. In this case you have four constraints so it maybe would make sense to use an ansatz that has four degrees of freedom. A generic choice would be a polynomial of degree $3$:
$$z(i) = ai^3 + bi^2 + ci + d$$
Pluging the known points in here will result in a linear system of equations:
$$\begin{bmatrix}6^3 & 7^3 & 8^3 & 9^3 \\6^2 & 7^2 & 8^2 & 9^2 \\6 & 7 & 8 & 9 \\1 & 1 & 1 & 1 \\\end{bmatrix}^t\begin{bmatrix}a \\ b \\ c \\ d\end{bmatrix}=\begin{bmatrix}7 \\ 5 \\ 3 \\ 1\end{bmatrix}$$ This results in the solution $(a,b,c,d) = (0,0,-2,19)$, so you get 
$$z(i) = -2i + 19$$
You can also get many more solutions by adding any function that is zero on the values $i=6,7,8,9$.
