An elastic collision is defined as one in which the total kinetic energy is conserved. If a collision is known to be elastic, one may  use this fact to equate the total kinetic energy in the system before and after the collisions. The kinetic energy K of a body is defined as (1/2) * m * v^2, and the total kinetic energy in a system is the sum of the kinetic energies of each moving body in it. Thus for elastic collisions you can write

    K1i + K2i = K1f + K2f
or
    (1/2)*m1*v1i^2 + (1/2)*m2*v2i^2 = (1/2) *m1*v1f^2 + (1/2)*m2* v2f^2

where "i" is used on initial values and "f" is used on final values.

Note that while the law of conservation of momentum applies to every collision, the further principle of conservation of kinetic energy for elastic collisions may only be applied if you know  the collision can be treated as elastic. In other collisions, a significant fraction of the kinetic energy may be converted into other forms of energy, such as thermal energy, so is not conserved.