# Solving linear system of equations when one variable cancels

I have the following linear system of equations with two unknown variables $x$ and $y$. There are two equations and two unknowns. However, when the second equation is solved for $y$ and substituted into the first equation, the $x$ cancels. Is there a way of re-writing this system or re-writing the problem so that I can solve for $x$ and $y$ using linear algebra or another type of numerical method?

$2.6513 = \frac{3}{2}y + \frac{x}{2}$

$1.7675 = y + \frac{x}{3}$

In the two equations above, $x=3$ and $y=0.7675$, but I want to solve for $x$ and $y$, given the system above.

If I subtract the second equation from the first, then:

$2.6513 - 1.7675 = \frac{3}{2}y - y + \frac{x}{2} - \frac{x}{3}$

Can the equation in this alternate form be useful in solving for $x$ and $y$? Is there another procedure that I can use?

In this alternate form, would it be possible to limit $x$ and $y$ in some way so that a solution for $x$ and $y$ can be found by numerical optimization?

-
"Is there another procedure that I can use?" - look up Cramer's rule. – J. M. Aug 8 '12 at 15:14
@J.M.: Okay, thank you for pointing me in that direction. – Nicholas Kinar Aug 8 '12 at 15:23
Tip: before substracting, multiply the second equation by $2/3$, so that the $y$ term disappears and you can solve for $x$ – leonbloy Aug 8 '12 at 15:31
@leonbloy: Thanks, leonbloy; I will try to transform the system by multiplication. – Nicholas Kinar Aug 8 '12 at 16:11

$$\begin{equation*} \left\{ \begin{array}{c} 2.6513=\frac{3}{2}y+\frac{x}{2} \\ 1.7675=y+\frac{x}{3} \end{array} \right. \end{equation*}$$

If we multiply the first equation by $2$ and the second by $3$ we get $$\begin{equation*} \left\{ \begin{array}{c} 5.3026=3y+x \\ 5.3025=3y+x \end{array} \right. \end{equation*}$$

This system has no solution because $$\begin{equation*} 5.3026\neq 5.3025 \end{equation*}$$

However if the number $2.6513$ resulted from rounding $2.65125$, then the same computation yields $$\begin{equation*} \left\{ \begin{array}{c} 5.3025=3y+x \\ 5.3025=3y+x \end{array} \right. \end{equation*}$$ which is satisfied by all $x,y$.

A system of the form

$$\begin{equation*} \begin{pmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \end{pmatrix} \begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix} b_{1} \\ b_{2} \end{pmatrix} \end{equation*}$$

has the solution (Cramer's rule) $$\begin{equation*} \begin{pmatrix} x \\ y \end{pmatrix} =\frac{1}{\det \begin{pmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \end{pmatrix} } \begin{pmatrix} a_{22}b_{1}-a_{12}b_{2} \\ a_{11}b_{2}-a_{21}b_{1} \end{pmatrix} = \begin{pmatrix} \frac{a_{22}b_{1}-a_{12}b_{2}}{a_{11}a_{22}-a_{21}a_{12}} \\ \frac{a_{11}b_{2}-a_{21}b_{1}}{a_{11}a_{22}-a_{21}a_{12}} \end{pmatrix} \end{equation*}$$

if $\det \begin{pmatrix} a_{11} & a_{12} \\ a_{21} & a_{22}% \end{pmatrix}% \neq 0$.

In the present case, we have $$\begin{equation*} \begin{pmatrix} \frac{1}{2} & \frac{3}{2} \\ \frac{1}{3} & 1 \end{pmatrix} \begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix} 2.6513 \\ 1.7675 \end{pmatrix} \end{equation*}$$

and $$\det \begin{pmatrix} \frac{1}{2} & \frac{3}{2} \\ \frac{1}{3} & 1 \end{pmatrix} =0$$

-
Excellent answer, Américo. A big "thank you" to both you and the rest of the people on math.stackexchange for helping me think so clearly. – Nicholas Kinar Aug 8 '12 at 18:34
@NicholasKinar You are welcome! – Américo Tavares Aug 8 '12 at 18:35

It appears that the system of equations is linearly dependent, since $\det(A) = 0$ using Cramer's rule and one equation can be transformed into the other by multiplication. Since both equations are the same line, there is no intersection.

Perhaps there is a way to limit $x$ and $y$ so that some sort of optimization procedure could be used to determine $x$ and $y$.

-