# Carmack’s unequal lights problem

##### The problem

Thinking about the shape of the surface of equal contribution between two inverse square lights of different intensities.

Without loss of generality (by scaling, translating and rotating) we can use lights with this parameters:

Light 1 position: $\mathbf{r}_1 = \mathbf{0}$

Light 2 position: $\mathbf{r}_2 = \mathbf{\hat{x}}$

Light 1 strength: $s_1 = 1$

Light 2 strength: $s_2 = \lambda < 1$

##### 1D variant

We get the following equation using the inverse square law:

$\displaystyle \frac{1}{x^2} = \frac{\lambda}{(x - 1)^2}$

Operating with it:

$\displaystyle (x - 1)^2 = \lambda x^2$

$\displaystyle x^2 - 2x + 1 - \lambda x^2 = 0$

$\displaystyle (1-\lambda) x^2 - 2x + 1 = 0$

$\displaystyle x = \frac{2\pm\sqrt{4-4(1-\lambda)}}{2(1-\lambda)}$

$\displaystyle x = \frac{2\pm\sqrt{4-4+4\lambda}}{2(1-\lambda)}$

$\displaystyle x = \frac{1\pm\sqrt{\lambda}}{1-\lambda}$

##### Full 3D variant

Using the inverse square law we get an equation for the surface of equal intensity:

$\displaystyle \frac{1}{\mathbf{r}^2} = \frac{\lambda}{(\mathbf{r} - \mathbf{\hat{x}})^2}$

Operating:

$\displaystyle (\mathbf{r} - \mathbf{\hat{x}})^2 = \lambda\mathbf{r}^2$

$\displaystyle \mathbf{r}^2 - 2\mathbf{r}\cdot\mathbf{\hat{x}} + \mathbf{\hat{x}}^2 - \lambda\mathbf{r}^2 = 0$

$\displaystyle (1-\lambda)\mathbf{r}^2 - 2\mathbf{r}\cdot\mathbf{\hat{x}} + \mathbf{\hat{x}}^2 = 0$

$\displaystyle (1-\lambda)(x^2 + y^2 + z^2) - 2x + 1 = 0$.

Using $\mu = \sqrt{1 - \lambda}$ and completing the square:

$\displaystyle \mu^2(x^2 + y^2 + z^2) - 2x + 1 = 0$

$\displaystyle \mu^2(y^2 + z^2) + (\mu x)^2 - 2x + 1 = 0$

$\displaystyle \mu^2(y^2 + z^2) + \left[(\mu x)^2 - 2(\mu x)\mu^{-1} + (\mu^{-1})^2\right] - (\mu^{-1})^2 + 1 = 0$

$\displaystyle (\mu y)^2 + (\mu z)^2 + (\mu x - \mu^{-1})^2 = (\mu^{-1})^2 - 1$

Multiplying all terms by $\mu^{-2}$ and reordering:

$\displaystyle (x - \mu^{-2})^2 + y^2 + z^2 = (\mu^{-2})^2 - \mu^{-2}$

$\displaystyle (x - \mu^{-2})^2 + y^2 + z^2 = \mu^{-2}\left[\mu^{-2} - 1\right]$

Replacing by the expression of $\mu$ as function of $\lambda$:

$\displaystyle \left(x - \frac{1}{1-\lambda}\right)^2 + y^2 + z^2 = \frac{\frac{1}{1-\lambda} - 1}{1-\lambda}$

$\displaystyle \left(x - \frac{1}{1-\lambda}\right)^2 + y^2 + z^2 = \frac{\frac{1-(1-\lambda)}{1-\lambda}}{1-\lambda}$

$\displaystyle \left(x - \frac{1}{1-\lambda}\right)^2 + y^2 + z^2 = \frac{\frac{\lambda}{1-\lambda}}{1-\lambda}$

$\displaystyle \left(x - \frac{1}{1-\lambda}\right)^2 + y^2 + z^2 = \frac{\lambda}{(1-\lambda)^2}$

This is an sphere with

$\displaystyle \text{center} = \left[\frac{1}{1-\lambda},0,0\right]$

$\displaystyle \text{radius} = \frac{\sqrt{\lambda}}{1-\lambda}$,

matching the results found for the 1D case.

## 6 thoughts on “Carmack’s unequal lights problem”

1. guy says:

Cool.

Can re-arrange result into maybe simpler reciprocal form:

$\displaystyle x=\frac{1}{1\pm \sqrt{\lambda }}$

[Edited to show LaTeX]

• mchouza says:

Very interesting idea, I didn’t think of $\lambda$ as a square but it makes sense:

$\displaystyle \frac{1\pm\sqrt{\lambda}}{1-\lambda} = \frac{1\pm\sqrt{\lambda}}{(1-\sqrt{\lambda})(1+\sqrt{\lambda})} = \frac{1}{1\mp\sqrt{\lambda}}$

2. TTimo says:

It’s symmetric along the axis between the lights, so you really only need to do it in 2D. It’s a slightly simpler calculation.

• mchouza says:

Yes, this problem has cylindrical symmetry. The change can be made just by replacing $y^2 + z^2$ with $r^2$ everywhere.