To solve this problem, we can use the ideal gas law, which states that for gases at the same pressure and temperature, the volume is proportional to the number of moles. Thus, we can use the concept of molar mass and compare the two gases. The equation is:
\[
\frac{m_1}{M_1} = \frac{m_2}{M_2}
\]
Where:
- \( m_1 = 5.8 \, \text{g} \) (mass of the unknown gas),
- \( M_1 \) is the molecular mass of the unknown gas,
- \( m_2 = 0.368 \, \text{g} \) (mass of hydrogen gas),
- \( M_2 = 2 \, \text{g/mol} \) (molecular mass of hydrogen).
We know the volumes of both gases are the same, so the number of moles of each gas is directly proportional to the mass. Using this proportionality and the fact that the conditions of temperature and pressure are the same, we can write:
\[
\frac{5.8}{M_1} = \frac{0.368}{2}
\]
Solving for \( M_1 \):
\[
M_1 = \frac{5.8 \times 2}{0.368}
\]
\[
M_1 = 40 \, \text{g/mol}
\]
Thus, the molecular mass of the unknown gas is \( \boxed{40} \, \text{g/mol} \).