Concept:
For a concave mirror, the mirror formula is:
\[
\frac{1}{f} = \frac{1}{v} + \frac{1}{u}
\]
Magnification is:
\[
m = \frac{dv}{du} \approx \frac{f^2}{(u - f)^2}
\]
For a small object along principal axis, image length is obtained using longitudinal magnification.
Step 1: Given data
\[
f = -20 \text{ cm}, \quad u_1 = -25 \text{ cm}
\]
Pencil length = 5 cm, so far end:
\[
u_2 = -30 \text{ cm}
\]
Step 2: Find image positions using mirror formula
For near end:
\[
\frac{1}{-20} = \frac{1}{v_1} + \frac{1}{-25}
\]
\[
\frac{1}{v_1} = -\frac{1}{20} + \frac{1}{25}
= \frac{-5 + 4}{100} = -\frac{1}{100}
\]
\[
v_1 = -100 \text{ cm}
\]
For far end:
\[
u_2 = -30
\]
\[
\frac{1}{-20} = \frac{1}{v_2} + \frac{1}{-30}
\]
\[
\frac{1}{v_2} = -\frac{1}{20} + \frac{1}{30}
= \frac{-3 + 2}{60} = -\frac{1}{60}
\]
\[
v_2 = -60 \text{ cm}
\]
Step 3: Image length
\[
\text{Image length} = |v_2 - v_1|
\]
\[
= |-60 - (-100)|
= 40 \text{ cm}
\]
Final Answer:
\[
\boxed{40 \ \text{cm}}
\]