Answer:
Reaction A:
- Hydrogen atoms in H₂ are oxidized.
 - Oxygen atoms in O₂ are reduced.
 - Hydrogen gas H₂ is the reducing agent.
 - Oxygen gas O₂ is the oxidizing agent.
 
Reaction B:
- Oxygen atoms in KNO₃ are oxidized.
 - Nitrogen atoms in KNO₃ are reduced.
 - Potassium nitrate (V) KNO₃ is both the oxidizing agent and the reducing agent.
 
Step-by-step explanation:
- When an atom is oxidized, its oxidation number increases.
 - When an atom is reduced, its oxidation number decreases.
 - The oxidizing agent contains atoms that are reduced.
 - The reducing agent contains atoms that are oxidized.
 
Here are some common rules for assigning oxidation states.
- Oxidation states on all atoms in a neutral compound shall add up to 0.
 - The average oxidation state on an atom is zero if the compound contains only atoms of that element. (E.g., the oxidation state on O in O₂ is zero.)
 - The oxidation state on oxygen atoms in compounds is typically -2. (Exceptions: oxygen bonded to fluorine, and peroxides.)
 - The oxidation state on group one metals (Li, Na, K) in compounds is typically +1. 
 - The oxidation state on group two metals (Mg, Ca, Ba) in compounds is typically +2.
 - The oxidation state on H in compounds is typically +1. (Exceptions: metal hydrides where the oxidation state on H can be -1.)
 
For this question, only the rule about neutral compounds, oxygen, and group one metals (K in this case) are needed.
Reaction B
Oxidation states in KNO₃:
- K is a group one metal. The oxidation state on K in the compound KNO₃ shall be +1.
 - The oxidation state on N tend to vary a lot, from -3 all the way to +5. Leave that as 
 for now. - There's no fluorine in KNO₃. The ion NO₃⁻ stands for nitrate. There's no peroxide in that ion. The oxidation state on O in this compound shall be -2.
 - Let the oxidation state on N be 
. The oxidation state of all five atoms in the formula KNO₃ shall add up to zero. 
. As a result, the oxidation state on N in KNO₃ will be +5. 
Similarly, for KNO₂:
- The oxidation state on the group one metal K in KNO₂ will still be +1.
 - Let the oxidation state on N be 
. - There's no peroxide in the nitrite ion, NO₂⁻, either. The oxidation state on O in KNO₂ will still be -2.
 - The oxidation state on all atoms in this formula shall add up to 0. Solve for the oxidation state on N: 
. The oxidation state on N in KNO₂ will be +3. 
Oxygen is the only element in O₂. As a result, 
- The oxidation state on O in O₂ will be 0.
 
.
The oxidation state on two oxygen atoms in KNO₃ increases from -2 to 0. These oxygen atoms are oxidized. KNO₃ is also the reducing agent.
The oxidation state on the nitrogen atom in KNO₃ decreases from +5 to +3. That nitrogen atom is reduced. As a result, KNO₃ is also the oxidizing agent. 
Reaction A
Apply these steps to reaction A.
H₂:
O₂:
H₂O: 
- Oxidation state on H: +1.
 - Oxidation state on O: -2.
 - Double check: 
. 
.
The oxidation state on oxygen atoms decreases from 0 to -2. Those oxygen atoms are reduced. O₂ is thus the oxidizing agent.
The oxidation state on hydrogen atoms increases from 0 to +1. Those hydrogen atoms are oxidized. H₂ is thus the reducing agent.