Magnification is the ratio of height of the image(h') to the height of
the object(h).
It is also equal to negative of the ratio of the image distance(v)
to object distance(u).
m = h′h=−vu
Real image is always formed in front of the mirror and virtual image
is formed behind the mirror.
Object distance is always negative(according to convention).
When the magnification is positive, that means image distance is
positive or the image is formed behind the mirror. So it is virtual.
And when the magnification is negative,
that means image distance is pnegative or the image is formed in front
of the mirror. So it is real.