We initially have two compounds dissolved in water that react to form a compound that does not dissolve in water and forms a precipitate, Co2S3. The equation that they show us we must balance it. For them let's first count the number of atoms of each element that we have on each side of the reaction.
To make it clearer I will make the following table that I will modify as I explain it to you, please do not lose sight of it.
We see that several elements are not balanced. Let's start by balancing the Co. We have two Co atoms on the product side and one on the reactants.
To balance it we place the coefficient two in front of the Co(NO3)3 molecule. And we count the atoms again.
Now let's continue with oxygen, we have 18 oxygen atoms in the reactants. In the products we have 3, to obtain 18 oxygens we must add 6 molecules of NH4NO3. We will have then (Look at the figure).
We can continue to balance the sulfur (S), we have three molecules on the product side and one on the reactant side. So we'll put in 3 molecules of (NH4)2S to balance the sulfur.
By counting the atoms of each element we see that now the numbers coincide on both sides of the reaction, the equation is balanced. Therefore, we will have that the chemical equation of the reaction will be: