Thereafter we call $x$ the volume $(mL)$ of $HCl$ already added.
$c_B$ = $\frac{c_{Α}V_{Α}}{V_B}$ = $\frac{0.05\cdot 0.040}{0.020}=$ = $0.10 \frac{mol}{L}$
1.
The weak base $NH_3$ is present alone. its concentration is $c_B=0.10 \;M$ Weak base! $pH$ $=$ $14-\frac{1}{2}pK_b$ $+$ $\frac{1}{2}logc_B$ = $14$ $-$ $\frac{1}{2}4.80$ $+$ $\frac{1}{2}log0.1$ $pH$ $=$ $11.10$
2.
(For simplicity. we consider before the substances first as if they were not dissociated)
Buffer! $pH$ = $pK_a$ $+$ $log( \frac{n_{NH_3}}{n_{NH_4Cl}})$ = $9.20$ $+$ $log( \frac{0.1\cdot20\cdot 10^{-3}-0.05\cdot x\cdot10^{-3}}{0.05\cdot x\cdot10^{-3}})$ $pH$ $ =$ $ 9.20$ $+$ $log( \frac{2.00-0.05\cdot x}{0.05\cdot x})$
3.
$HCl$ and $NH_3$ reacted completely. remains a solution of the weak acid $NH_4^+$: Weak acid! $pH$ $ = $ $\frac{1}{2}pK_a$ $-$ $\frac{1}{2}log (c_{NH_4Cl})$ = $\frac{1}{2}9.20$ $-$ $\frac{1}{2}log (\frac{0.1\cdot20\cdot 10^{-3}}{(20+40)\cdot 10^{-3}})$ $pH = 5.34$
4.
The weak acid is neglected! Strong acid! $c_{HCl}$ $\frac{n_{HCl}}{(V_B+x)10^{-3}}$ = $\frac{0.05\cdot x\cdot10^{-3}-0.1\cdot20\cdot10^{-3}}{(20+x)10^{-3}}$ = $\frac{0.05\cdot x-2}{20+x}$ $pH$ $=$ $-log( \frac{0.05\cdot x-2}{20+x})$
→ Here you find simulations of such titrations