Correct answer should be option D.
As we know in packet switching- dividing message into packets decrease the
transmission time due to pipelined transmission.
but if there are many packets beyond some threshold then transmission time may
increase. So, we can do by option checking
1. packet size $=4 =\text{ packet data + header size}= 1+3$
So no. of packets will be $=\dfrac{\text{message}}{\text{packet data}}$
$=\dfrac{24\ B}{1\ B} = 24\text{ packets}$.
So, time to reach at receiver for $1^{st}$ packet will be,
$=3 \text{ (source + two intermediate node)}\times \text{transmission time}$
$TT=\dfrac{L}{BW}$... Here, $L$ will be changed according to option and $BW$ will remain same ..
So time to reach at receiver for $1^{st}$ packet will be $=\dfrac{3\times 4}{BW}=\dfrac{12}{BW}$
and for remaining $23$ packets will take time $=23\times TT=\dfrac{23\times 4}{BW}=\dfrac{92}{BW}$
TOTAL TIME $=\dfrac{104}{BW}$
2. packet size $= 6 = 3+3\text{ ( packet data + header size)}$ so no of packets will be $8$.
Time to reach at receiver for $1^{st}$ packet will be $=\dfrac{3\times 6}{BW}=\dfrac{18}{BW}$
and for remaining $7$ packet will take time $=\dfrac{7\times 6}{BW}=\dfrac{42}{BW}$
Total time $=\dfrac{60}{BW}$
3. packet size $= 7 = 4+3,$ so no of packets $=\dfrac{24}{4}=6\text{ packets}$
For $1^{st}$ packet time will be $=\dfrac{3\times 7}{BW}=\dfrac{21}{BW}$
For remaining $5$ packet will take time $=\dfrac{5\times 7}{BW}=\dfrac{35}{BW}$
Total time$=\dfrac{56}{BW}$.
4. packet size $=9=6+3,$ so no of packet will be $4.$
For $1^{st}$ packet time will be $=\dfrac{3\times 9}{BW}=\dfrac{27}{BW}$
For remaining $3$ packets will take time $=\dfrac{3\times 9}{BW}=\dfrac{27}{BW}$
TOTAL time $=\dfrac{54}{BW}$
So, optimal packet size will be $9\text{ byte}$ due to less total transmission time.
Alternate method (thanks to sachin )
In that case we can do it using minimisation of a variable.
Let, $24\text{ byte}$ data is divided into number of packets each have $x\text{ bytes}$ of data.
Therefore, packet size $=x+3,$ and Number of packets $(k)=\dfrac{24}{x}$.
(it is ceil, if $24$ is not multiple of $x$ )
Total time =$3(x+3)+ (k-1)(x+3)$ (assumed $BW =1,$ just to avoid writing ‘$\text{BW}$’ again and again)
(ignoring propagation delay as it has nothing to do with packet size, if one wish he/she can add that too but later he will realize it will anyway become zero while differentiating. )
$\Rightarrow$ Total time $=2x+3k+kx+6$ ( $k$ is equal to $\text{24}/{x}$ )
$\Rightarrow$ Total time $= 2x+\left(\dfrac{3\times 24}{x}\right)+\left(\dfrac{24*x}{ x}\right)+6$
$\Rightarrow$ Total time $=2x+\frac{72}{x}+30$
to minimise this time, differentiation should give $0.$
that gives, $2−\dfrac{72}{x^{2}} = 0$
$\Rightarrow x=6$.
including $3\text{ bytes}$ of header, packet size $=9\text{ Bytes}$.
Option is D.