Let the tap of smaller diameter fill the tank in $x$ hours.
$\therefore$ Time taken by the tap of larger diameter to fill the tank $=(x-9) h$
Suppose the volume of the tank be $V$.
Volume of the tank filled by the tap of smaller diameter in $x$ hours $=V$
$\therefore$ Volume of the tank filled by the tap of smaller diameter in 1 hour $=\frac{V}{x}$
$\Rightarrow$ Volume of the tank filled by the tap of smaller diameter in 6 hours $=\frac{V}{x} \times 6$
Similarly,
Volume of the tank filled by the tap of larger diameter in 6 hours $=\frac{V}{(x-9)} \times 6$
Now,
Volume of the tank filled by the tap of smaller diameter in 6 hours +
Volume of the tank filled by the tap of larger diameter in 6 hours $=V$
$\begin{array}{l}
\therefore V\left(\frac{1}{x}+\frac{1}{x-9}\right) \times 6=V \\
\Rightarrow \frac{1}{x}+\frac{1}{x-9}=\frac{1}{6} \\
\Rightarrow \frac{x-9+x}{x(x-9)}=\frac{1}{6} \\
\Rightarrow \frac{2 x-9}{x^{2}-9 x}=\frac{1}{6} \\
\Rightarrow 12 x-54=x^{2}-9 x \\
\Rightarrow x^{2}-21 x+54=0 \\
\Rightarrow x^{2}-81 x-3 x+54=0 \\
\Rightarrow x(x-18)-3(x-18)=0 \\
\Rightarrow(x-18)(x-3)=0 \\
\Rightarrow x-18=0 \text { or } x-3=0 \\
\Rightarrow x=18 \text { or } x=3
\end{array}$
For $x=3$, time taken by the tap of larger diameter to fill the tank is negative which is not possible.
$\therefore x=18$
Time taken by the tap of smaller diameter to fill the tank $=18 \mathrm{~h}$
Time taken by the tap of larger diameter to fill the tank $=(18-9)=9 h$
Hence, the time taken by the taps of smaller and larger diameter to fill the tank is 18 hours, and 9 hours, respectively.