$\frac{1}{f}=\frac{1}{v_{1}}+\frac{1}{u}$
$-\frac{1}{15}=\frac{1}{v_{1}}-\frac{1}{40}$
$\Rightarrow \frac{1}{v_{1}}=\frac{1}{-15}+\frac{1}{40}$
$v_{1}=-24 \mathrm{~cm}$
Now object is displaced by $20 \mathrm{~cm}$ towards mirror.
So,
$\mathrm{u}_{2}=-20$
$\frac{1}{f}=\frac{1}{v_{2}}+\frac{1}{u_{2}}$
$\frac{1}{-15}=\frac{1}{v_{2}}-\frac{1}{20}$
$\frac{1}{v_{2}}=\frac{1}{20}-\frac{1}{15}$
$\mathrm{v}_{2}=-60 \mathrm{~cm}$
So, image shifts away from mirror by $=60-24=36 \mathrm{~cm}$