Probably, it'sthere's no math. It's known as Lens flare. A short googling would have provided your answer. Wikipedia has a good article on it. It happens when light reception takes place through lenses (both cameras and even your eyes) in the presence of a bright source which could be either inside or outside the frame.
It is a condition that often occurs in photographs when light goes where it is not supposed to go. When light that is not contributing to the image at hand, enters the camera and hits the sensor or film, you get a flare in the photograph. These can wash out the color in the rest of the image, and show up as a polygonal object in the image. The number of rays and their direction depends on the angle of incidence. This link gives useful information aboutregarding Lens flares.
Lens flares could be prevented using lens hoods or a lens having a good anti-reflective coating on it...