Answer:
molar composition of oxygen =0.2 (20%)
molar composition of hydrogen = 0.8 (20%)
Explanation:
Since hydrogen and oxygen react according to
2*H₂+ O₂ → 2*H₂O
according to the ideal gas law:
P₁*V=n₁*R*T (initial state)
P₂*V=n₂*R*T (final state)
dividing both equations
P₁/P₂ = n₁/n₂
then since 2 moles of hydrogen react for every mole of oxygen that reacts, thus oxygen that reacted "no" is
no = (n₁-n₂) 1/(1+2) = n₁ (1-n₂/n₁)/3
then
molar composition of oxygen = xo= no/n₁ = (1-n₂/n₁)/3 = (1-P₂/P₁)/3 = (1-0.4 atm/1 atm )/3 = 0.2 (20%)
then
molar composition of hydrogen = xh= 1- xo = 0.8 (20%)
to verify it , the number of initial moles n₁=remaining hydrogen + hydrogen that reacted + oxygen that reacted
and since 2 moles of hydrogen react for every mole of oxygen that reacts n₁= n₂ + (n₁-n₂) (2/3) + (n₁-n₂) (1/3) = n₂ + (n₁-n₂) = n₁