I had this on a test, not sure how to do it

Explain, using balanced chemical reactions with the smallest integer coefficients, why each of following occurs.
a. CuI2 (insoluble in pure water) dissolves readily in aqueous ammonia, HN3(aq)
b. AgBr (insoluble in pure water) dissolves readily in NaCN.

First, I need to correct your formula for ammonia. It is NH3.

The CuI2 dissolves in NH3, easily, because it forms the Cu(NH3)4^+2 complex ion. The AgBr dissolves in NaCN, easily, because of the formation of the Ag(CN)2^- complex ion. [AgBr will dissolve in NH3, too, with the formation of Ag(NH3)2^+1]

CuI2 + 4NH3 ==> Cu(NH3)4^+2 + 2I^-
AgBr + 2NaCN ==> Ag(CN)2^- + 2Na+ + Br^-

To explain why each of these occurs, we need to understand the concept of solubility and the principles behind chemical reactions.

a. CuI2 (insoluble in pure water) dissolves readily in aqueous ammonia, HN3(aq):
In order to understand why CuI2 dissolves in aqueous ammonia, we need to examine the chemical reactions involved.

The chemical equation for the reaction between CuI2 and HN3 can be represented as follows:

CuI2 (s) + 4HN3 (aq) → [Cu(NH3)4]I2 (aq)

This balanced equation shows the reaction between CuI2 (copper(II) iodide) and HN3 (aqueous ammonia) to form a complex ion, [Cu(NH3)4]2+ (tetraamminecopper(II)) and I2 (iodine).

The reason CuI2 dissolves readily in aqueous ammonia is due to the formation of this complex ion. The ammonia molecules coordinate with the copper ions, breaking the Cu-I bonds in CuI2, resulting in the formation of [Cu(NH3)4]2+ complex ions. These complex ions are soluble in water, hence allowing CuI2 to dissolve in the presence of aqueous ammonia.

b. AgBr (insoluble in pure water) dissolves readily in NaCN:
In order to explain why AgBr dissolves in NaCN, we need to examine the chemical reactions involved.

The chemical equation for the reaction between AgBr and NaCN can be represented as follows:

AgBr (s) + 2NaCN (aq) → Na[Ag(CN)2] (aq) + NaBr (aq)

This balanced equation shows the reaction between AgBr (silver bromide) and NaCN (sodium cyanide) to form sodium silver cyanide, Na[Ag(CN)2], and sodium bromide, NaBr.

The reason AgBr dissolves readily in NaCN is due to the complexation of silver ions (Ag+) with cyanide ions (CN-). The cyanide ions coordinate with the silver ions, breaking the Ag-Br bonds in AgBr, and forming the soluble complex ion, Na[Ag(CN)2]. This complex ion, along with the resulting sodium bromide, NaBr, is then dissolved in the aqueous solution.

It's important to note that the solubility of a compound in a particular solution depends on the formation of soluble species or complexes. In both cases, the formation of complex ions plays a key role in the dissolution of the insoluble compounds in the respective solutions.