Help me out please I don’t understand what I’m doing

Since we have the value for selling each shirt, the earnings that came from the hats sold and the total earnings we can complete equation using a linear equation in which the cost of each shirt will represent the slope and the y-intercept will be the earnings that came from the hats, like this:
[tex]5x+40=125[/tex]then clear the equation for x in order to find how many shirts were sold
[tex]\begin{gathered} 5x=125-40 \\ 5x=85 \\ x=17 \end{gathered}[/tex]