The stars expand and contract at a velocity determined by the speed of sound within the star's outer envelopes. The speed of sound is given by:
Speed = ( gamma x Pressure/gas density)^1/2where 'Gamma' is a number that depends on the exact composition of the gas. The pressure in the atmosphere is determined by solving an equation that describes the equilibrium between gravitational and thermal pressures within the star; the so-called Equation of Hydrostatic Equilibrium. When you solve this equation, you get a formula that defines the gas pressure inside the star in terms of the distance to the star's surface. You then have to do a little bit of calculus to compute the period of the star from this, but the bottom line is a formula like:
3 pi 1/2
Period = ( ------------------- )
2 Gamma G Density
This shows that for very large giant stars that have low gas density, there
periods will be long, while for smaller, higher density stars, they will have
shorter periods. The famous 'Period-Luminosity' relation obtains because the
largest giant stars are also the most luminous, and the smallest giants are
of lower mass, and moreover, the surface temperature range over which this
phenomenon occurs is relatively narrow so that the star's luminosity is
mostly affected by its radius and surface area, not by its surface
temperature.