Galaxies consist of large numbers of stars, for which computation of individual orbits, under the combined gravity of all the others, is still not possible with present day computers. This is we have discussed potentialdensity pairs earlier in the course. But the density of galaxies described by smooth analytical functions ignores the individual stars, and we are implicitly assuming that the cobined gravity of all the stars is much more important than the effects of a star on star encounters. We will now show that this is a very good assumption for galaxies, but breaks down in some astrphysical objects, such as in star clusters.
Consider a star travelling with velocity v in a galaxy consisting of N stars, spread uniformly in a region of radius R.
How likely is it that a star will encounter another star sufficiently close to have a significant effect on its velocity?
For a star moving with velocity v past another star of mass M, for its velocity to be significantly changed, it must pass within a distance b of the star, where b is given by
b = GM/v^{2}.
Here, b is just the distance from a star of mass M where the circular orbital velocity is the same as the velocity v of the incoming star. In this situation, we can expect a significant change in the velocity vector of the impacting star.
Imagine now that the impacting star has a circle of radius b around it and perpendicular to its path, with surface area πb^{2}. This circle will sweep out a volume in the galaxy as it moves along. Suppose it moves distance D before undergoing a near encounter with another star. We want to know how long this distance is, and how long it takes to travel that far.
The distance D can be thought of as the mean free path of the star, and the time between encounters as a 'relaxation' time  the time it takes for significant changes to take place because of individual encounters between pairs of stars.
The volume swept out by the star along its orbit is πb^{2}D. The mean volume per star in the galaxy is just the total volume 4/3πR^{3} divided by the number of stars, N.
An encounter is likely if these two volumes are the same, so we have π b^{2} D = 4/3 π R^{3} / N.
Rearranging gives the mean free path, D
D = R^{3} v^{4}/(N G^{2} M^{2})
where the small factor 4/3 has been dropped.
The time between encounters is just the mean free path over the velocity, and is
t = R^{3} v^{3}/(N G^{2} M^{2}).
Exercise #1:
Choose some appropriate values for N, the number of stars in the Milky Way, its radius, R and the typical veliocity of stars v, to estimate the typical time between vey close star encounters. How does the time compare with the age of the Galaxy? Try the same for stars in a globular cluster (typical sizes, velocites and stellar numers are shown in module 2. How does the time compare with the typical ages of such objects? 
The exercise shows that starstar encounters in the Milky Way are rare. Strictly speaking, we have showed that very close encounters are rare, so that changes in the velocities of the stars due to strong two body encounters are very small. We have not yet demonstrated that the sum effect of many weak encounters also has completely negligible effects over the life time of the Milky Way. This can be shown by a rigorous accounting of the sum of weak encounters for all impact parameters ranging from b = GM/v^{2} all the way to the size of the galaxy, R (see e.g. Binney are Tremaine, Chapter 4).
The main effect on the orbit of a star is the total gravity of the rest of the stars, and not the effects of individual encounters with other stars.
We will now look at how we can describe bulk stellar properties statistically. This will lead to two fundamental and extremely useful equations which relate the densities and velocities of the stars to the potential: the Boltzmann equation and the Jeans equation.
Consider N stars which can be described in the 6D space of position and velocity and in time by a distribution function f,
f = f (x,y,z;u,v,w;t)
where there are dN stars in the phase space element dx, dy, dz, dU, dV, dW, i.e. between x and x+dx, y and y+dy etc...
Then
dN = f(x,y,z;u,v,w;t)dx dy dz dU dV dW.
If we denote the gravitational potential of this distribution by Φ then the components of the gravitational force per unit mass are
F_{x} = ∂Φ/∂x,
F_{y} = ∂Φ/∂y,
F_{z} = ∂Φ/∂z.
The equations of motion of the ith star are given by
dU_{i}/dt = F_{x},
dV_{i}/dt = F_{y},
dW_{i}/dt = F_{z}.
Now consider the number of stars in a cell of phase space, which changes by dN in a time dt:
dN = f(x+Udt, y+Vdt, z+Wdt; U+F_{x}dt, V+F_{y}dt, W+F_{z}dt; t+dt)dQ'
where
dQ' = dU'dV'dW'dx'dy'dz' and x'=x+Udt etc... U'=U+F_{x}dt etc...
Finally, we consider a density configuration, in which the number of stars in each cell of phase space changes very slowly, so that to first order in dt, dQ' = dQ. The equations of motion can be expressed as a first order differential equaion of the distribution function f
∂f/∂t + U∂f/∂x + V∂f/∂y + W∂f/∂z + F_{x}∂f/∂U + F_{y}∂f/∂V + F_{z}∂f/∂W = 0.
This is the fundamental equation of stellar dynamics for a collisionless system of particles and is called the collisionless Boltzmann Equation.
If we assume that the Galaxy is in a steady state, so that the density of the stellar distribution is not changing with time (i.e. galaxies are not expanding or contracting along any direction), then the first term is vanishes
∂f/∂t = 0.
See section 4.1 and 4.2 of Binney and Tremaine for a complete description of the results summarised here. If we take moments of the Boltzmann Equation we can derive quite significant insight into the nature of the stellar distribution. Firstly, we can integrate the over all velocities dV = dUdVdW. The result is a continuity equation, ∂ρ/∂t + ∂(ρ<U>)/∂x + ∂(ρ<V>)/∂y + ∂(ρ<W>)/∂z = 0 where <U>, <V> and <W> denote the mean value of the velocity. The equation expresses physically the relationship between the rate at which stars enter and leave a volume element and the change in the density in the element. If we multiply the equations by the velocity and integrate over all velocities, we obtain a very useful first order description of the system (in terms of the second moment of the velocity) called the Jeans Equation. It is the equivalent for stellar systems of the Euler equation for fluid flow. (See BT section 4.2, and in particular equation 427). The Jeans equation for a 1D selfgravitating system with velocity dispersion σ(z), density ρ(z) and potential &Phi(z) is 1/ρ d[ρσ^{2}]/dz = −dΦ/dz. Note that the system is assumed to be stable, i.e. the density and velocity dispersion are explicitly assumed to be unchanging in time. 
Under the effect of their own selfgravity the stars will form a disk of finite thickness in the vertical direction. Stars with small velocity will be able to rise to small heights above the disk before returning, while the smaller number of stars with larger velocities will be able to rise to greater height. Stars with zero vertical velocity will be restricted to midplane orbits. If the system of stars is in a steady state, in which the disk gets neither thicker or thinner, then the distribution function of the stars is a function of z and W only.
f=f(z,W).
Since the system is in a steady state, we have
W df/dz + F_{z} df/dW = 0.
The distribution function allows one to recover many properties of the
system. For example, the density ρ of the stars as a function of height is
the integral over velocity of the distribution function

where M is the mass of each star, considered to be the same for all stars to keep things simple.
The force generated vertically by this density distribution is given by the
integral over z of the density

These relations allow us to recover the density and potential of the stars, if we know the distribution function, DF. We'll now look at a very simple case of a DF, and show that it leads to quite plausible density distributions for stars in a disk.
Let us now consider a distribution function in which the number of stars is an exponentially declining function of their energy E  the more energy, the fewer the stars  and is a function only of their energy.
f(E) = ρ(0)exp(−E/σ^{2})/√(2πσ^{2})
where the energy of the star is
E = KE + PE = (1/2) W^{2} + Φ(z).
We can define the potential to be zero at z=0 without losing generality, so that we can write f(E) in terms of Z height and W velocity of the stars
f(W,Z) = ρ(0) exp(−W^{2}/2σ^{2})
/√(2πσ^{2}).
This distribution of kinetic energy has a maximum at W=0 and decreases rapidly with increasing W velocity  it is simply the Gaussian distribution function in velocity with width (i.e. velocity dispersion σ). Note also that it is independent of Z  stars have the same velocity distribution at all heights above the plane.
Exercise #2: Look back to an earlier lecture where we made an estimate of the stellar density near the Sun, and use this as the normalisation ρ(0) in the distribution function above. Use GNUPLOT to plot out the distribution function, adopting a vertical velocity dispersion of 20 km/s. Make an estimate of the space density of stars with speeds of more than 100 km/s. At what distance from the Sun would a volume around the Sun be expected to contain a few such stars? 
In general the velocity dispersion may change with Z, but let's first consider the case where the velocity dispersion is constant, as we just saw above. This is called an isothermal disk. The name isothermal (or constant temperature) shows that one is thinking here of the velocity dispersion of the stars as equivalent to their internal energy.
Integrating f=f(W) over velocity W we obtain the density distribution of the stars from Eqn (1). The solution has the form
ρ(z) = ρ(0) sech^{2}(z/z_{0})
where z_{0} is the scale height of the stars, and is given by
z_{0 } = σ / √(2 π G ρ(0)).
Note that sech is a hyperbolic trigonometric function
sech(x) = 1/cosh(x)
where cosh(x) = (exp(x)−exp(−x))/2 and sinh(x) = (exp(x)+exp(−x))/2.
A plot of the density distributions of this type are shown below for several different scale heights.
At large distances from the plane, it falls off close to exponentially, while close to the plane it is nicely rounded over, so that the density changes smoothly when crossing from negative to positive Z (i.e. the density gradient at Z=0 is zero).
Two of the distributions above are quite good descriptions for the young (100 pc scale height) and the old disk (300 pc scale height) respectively.
Exercise #3: build a model of the local disk by combining two sech^{2}(z/z_{0}) laws, one for the young disc and one for the old disc. Adopt a total local density of matter of 0.1 solar masses per cubic parsec. After choosing appropriate normalisations for the young disk and old disk's central densities, plot the combined density distribution. Although the summed distribution is a reasonable match to the real disk, What is wrong with simply summing the two density laws together? 
We can solve for the vertical force on the star using equation (2) above, now that we have derived the density distribution. The result is
F_{z} = −4πG ρ(0)z_{0} tanh(z/z_{0})
Hence the restoring force on a star is proportional to the disk central density and the scale height of the matter.
Below is plotted the force for the three disks above, normalised so that they all have the same central density (their total masses are in proportion to the scale heights).
In a 1D system, the Jeans Equation takes the form :
ρF_{z} = d(ρσ^{2})/dz.
The equation expresses the relation between the potential (i.e. the force field F_{z}(z)), the density distribution of the stars ρ(z) and the velocity dispersion of the stars, σ(z).
For an isothermal disk, σ is constant, and we have
F_{z} = (σ^{2}/ρ) (dρ/dz).
Exercise #4:
From the density distribution
ρ = ρ(0) sech^{2}(z/z_{0}) and force law for an isothermal disk F_{z} = −4πGρ(0)z_{0}tanh(z/z_{0}), verify that the Jeans equation holds. 
The exercise shows that, for an isothermal disk, the total force on the stars depends only on their density distribution and its gradient.
To solve the Jeans Equation for nonisothermal disks, one can start from a vertical density distribution and derive the velocity dispersion for the stars.
In this case, we combine the Jeans Equation and the 1D Poisson Equation:
ρF_{z} = d(ρσ^{2})/dz.
and
d^{2}Φ/dz^{2} = −4πGρ.
To do this, differentiate the Jeans equation and substitute for Φ. The result is
d [ (1/ρ) d(ρσ^{2})/dz ] /dz = −4πGρ.
Thus, for a selfgravitating disk of a given density distribution, this allows us to now derive the velocity dispersion of the stars as a function of z height, as well as the vertical force downwards on the stars.
Exercise #5: We have
already derived the velocity dispersion and force law for an isothermal disk,
with σ = const. Observations show that the vertical density profile of
the local galaxy is actually a bit sharper (more centrally concentrated) than
the isothermal profile. It is in fact closer to being exponential:
ρ = ρ(0) exp(z/z_{0}) For this exponential density law, first derive the force law F_{z} and using the Jeans equation derive the velocity dispersion profile &sigma(z); as function of height z. For the local disk, appropriate values to adopt are ρ(0) = 0.1 solar mass per cuic parsec and σ(0) = 20 km/s. Plot the density, force law and velocity dispersion profiles with GNUPLOT over the vertical range 0 to 1 kpc. 
Review: We have looked at the Poisson, Jeans and Boltzmann equations for a simple, 1D stellar system, the vertical structure of a disk of selfgravitating stars (and gas). They allow us to relate the density and dynamics of the stars without having to compute orbits of every star  statistical properties can be sufficient for a wide range of purposes, one of which was shown here.
Exercise #6:
This is a more challenging exercise. Recently, a very dim galaxy  a satellite of our own Milky Way  has been discovered by Belokurov et al (2007) in the SDSS survey, and is called Segue I. In this paper, the "core radius" and velocity dispersion of the galaxy have been measured as a=20 parsecs and σ=4 km/s. We will model this galaxy as an isothermal sphere (see lecture 4) to make an estimate of the amount of matter that lies within the core radius. First, use the Jeans equation to show that the velocity dispersion σ is related to the circular velocity via σ^{2} = 2 V^{2}_{circ}. Note : the Jeans equation in spherical coordinates is (1/ρ) d(ρσ^{2})/dr = dΦ/dr. From the circular speed, make an estimate of the amount of matter within the core radius. The amount of visible matter within the core radius is approximately 300 solar masses (all seen as stars  there is virtually no gas in the system). How does this compare with the estimate of the total matter? What do your results say about the system? 
We have now looked at two 1D systems  the vertical distribution of stars in a disk, and the radial distribution of stars in an isothermal population. Later in the course we'll extend ourselves to more dimensions, by looking at the density and kinematics of stars in the Milky Way's stellar halo.