Let's use the variable x to represent the number of small carts and y to represent the number of big carts.
Since the total number of carts is 15, we have the equation:
[tex]x+y=15[/tex]And if the total number of people that can ride at one time is 40, we have the equation:
[tex]2x+4y=40[/tex]From the first equation, let's isolate y and use its value in the second equation:
[tex]\begin{gathered} x+y=15 \\ y=15-x \\ \\ 2x+4y=40 \\ 2x+4(15-x)=40 \\ 2x+60-4x=40 \\ -2x=40-60 \\ -2x=-20 \\ x=10 \\ \\ y=15-x \\ y=15-10 \\ y=5 \end{gathered}[/tex]Therefore there are 10 small carts and 5 big carts.