Using a number line
The average of two numbers is half way between them
Label the shortest distance $n$
$11n=$ distance from $40$ to $150$
$11n=110\Rightarrow n=10$
$a=150+n+4n=200$
Using weights
$b$ is made from $a$ and $40$, weighted equally
$c$ is made from $a$ and ($a$ and $40$), but $a$ should have weight equal to the weight of ($a$ and $40$). That is the same as using $a$ twice and ($a$ and $40$) once.
$d$ is made from ($a$ and $40$) and (three $a$s and $40$), but again ($a$ and $40$) must be stretched to give equal weights:
And the same for $150$:
$150$ is the average of eleven $a$s and five $40$s
Using algebra starting from the end
$150$ is the mean of $c$ and $d$ so $c +d =300\Rightarrow d = 300 - c$ (make $d$ the subject to get rid of $d$, then get rid of $c$ etc until only $a$ remains)
$d$ is the mean of $b$ and $c$ so $b+c=2d=2(300-c)$
$\Rightarrow b+c=600-2c \Rightarrow 3c=600-b \Rightarrow c = \frac13(600-b)$
$c$ is the mean of $a$ and $b$ so $a+b=2c=2\times \frac13(600-b)$
$\Rightarrow 3a+3b=1200-2b \Rightarrow 5b = 1200-3a \Rightarrow b = \frac15(1200-3a)$
$b$ is the mean of $40$ and $a$ so $40+a=2b=2\times\frac15(1200-3a)$
$\Rightarrow 200+5a = 2400-6a \Rightarrow 11a = 2200 \Rightarrow a=200$