Step 1: Use the formula for escape velocity.
The escape velocity \( v_e \) from the surface of a planet is given by the formula:
\[
v_e = \sqrt{\frac{2GM}{R}}
\]
where:
- \( G \) is the universal gravitational constant,
- \( M \) is the mass of the planet, and
- \( R \) is the radius of the planet.
Step 2: Express mass in terms of density.
The mass of a planet is related to its density \( \rho \) and volume. The volume \( V \) of a spherical planet is given by:
\[
V = \frac{4}{3} \pi R^3
\]
Thus, the mass \( M \) of the planet is:
\[
M = \rho \times V = \rho \times \frac{4}{3} \pi R^3
\]
Step 3: Substitute into the formula for escape velocity.
Substitute the expression for mass into the formula for escape velocity:
\[
v_e = \sqrt{\frac{2G \times \rho \times \frac{4}{3} \pi R^3}{R}} = \sqrt{\frac{8 \pi G \rho R^3}{3R}} = \sqrt{\frac{8 \pi G \rho R^2}{3}}
\]
Thus, the escape velocity is proportional to:
\[
v_e \propto \sqrt{\rho R^2}
\]
Step 4: Find the ratio of escape velocities.
Now, let’s find the ratio of escape velocities for planets A and B. The ratio of escape velocities is:
\[
\frac{v_{eA}}{v_{eB}} = \sqrt{\frac{\rho_A R_A^2}{\rho_B R_B^2}}
\]
We are given that:
- \( \frac{\rho_A}{\rho_B} = \frac{2}{1} \),
- \( \frac{R_A}{R_B} = \frac{1}{2} \).
Substituting these values:
\[
\frac{v_{eA}}{v_{eB}} = \sqrt{\frac{2 \times 1^2}{1 \times 2^2}} = \sqrt{\frac{2}{4}} = \sqrt{\frac{1}{2}} = \frac{1}{\sqrt{2}}
\]
Thus, the ratio of escape velocities is:
\[
\boxed{\frac{1}{\sqrt{2}}}
\]