1. The pinhole camera works on the principle of light travelling in a straight line.
2. The rays of light from the candle flame go in all directions.
3. We consider only two rays that pass through the hole and fall on the screen.

4. The rays intersect at the pinhole.
5. Since the rays cross over at that point, the top of the object appears at the bottom of the image and the bottom of the image appears at the top. Thus, we see an inverted image of the candle.