Theory:

Using ray diagrams, we can represent image formation by lenses. The nature, position, and relative size of the image formed by lenses can also be studied using ray diagrams. We use any two of the following rays to draw ray diagrams in lenses like spherical mirrors.
 
 
Rule 1:
 
A ray of light from the object, parallel to the principal axis, after refraction from a convex lens, passes through the principal focus on the other side of the lens. In the case of a concave lens, the ray appears to diverge from the principal focus located on the same side of the lens, as shown in the below figure.
 
36.png
Ray of light passing parallel to principal axis
 
Rule 2:
 
A ray of light passing through a principal focus, after refraction from a convex lens, will emerge parallel to the principal axis. A ray of light appearing to meet at the principal focus of a concave lens, after refraction, will emerge parallel to the principal axis.
 
37.png
Ray of light passing through principal focus
 
Rule 3:
 
A ray of light passing through the optical centre of a lens will emerge without any deviation.
The ray diagrams for the image formation in a convex lens for a few positions of the object is shown below.

38.png
Ray of light passing through optical centre