The Jeans length is the length scale of a collapsing cloud of self-gravitating gas. To derive it, start with the virial theorem
where K is the kinetic energy of the gas molecules and U is the gravitational potential energy of the cloud of gas. Taking the cloud to be spherical, the sphere gravitational potential energy is
where G is the gravitational constant, M is the total mass of the cloud, and R is the radius of the cloud. Similarly, the kinetic energy is
where N is the number of molecules, k is Boltzmann's constant, T is the temperature, and m is the molecular mass. Plugging it gives
But
where is the cloud's mass density, so plugging this into (4) and solving for R gives the Jeans length as
Roche Limit, Sphere Gravitational Potential Energy