The unbalanced equation is
#("NH"_4)_3"PO"_4 +"Pb"("NO"_3)_4 → "Pb"_3("PO"_4)_4 + "NH"_4"NO"_3#
One way to balance the equation is to recognize that the polyatomic ions stay together.
Then we can make some substitutions.
Let #"A" = "NH"_4#; #"X" = "PO"_4#; #"Y" = "NO"_3#.
Then the equation becomes
#"A"_3"X" + "PbY"_4 → "Pb"_3"X"_4 + "AY"#
We start with the most complicated formula, #"Pb"_3"X"_4#, and put a 1 in front of it.
#"A"_3"X" + "PbY"_4 → color(red)(1)"Pb"_3"X"_4 + "AYX"#
Balance #"Pb"#
We have fixed 3 atoms of #"Pb"# on the right, so we need 3 atoms of #"Pb"# on the left. Put a 3 in front of #"PbY"_4#.
#"A"_3"X" + color(blue)(3)"PbY"_4 → color(red)(1)"Pb"_3"X"_4 + "AY"#
Balance #"X"#
We have fixed 4 atoms of #"X"# on the right, so we need 4 atoms of #"X"# on the left. Put a 4 in front of #"A"_3"X"#.
Balance #"A"#
We have fixed 12 atoms of #"A"# on the left, so we need 12 atoms of #"A"# on the right.
#color(orange)(4)"A"_3"X" + color(blue)(3)"PbY"_4 → color(red)(1)"Pb"_3"X"_4 + color(teal)(12)"AY"#
Every formula has a coefficient, and the equation is balanced.
Now, we replace the original formulas in the equation.
The balanced equation is
#4("NH"_4)_3"PO"_4 +"3Pb"("NO"_3)_4 → "Pb"_3("PO"_4)_4 + "12NH"_4"NO"_3#