The reaction for my lab is

Mg(s)+2HCl(aq)--> MgCl2(aq)+H2(g)

I need to find the pressure of the hydrogen gas.
Initial Pressure = 0.98692 atm
Total Pressure = 1.64816 atm

I don't know if I calculated the pressure of hydrogen gas correctly. I used the formula Total Pressure=Initial Pressure+Pressure of H2+Pressure of H2O
This is what I got for an answer.
Pressure of H2=1.64816-0.98692-0.0313=0.6926atm

Where did the 1.64816 come from?

Usually these are done by collecting H2 gas over water. Then the room pressure, which I assume is the 0.987 atm - vapor pressure of water at room T is pressure of dry H2 gas at those conditions. This assumes the pressure inside the collection vessel and outside the vessel were the same.

In the lab I had a strip of magnesium that weighed 0.029 grams and I added 15 milliliters of 0.5 M hydrochloric acid into a flask and I never used any water during the lab. So I don't really understand where I would get the water vapor pressure.

OK. I don't know what you did. You must have generated the H2 gas and measured the total pressure at the end. So total P - pH2O - initial P would be P of dry H2. If so what you have looks ok to me. The vapor pressure of the water must be the 0.0313 (that's equivalent to 23.7 mm Hg which is about right for a temperature of 25C.

The pressure of the water vapor comes from the water in the HCl(aqueous).

Oh ok and I used a device called a Xplorer GLX and it measured the pressure of the flask before I put in the magnesium and hydrochloric acid and then it measured the pressure once the reaction was complete. But thank you for all of your help!

To calculate the pressure of the hydrogen gas (H2) in the reaction, you need to subtract the partial pressures of other gases (in this case, HCl and any water vapor) from the total pressure observed in the lab.

Based on the balanced chemical equation of the reaction, we see that 1 mole of Mg reacts with 2 moles of HCl to produce 1 mole of H2 gas. Therefore, the stoichiometric ratio between HCl and H2 is 2:1.

To find the partial pressure of H2, you can use the mole ratio as a conversion factor. In this case, we can assume that all of the HCl reacts to form H2, so we can find the moles of H2 produced using the moles of HCl consumed.

First, determine the moles of HCl consumed:
Moles of HCl = Volume of HCl (in liters) × Molarity of HCl

Assuming you have the necessary volume and molarity values for HCl, you can calculate the moles of HCl used in the reaction.

Next, calculate the moles of H2 produced:
Moles of H2 = Moles of HCl used × (1 mole H2 / 2 moles HCl)

Now that you know the moles of H2 produced, you can calculate the pressure of H2 using the ideal gas law equation:

PV = nRT

Where:
P = pressure (in atmospheres)
V = volume (in liters)
n = moles of gas
R = ideal gas constant (0.0821 L × atm / mol × K)
T = temperature (in Kelvin)

Rearranging the equation, we have:

P = nRT / V

Substituting the known values (moles of H2, R, and assuming constant temperature and volume), you can solve for the pressure of H2 in atm.

Finally, compare the pressure of H2 obtained from the above calculation with the total pressure measured in the lab to verify if your earlier calculation using the formula Total Pressure = Initial Pressure + Pressure of H2 + Pressure of H2O was correct.