I will answer it by the
following shortened version of the life of a star such as our Sun after it has reached the
'normal' star state. As far as expansion and contraction are concerned it all depends which
part of the stellar cycle you are interested in. Both occur between the 'normal' state and the
black dwarf stage.
Initially the star shines in the 'normal' state, like our Sun, for many
millions of years. In fact a star like our Sun will fuse hydrogen for some 1010 years. The
central core finally "runs out" of hydrogen and begins to cool. This means that the radiation
from it is reduced, the radiation pressure is less and so gravity takes over.
The core
begins to collapse.
The layers of the star outside the core are still fusing hydrogen.
They now fall inwards and actually heat up. The rate of fusion in this shell increases and the
radiation emitted by this shell increases. The layer of the star outside this is therefore heated
up by this increased radiation.
It expands.
This rate of expansion
continues and the star expands to produce a Red Giant the size of the Earth's orbit. This
expansion is so rapid that the outer layers will cool, their temperature falling from the 6000o
of its main lifetime to some 3000o in the Red Giant phase.
The core is still hot and
continuing to collapse due to gravitational forces.
It heats up further, the hydrogen
runs out and the fusion of helium begins. Known as the triple alpha process helium is fused
to give beryllium and finally carbon. For stars with a mass less than 3 solar masses this
occurs rapidly and is called a helium flash.
The layers of the star outside the core
will be heated and explosions will take place, blowing away an outer shell of gas. In stars like
the Sun between 25 and 60% of the mass is blown away to form a planetary nebula. The
process repeats and the star flashes as layers of its matter are puffed away into space.
As time goes by the radiation from the fusion in the core gets less. The star shrinks
and cools a little, although it is still hot enough to continue fusing hydrogen and becomes a
small hot star – a white dwarf. The core has the size of the Earth and therefore the density of
a white dwarf is enormous – 108 to 109 kgm-3. A teaspoon of this matter would have a mass
of several tons!
Eventually all fusion ceases and a black dwarf is formed, a dark,
cold ball of oxygen and carbon– the star has died.