The following sign convention is used for measuring various distances in the ray diagrams of spherical mirrors:
Object is always placed to the left of the mirror
All distances are measured from the pole of the mirror.
Distances measured in the direction of the incident ray are positive and the distances measured in the direction opposite to that of the incident rays are negative.
Distances measured along y-axis above the principal axis are positive and that measured along y-axis below the principal axis are negative.
Since the image formed is magnified and virtual, the mirror is convex.
According to the convention
u = -18 cm
m = 1/3 = -v/u => v = 6 cm
From mirror equation,
1/v + 1/u = 1/f => f = uv/(u+v) => f = -6cm