In the usual triangular prism, the ray changes direction twice, one time when it enters the prism and second time when it leave the prism. The prism form is such that both times the ray is bended toward the same direction, and the total deviation angle is the sum of these two deviation angles:
Now, the four angle polygon ABCD has two right angles (B and D). As the sum of angles in polygon is always 360 (degrees), the bottom angle C = 180 - A (A is the angle between the two relevant prism faces at the top of the prism).
As the sum of angles in triangle is always 180:
By adding (1) and (2) side by side we get
Now we notice that
To derive further, we need to use the Snell's law that the ratio of the sines of the angles of incidence and refraction equal to the opposite ratio of the indices of refraction:
Following this law and assuming that the optical density of the air (where the prism is located) is close to 1, the optical density of the prism material can be written as
Now, going from another side,
Substituting this expression into (3), together, we get
This is already half or result as we we tie the two angles that depend mostly on our ray to A and n, the characteristics of the prism. Additional analysis can be found at  (spectroscopy related site).
The minimum deviation angle is an important characteristic of the prism. The minimum deviation occurs when entering angle and exiting angle are the same. It allows to find the refraction coefficient of the prism. At the minimum angle,
As the bending angles actually depends on the wavelength, the prism decomposes the white light, producing the rainbow.