Motivation behind formula for solution in Chinese Remainder Theorem I'm reading through a proof of the Chinese Remainder theorem and I am confused on why they decided to:
1) Set $u = n(n^{-1} \pmod m)$
2) Set $v = m(m^{-1} \pmod n)$
3) Set $x = au + bv$, as in how do we know the equality is true?
$ $

 A: This may be more advanced than you want, but it's a common enough proof strategy that you'll eventually want to know it.  In particular, in the context given here, the proof of the CRT is somewhat obvious.

It's a common trick in mathematics that if we want to solve a finite number of linear functions $$F_1(x) = y_1, F_2(x) = y_2, \ldots, F_N(x) = y_N$$ simultaneously, we should first look for elements $u_1, u_2, \ldots, u_n$ such that $F_i(u_j) = \begin{cases} 1, & i=j \\ 0, & i\neq j\end{cases}.$  Then the answer is given by $$x = u_1y_1 + u_2y_2 + \ldots + u_Ny_N$$
(in addition to the CRT, this is also the principle used in defining the Lagrange interpolation polynomial, among many others)

In the context of the CRT, we have two linear functions $F_1(x) = x\pmod{m}$ and $F_2(x) = x\pmod{n},$ and we want to solve $F_1(x) = a, F_2(x) = b$ simultaneously.  Therefore, we are interested in finding two elements $u, v$ such that $$F_1(u) = 1 \iff u \equiv 1 \pmod{m} \\ F_2(u) = 0 \iff u \equiv 0 \pmod{n} \\ F_1(v) = 0 \iff v \equiv 0 \pmod{m} \\ F_2(v) = 1 \iff v\equiv 1 \pmod{n}$$
If you think about what the two congruences for, e.g. $u$, mean, then you'll know that we want a multiple of $n$ which is equal to $1 \pmod{m}$.  Since $n$ has an inverse mod $m,$ we multiply $u = n \cdot (n^{-1} \pmod{m})$
The general method above (since $F_1, F_2$ are linear) now gives an answer for $x$ as $$x = au + bv$$
A: For $u$, it's set to $n$ times the value of $n^{-1} \pmod m$ (here $n^{-1}$ means the multiplicative inverse of $n$ modulo $m$, i.e., the modulus value such that $n \times n^{-1} \equiv 1 \pmod m$, and since $\gcd(m,n) = 1$, this value always exists). Thus, you have $u \equiv 0 \pmod n$ as it's a multiple of $n$, while $u \equiv 1 \pmod m$ since $n(n^{-1}) \equiv 1 \pmod m$. It similarly sets up $v$ so $v \equiv 1 \pmod n$ and $v \equiv 0 \pmod m$. They did this so $u$ and $v$ would have the appropriate properties to give a solution, in particular, with $u$ having $(0,1)$, and $v$ having $(1,0)$, as the values modulo $n$ and $m$ is roughly analogous to the $\vec i$ and $\vec j$ basis vectors in $2$-dimensional Cartesian coordinate systems. Then linearity is used, as described in detail in Brian Moehring's and Bill Dubuque's answers.
As for how to know that $x = au + bv$ solves $x \equiv a \pmod m$ and $x \equiv b \pmod n$, as they show, when you check modulo $m$ and $n$, you get the required results of $a$ and $b$, respectively. For example, with mod $m$, since $v \equiv 0 \pmod m$, then $bv \equiv 0 \pmod m$. Also, as $u \equiv 1 \pmod m$, then $au \equiv a \pmod m$. Summing the $2$, you get that $x = au + bv \equiv 0 + a \equiv a \pmod m$. It then likewise shows checking mod $n$ to confirm $x \equiv b \pmod n$.
A: To grok this it helps to highlight $\rm\color{darkorange}{linearity}$ at the heart of the Chinese Remainder Theorem [CRT] formula. Let's consider an example for three moduli $\,3,5,7,\,$ where the CRT formula is
$$\begin{eqnarray}
x\, =\ &a&\!\color{#0a0}{\overbrace{(-5\cdot 7)}^{\large \equiv\, 1\ ({\rm mod}\ \color{#c00}3)}} \,+\,  &b& \overbrace{(\color{#c00}3\cdot 7)}^{\large \equiv\, 1\ ({\rm mod}\ 5)}\, +\, &c&\overbrace{(\color{#c00}3\cdot 5)}^{\large \equiv\, 1\ ({\rm mod}\ 7)}\quad {\bf [CRT]}\\[.5em]
\Rightarrow\ \ x\,\equiv\  &a&\ ({\rm mod}\ \color{#c00}3),\ \ x\equiv &b&\ ({\rm mod}\ 4),\ \ x\equiv &c&\ ({\rm mod}\ 5)\\
\end{eqnarray}\qquad$$
since, e.g. reduced $ $ mod $\ \color{#c00}3,\,$ the $\rm 2nd$ and $\rm 3rd$ summands are $\equiv 0,\,$ both having factors of $\,\color{#c00}3.\,$
The key idea is that the braced terms are $\equiv 1$ mod one modulus, and $\equiv 0 $ mod all others. More clearly, if we write the system in vector form $\ x\equiv (a,b,c)\,$ mod $\,(3,5,7)$ then [CRT] becomes
$\qquad x\, :=\, a\,\color{#0a0}{(1,0,0)} + b\,(0,1,0) + c\,(0,0,1)\equiv (a,b,c)\ $ as desired. $\quad\ \ [\rm\color{darkorange}{Linearity}]$
by the green term $\,\color{#0a0}{g \equiv 1}\ ({\rm mod}\ 3),\ \color{#0a0}{g\equiv 0}\ ({\rm mod}\ 5),\  \color{#0a0}{g\equiv 0}\ ({\rm mod}\ 7),\ $ i.e. $\ \color{#0a0}{g\equiv (1,0,0)}\ {\rm mod}\ (3,5,7),\, $ and similarly for $\,(0,1,0)\,$ and $\,(0,0,1).$
Thus once we compute the solutions for the "basis" vectors $(1,0,0),\ (0,1,0),\ (0,0,1)$ we can exploit $\rm\color{darkorange}{[Linearity]}$ to generate the general solution as a linear combination of these basic solutions.
Solving the base cases is easy: $\,{\color{#0a0}{5,7\mid g}\,\Rightarrow\, 35\mid g},\, $ so $\bmod 3\!:\ \color{#0a0}{1\equiv g} \equiv 35n\equiv -n\,\Rightarrow\, n\equiv -1,\,$ i.e. $\,n\,$ is the inverse of the product $36= 5\cdot 7$ of all other moduli. Hence the common CRT formula.
In your Thm we have $\!\bmod (m,n)\!:\,\  u \equiv (0,1),\ v \equiv (1,0)\ $ thus
$$ x := au+bv = a(1,0)+b(0,1) \equiv  (a,b) $$
The innate algebraic structure will be clarified if you later study abstract algebra, where you will learn  the ring theoretic view of CRT, and vector spaces and modules.
