In lenses
1/f=1/v-1/u
in all cases light considered to travel from left to right (→).
if the distance measured in the direction of light then the is positive.
distances are measured from the pole or mid point of the lense
because object is at the left of the lens so it is measured against the direction of light therefore u is considered as negative
if image is on the right side it is measured in the direction of light so v is positive.
Focal length f of convex lens is considered as positive
Focal length of concave lens is considered as negative
same rules are followed by the concave lens.
In it
1/f=1/v+1/u
In case of cocave or convex mirror same rules are followed
focal length of convex mirror is positive as it is measured in the direction of the light from the central point of mirror.
The focal length of concave mirror is negative because it is measured against the direction of the light.
Other distances are also governed by the Same above rules.