TITLE: Why can we use inspection for solving equation with multiple unknowns?
QUESTION [9 upvotes]: In our algebra class, our teacher often does the following: 
$a + b\sqrt{2} = 5 + 3\sqrt{2} \implies \;\text{(by inspection)}\; a=5, b = 3
$
I asked her why we can make this statement. She was unable to provide a satisfactory answer. So I tried proving it myself. 
$a + b\sqrt{2} = x + y\sqrt{2}$. We are required to prove that $a = x$, and $b = y$. Manipulating the equation, we get $\sqrt{2}(b - y) = x - a$, or $\sqrt{2} = \frac{x-a}{b-y}$. Expanding this, we get $\sqrt{2} = \frac{x}{b-y} + \frac{a}{b-y}$. I tried various other transformations, but nothing seemed to yield a result.

REPLY [3 votes]: We want to show that the only rational solutions $a,b,x,y$ of
$$a + b\sqrt{2} = x + y\sqrt{2}$$
are given by $a = x$ and $b = y$.
(Note that if you allow for real values of $a,b,x,y$, then for example $a = x + \sqrt{2}$, $b = y - 1$ would be a solution, too.)
If $y = b$, then obviously $a = x$.
Now assume $y \neq b$. Then
$$a + b\sqrt{2} = x + y\sqrt{2}\\ \implies a-x = (y-b)\sqrt{2}\\ \implies (a-x)^2 = 2(y-b)^2\\ \overset{y - b \neq 0}{\implies} 2 = \left(\frac{a-x}{y-b}\right)^{\!2}.$$
So $2$ is the square of a rational number. This contradicts the fact that $\sqrt{2}$ is irrational.

By the above argument, we have shown that the only rational solution of $a + b\sqrt{2} = 0$ is $a = b = 0$.
In terms of linear algebra, this property is formulated as "$1$ and $\sqrt{2}$ are $\mathbb Q$-linearly independent".
From this it follows that any representation $a + b\sqrt{2}$ with $a,b\in\mathbb Q$ uniquely determines $a$ and $b$.