4. A vintage tram departs a stop with a certain number of boys and girls on board. At the first stop, a third of the girls get out and their places are taken by boys. At the next stop, a third of the boys get out and their places are taken by girls. There are now two more girls than boys and as many boys as there originally were girls.
How many boys and girls were there on board at the start?
4 Let b_i and g_i be the numbers of boys and girls on board the tram, respectively, at stop i. Note that b_0 and g_0 are the numbers of boys and girls on board the tram, respectively, at the start of the trip.
At stop 1, b_1=b_0 + g_0/3, g_1=2g_0/3.
Similarly, at stop 2, b_2 $=2$ b_1/3, g_2 = g_1+b_1/3.
Using above formulas for $b \_1, g \_1$ leads to $b \_2=2 b \_0 / 3+2 g \_0 / 9$, $\mathrm{g} \_2=7 g \_0 / 9+b \_0 / 3$. From b_2 = g_0 this yields b_0 $=7 g \_0 / 6$.
As b_2+2 = g_2, we have g_0 = 1/5(3b_0+18).
We can now solve for $g \_0$ to get $g \_0=12$ and then $b \_0=14$.