Lenses work by refracting light rays using the principle of refraction. There are two main types of lenses: convex and concave. A convex lens is thicker in the middle and converges light rays, forming a real, inverted, and reduced image. A concave lens is thicker on the edges and diverges light rays, forming a virtual, upright, and reduced image. Ray diagrams can be used to determine the location, orientation, size, and type of image formed by a lens by tracing the path of three key rays: the parallel, focal, and vertex rays.