How to solve the system of equations like this one?

72 Views Asked by At

I have a hidden linear function: $f(x)=a*x+b$. For example $f(x)=2*x+3$

A hidden function $f$ was executed on some hidden input $x$=(0,1,3,4) and we have access only to output $y=(f(0)=3, f(1)=5, ...)=(3,5,9,13)$

How to find: $(a, b, \vec{x})$? In this case the correct answer is $(a=2, b=3, x=(0,1,3,4))$

There is possibility to construct the system of equations but I do not know how to solve them. $$\begin{cases} a*x_1+b=3,\\ a*x_2+b=5,\\ a*x_3+b=9,\\ a*x_4+b=13.\\ \end{cases}$$ The number of unknowns is greater than knowns, but we are limited to linear hidden functions only. Should I rewrite as matrix multiplication and use some sort of decomposition? Should I use Linear programming?

Note: there exists trivial solution $(a=1, b=0, x=y)$ I am interested in non trivial solutions and general approach for any $(a,b,x)$

Edit1: what are the possible restrictions to get unique solution? For example: $(a,b,x)$ natural numbers, maximize $(a, b)$ and minimise $(x)$,...

2

There are 2 best solutions below

2
On BEST ANSWER

There are infinitely many solutions. If $a \ne 0$, then we can always fix $(a,b)$ and then solve for $x_i$.

Assuming you are looking for non-negative integer solutions.

If $a=1$, then we can set $b \in \{1,2,3\}$ and then decide for $x_i$.

Now assume $a>1$,

$$a(x_2-x_1)=2$$

$$a(x_3-x_1)=6$$

$a$ is a common divisor of $2$ and $6$. $a=2$ and we can either pick $b$ to be $1$ or $3$ and then solve for corresponding $x_i$.

Possible restriction: Let $b$ to be as large as possible and all variables are nonnegative.

3
On

The question, as originally posted, is unsolvable uniquely. You can imagine that easily, this way: Suppose we try plotting $f(x)$ on the Cartesian plane. We have access to $4$ outputs, so we draw the lines: $$y=3$$ $$y=5$$ $$y=9$$ $$y=13$$ We know that our function must intersect all $4$ lines. Now you can see the problem very clearly. Any line with a non-zero slope will certainly intersect all $4$ lines. So this much information is not enough to solve the question. Even if we were given the value of a, that is, the slope of the line, still we could create infinite parallel lines which would satisfy the given conditions. So it would still be unsolvable.