Explanation:
Let's say the first number in question is x and the second number is y.
[tex]\begin{gathered} 3x=8+2y \\ x+y=40 \end{gathered}[/tex][tex]\begin{gathered} x+y=40 \\ y=40-x\text{ or }x=40-y \end{gathered}[/tex]After isolating one value, replace it in the other equation.
[tex]\begin{gathered} 3x=8+2(40-x) \\ 3x=8+80-2x \\ 5x=88 \\ x=\frac{88}{5} \end{gathered}[/tex]Now do the same for the other value;
[tex]\begin{gathered} 3(40-y)=8+2y \\ 120-3y=8+2y \\ 112=5y \\ y=\frac{112}{5} \end{gathered}[/tex]To make sure you have the right answers, double-check by replacing both values in one of the equations and check to see if the equality is true:
[tex]\begin{gathered} \frac{88}{5}+\frac{112}{5}=40? \\ \frac{200}{5}=40\text{ : true} \end{gathered}[/tex]Since it is true, your 2 numbers are 88/5 and 112/5.