# How to solve equations with two unknown computationally? [closed]

I have an equation in the form: z= ax+by. Is it possible to solve z using some computational trick? Like using many combinations of x and y? What would be the approach for this kind of problem? Thank you

• Without more context, there is an infinity of different solution pairs $(x,y)$. You cannot solve this (without further context) not because maths has failed, but because the question does not really make sense. $z=ax+by$ sketches a line; which point on the line is the right solution? This also has nothing to do with functional analysis or O.D.Es... please use tags judiciously! Dec 21, 2021 at 19:14
• Are you looking for solutions in the real numbers, or some other ring? Dec 21, 2021 at 19:22
• I got a and b, I need x and y (but I guess I could reverse the names and be in the same situation as given by @Boateng). The variables are positive integers, z should be a single number (which suggests a kind of min|max for this function). For the rest, there is not much more contextualization. The authors only give the formula like it was a simple f(x). Dec 21, 2021 at 20:55
• If you know $a$, $b$, and $c$, then $ax+by=c$ is the equation of a line. Every point on the line has a different pair of coordinates $(x,y)$ that satisfies the equation. You can pick any value you want for one of $x,y$ and solve the equation to get the value of the other one. (This assumes $a$ and $b$ are both nonzero. If one of them is $0$ then the equation effectively has only one variable.)
– Karl
Dec 21, 2021 at 21:49
• but I don't know c either... Dec 22, 2021 at 16:16

If you wish to determine the coefficients a and b, you would at least need two linear independent set of equations. Say $$\begin{array}{{rC}l} ax_1 & +by_1= & z_1 \\ ax_2 & + by_2 = & z_2 \\ \end{array}$$
which is equivalent to solving the following linear system $$\begin{pmatrix} x_1 & y_1 \\ x_2 & y_2 \\ \end{pmatrix} \begin{pmatrix} a\\ b \end{pmatrix} = \begin{pmatrix} z_1 \\ z_2 \end{pmatrix}$$