Take x as the number of middle school students. According to the statement, the ratio of elementary students to middle school students is 2:1, which means that for every x middle school students there are 2x elementary students.
The sum of elementary and middle school students is 27. Which means that the sum of x and 2x is 27:
![\begin{gathered} 2x+x=27 \\ 3x=27 \\ x=(27)/(3) \\ x=9 \end{gathered}](https://img.qammunity.org/2023/formulas/mathematics/college/3shbntkmmkanjtqbo4ok6wouillxw68pwe.png)
The number of elementary school students is 2x:
![2x=2(9)=18](https://img.qammunity.org/2023/formulas/mathematics/college/ndqoea002z6rob4au0s8np0v00pc8rqbv9.png)
There are 18 elementary students on the bus 5.