Mathematically, the problem you describe is to find an unknown function
y_i= f(x_i) (i=1,...n)
for a given set of input values
x_2, ... and corresponding output values
To answer such questions, you will typically have to make some assumptions about your function
f. For example, if you assume
f is a linear function of the form
f(x) = a * x + b
(which is true for all 3 examples you gave above), then you can find f by using two input values, solve the related linear equation system of degree 2 for a and b (and test if the other input values match the other output).
If you assume
f is a polynomial of a certain degree, that means,
f(x) = a_n * x^n + a_(n-1) * x^(n-1) + ... + a_1 * x + a_0
you need to apply the the theory of polynomial interpolation. A polynomial is what you get when you allow arbitrary summation, subtraction, and multiplication, but no division. This problem is well known and if you choose a high-enough degree n, you can always construct a polynomial
f matching all of your input and output values.
One can extend this problem to allow division, which leads to rational function modeling. If you want to know more about that, google for "rational interpolation".