By spending an emerald, Noah turns a swan into a frog or a duck into a lizard, and by spending a ruby, he turns a swan into a duck or a frog into a lizard. Today he spent 20 emeralds and 23 rubies, and the number of frogs increased by 5. How and how much can the number of ducks change? (Give all possible results and explain why).
I found this in a Facebook group.
Let's name $S_0, F_0, D_0, L_0$ the initial number of each kind and $S_e, F_e, D_e, L_e$ their numbers after the exchange with the use of emeralds. Clearly we have, for 1 emerald, $S_0-S_n = F_n-F_0$, therefore for $x$ emeralds, $x(S_0-S_n) = x(F_n-F_0)$.
Also for $y$ emeralds, $y(D_0-D_n) = y(L_n-L_0)$.
We have $x+y=20$.
We get similar equations for the rubies: $z(S_0-S_m) = z(D_m-D_0)$.
$w(F_0-F_m) = w(L_m-L_0)$.
$z+w=23$.
The difference in number of frogs after all transformations is 5 but I don't know how to take into account the consecutive transformations; it is getting very complicated.
We define $r_1$ as the number of rubies used to transform swans to ducks and $r_2,e_1,e_2$ in a similar way according to the following diagram.
then the following holds, where $\Delta X$ is the change in the expression $X$ after all transformations are applied.
$$\begin{eqnarray} e=e_1+e_2\\ r=r_1+r_2 \end{eqnarray}$$
$$\begin{eqnarray} \Delta(D+L)=e\\ \Delta(F+L)=r \end{eqnarray}$$
$$\begin{eqnarray} \Delta(D+L)=\Delta D + \Delta L\\ \Delta(F+L)=\Delta F + \Delta L \end{eqnarray}$$
$$\begin{eqnarray} e=20\\ r=23 \end{eqnarray}$$
Additionally we know that $$ \Delta F= 5$$
From the above we get $$\begin{eqnarray} \Delta F + \Delta L&=&20\\ \Delta D + \Delta L&=&23\\ \Delta F&=&5 \end{eqnarray}$$ and therefore $$\begin{eqnarray} \Delta L&=& 15\\ \Delta D&=& 8 \\ \Delta F&=&5 \end{eqnarray}$$ So the number of Ducks changes by $8$.
We also see that the number of lizard increased by $15$ The number of animals did not change. So the number of swans decreases by $\Delta L+\Delta D+\Delta F=28$.