# Inverse square law, but with multiple sources

I'm making a raytracing renderer, and I'm implementing lights. I read about the inverse square law, which I'm sure you know as:

$$intensity = \frac{k}{distance^2}$$

So for each point on an object I calculate the intensity like this, where $k$ is the energy of a light. However, what if there are multiple lights? How would I calculate the final intensity of a point?

Before anyone asks, I have searched for this on the web, but haven't found any relevant solutions.

A few solutions I've thought about, are:

$$intensity = \sum_n\frac{k_n}{distance_n^2}$$

So basically summing all of the intensities.

Another option would be

$$intensity = \prod_n\frac{k_n}{distance_n^2}$$

i.e. multiplying the intensities, but I don't think that would work if you consider any of the intensities being 0.

So is there some way of doing this, which I haven't found by googling my title?

Your equation $$intensity = \sum_n\frac{k_n}{distance_n^2}$$ is correct.