Under the action of the external force, the rod accelerates with a = F/m. The magnitude of stress decreases as one moves away from the point of application of the force.
Therefore, the strain also decreases as one moves towards the free end.
To determine the total elongation of the rod, let us consider a small element of length dx at a distance x from the free end of the rod. The magnitude of force at this section is F' = Fx/L. Therefore, the stress at this Section is
σ=F′A=FAxL
and elongation dδ produced in this differential element is
dδ=FYALxdx
Thus, total elongation is
δ=FYAL∫l0xdx=FYAL[x22]l0
orδ=12FlYA