What is the primary purpose of photosynthesis?

to capture light energy, convert some of it into chemical energy, and store it in the form of carbohydrates for other life forms to use
to capture light energy and release oxygen into the atmosphere, so that the level of oxygen in the atmosphere increases
to take up carbon dioxide from the atmosphere so that the level of carbon dioxide in the atmosphere is reduced