4. The slant height of a cone is $l$, and the angle it forms with the base is $\theta$. The edge length of the inscribed cube (4 vertices of the cube are on the base of the cone, and the other 4 vertices are on the side surface of the cone) is $\qquad$ .
4. $\frac{\sqrt{2} l \sin \theta}{\tan \theta+\sqrt{2}}$ Detailed explanation: Let the edge length of the cube be $a$. From the diagram, we know that $l \sin \theta - \frac{\sqrt{2}}{2} a \tan \theta = a$, solving for $a$ gives:
$$
a = \frac{\sqrt{2} l \sin \theta}{\tan \theta+\sqrt{2}}
$$