Pattern matching puzzles Problems: I wish to have an equation for below data: 
$x = 2, y = 5$ 
$x = 2, y = 6 $
$x = 2, y = 7 $
$x = 2, y = 8 $
$x = 1, y = 9$ 
$x = 0, y = 10$ 
And Will you show me the steps to acquire that equation?
 A: $$\qquad x=\min\{10-y,2\}\qquad$$
A: The general mindless procedure of finding a function that goes over a set of points $(x_0, y_0), \dots, (x_n, y_n)$ is to solve the set of equations
$$y_0 = a_n x_0^n + \dots + a_1 x_0 + a_0\\ \dots \\ y_n = a_n x_n^n + \dots + a_1 x_n + a_0$$
These are $n$ linear equations with unknowns $a_0, \dots, a_n$. In your case, remember to swap $x$ and $y$.
A: First sqap the values for $x$ and $y$. Then apply the Lagrange interpolation. The first 4 points lie on the the line $y=2$ Then do the Lagrange interpolation explained here:
After the application, the first 5 points then lie on the function
$$y = 2 - \frac{(x - 5) (x - 6) (x - 7) (x - 8)}{24}$$
Do this method again and the final function should be:
$$y = 2 - \frac{(x - 5) (x - 6) (x - 7) (x - 8)}{24} + \frac{(x - 5) (x - 6) (x - 7) (x - 8) (x - 9)}{40}$$
To get the function for your initial question, just swap $x$ and $y$. So the final function is: 
$$x = 2 - \frac{(y - 5) (y - 6) (y - 7) (y - 8)}{24} + \frac{(y - 5) (y - 6) (y - 7) (y - 8) (y - 9)}{40}$$
Or in expanded form:
$$x = -446+\frac{4894}{15} y - \frac{1123}{12}y^2+\frac{317}{24}y^3-\frac{11}{12}y^4 +\frac{1}{40}y^5$$

A: $$x=0^{|9-y|}+2\cdot0^{\prod_{k=5}^8|k-y|}$$
