x - the number of red jelly beans
y - the number of yellow jelly beans
The ratio of red jelly beans to yellow jelly beans is 3:4.
[tex]\frac{x}{y}=\frac{3}{4} \ \ \ |\times y \\
x=\frac{3}{4}y[/tex]
If Greg eats 3 red jelly beans and 6 yellow ones, the ratio is 4:5.
[tex]\frac{x-3}{y-6}=\frac{4}{5} \ \ \ |\hbox{cross multiply} \\
5(x-3)=4(y-6) \\
5x-15=4y-24 \ \ \ |+15 \\
5x=4y-9 \ \ \ |\div 5 \\
x=\frac{4}{5}y-\frac{9}{5}[/tex]
[tex] x=x \\
\frac{3}{4}y=\frac{4}{5}y-\frac{9}{5} \\
\frac{3}{4}y-\frac{4}{5}y=-\frac{9}{5} \\
\frac{15}{20}y-\frac{16}{20}y=-\frac{9}{5} \\
-\frac{1}{20}y=-\frac{9}{5} \ \ \ |\times (-20) \\
y=-\frac{9}{5} \times (-20) \\
y=9 \times 4 \\
y=36 [/tex]
There were 36 yellow jelly beans in the dish.