This is an example to illustrate the following theorem:
Let $a,b$ be integers and let $m,n$ be positive integers. The system \begin{eqnarray*} x&\equiv & a\pmod{m}\\ x&\equiv & b\pmod{n}\\ \end{eqnarray*} has solution if and only if $(m,n)\mid (a-b).$ In this case, the solution can be uniquely expressed modulo $[m,n]$
Determine the solutions to the following linear system of equations \begin{eqnarray*} x&\equiv & 5\pmod{6}\\ x&\equiv & 8\pmod{15}\\ \end{eqnarray*}
The system will have a solution if $(15,6)\mid (5-8)$, wich is true, since $3\mid-3$. I have found that the solution of this system is $x\equiv 23\pmod{30}$, Which they argue as follows:
Since there is a solution, we express $-3$ as a linear combination of $6$ and $15$: $5-8= -3 = (-3)\cdot 6 + 1\cdot 15$, thus $x=8+15=23$.
In this step I am stuck, Is there another way to get to that 23?, if someone could explain in detail what was done in this step I would be very grateful.