1) 40 cm from the mirror
The magnification is given by:

where
q is the distance of the image from the mirror
p is the distance of the object from the mirror
In this problem,
M = -1
q = 40 cm
Therefore, we can find p:

2) At infinite distance
For this part, we need to find the focal length of the mirror first. This can be done by using the mirror equation:

where
q = 40 cm is the distance of the image from the mirror
p = 40 cm is the distance of the object from the mirror
f is the focal length
Solving for f,

Now we can find the new position of the image if the object is moved 20 cm towards the mirror, which means that its new position is
p = 20 cm
Using the lens equation again:

This means that the image is formed at infinity (=is not formed). This can be also seen from the ray diagram attached in the picture.