What's the difference between the five masses: inertial mass, gravitational mass, rest mass, invariant mass and relativistic mass? I have learned in my physics classes about five different types of masses and I am confused about the differences between them.
What's the difference between the five masses: 


*

*inertial mass, 

*gravitational mass,

*rest mass,

*invariant mass,

*relativistic mass?
 A: A body's inertial mass is the mass measured by its resistance to changes in motion. Its gravitational mass is the mass measured by its attraction by gravitational force. Its rest mass is the mass when it's at rest with respect to an observer, and is then equivalent to its inertial mass.
A: Astonishingly (for this site) poor performance of experts. They simply restated some historical knowledges of Newton’s age and threw some modern formulas over it, without considering misconceptions of former or latter.
Here is my answer (not in original order):
1. invariant mass
A scalar quantity, an intrinsic property of a body (preserved by Poincaré transformations, and with some clauses, in General Relativity). Is constant for subatomic particles (each species has its value of mass), as well as for atoms (and similar objects) on a specified energy level. Does not have a conservation law. Is not strictly constant for large bodies; for example, increases with heat.
2. rest mass
The same as invariant mass if it is positive. For particles with zero invariant mass, strictly speaking, rest mass is undefined (although both terms might be synonymous in colloquial speech). A separate term is motivated by the fact that massive bodies, and only them, have their rest frames (may be also called CoM frames).
3. relativistic mass
A historical misconception; in short, the same as energy in Special Relativity. See  Why is there a controversy on whether mass increases with speed? for details.
4. inertial mass
The “m” thing in Newtonian mechanic; thought to be a conserved scalar quantity. For low speeds approximately equals to the rest mass, but generally an obsolete concept since relativistic dynamics. Depending on context, is superseded in relativity either with the rest mass or (along momentum vectors) with 4-momenta. One can’t consistently define inertial mass of a photon, for example.
5. gravitational mass
Supposed gravitational charge (for Newton’s gravity law or some another theory). GR’s equivalence principle suggests that it does not differ from energy and momentum (it means there is no scalar charge in gravitation!) and isn’t recognized as a separate concept in GR. But alternative theories of gravitation are possible, in principle.
A: Let us define the inertial mass, gravitational mass and rest mass of a particle.
Inertial mass:
To every particle in nature we can associate a real number with it so that the value of the number gives the measure of inertia (the amount of resistance of the particle to accelerate for a definite force applied on it) of the particle.
Using Newton's laws of motion,
$$m_i = \frac{F}{a}$$
Gravitational mass:
(This is defined using Newton's law of universal gravitation i.e. the gravitational force between any two particle a definite distance apart is proportional the product of the gravitational masses of the two particles.) To every particle in nature we can associate a real number with it so that the value of the number gives the measure of the response of the particle to the gravitational force.
$$F = \frac{Gm_{G1}m_{G2}}{R^2}$$
All experiments carried out till date have shown that $m_G = m_i$
This is the reason why the acceleration due to gravity is independent of the inertial or gravitational mass of the particle.
$$m_ia = \frac{Gm_{G1}m_{G2}}{R^2}$$
If $m_{G1} = m_i$ then $$a = \frac{Gm_{G2}}{R^2}$$
That is acceleration due to gravity of the particle is independent of its inertial or gravitational mass.
Rest mass:
This is simply called the mass and is defined as the inertial mass of a particle as measured by an observer, with respect to whom, the particle is at rest.
There was an obsolete term called relativistic mass which is the inertial mass as measured by an  observer, with respect to whom, the particle is at motion. The relation between the rest mass and the relativistic mass is given as
$$m = \frac{m_0}{\sqrt{1-v^2/c^2}}$$
where $v$ is the speed of the particle and $c$ is the speed of light, $m$ is the relativistic mass and $m_0$ is the rest mass.
A: Inertial mass is the mass that appears in Newton's Second Law $$F=ma$$ Gravitational mass is what appears in Newton's Law of Gravity $$F=\frac{GMm}{r^2}$$ Einstein's Equivalence Principle requires that inertial mass and gravitational mass are equal so that all masses react the same way to a given gravitational field ($m$ cancels in the above two equations to give the same acceleration). This equality has been established to great precision in many experiments.
Rest mass is a somewhat obsolete term for what is referred to more commonly today as the invariant mass, proper mass or simply just mass in relativistic physics. Given the 4-momentum $p^\mu$ of a particle, a scalar invariant can be obtained from it which is the square of its mass. $$p^\mu p_\mu=m^2$$
Since it is an invariant, it holds true in any reference frame. However, in the frame in which the particle is at rest, $m$ equals the total energy of the particle (in units of $c=1$), hence the old name of "rest mass".
Newton's second law takes a different form when relativity is taken into account, so it's not helpful to compare rest mass and inertial mass, except of course in the rest frame of the particle. The important conceptual difference in relativity however is that inertia, defined as the resistance to motion, depends on the velocity of the particle so that the higher the velocity, the harder it is to accelerate it. You can read more about that in the Wikipedia article or a nice textbook on Special Relativity.
