Answer: \(n=10\), \(a=\dfrac52\), \(b=1024\).
We start with the main method. Use the binomial theorem to identify only the terms needed, rather than expanding the whole expression.
Use the binomial expansion
\(\left(2+\frac{x}{2}\right)^n =2^n+n2^{n-1}\left(\frac{x}{2}\right)+\frac{n(n-1)}{2}2^{n-2}\left(\frac{x}{2}\right)^2+\cdots.\)
The constant term is
\(2^n.\)
Since the first term is \(b\),
\(b=2^n.\)
The coefficient of \(x\) is
\(n2^{n-1}\cdot\frac12=n2^{n-2}.\)
This equals \(ab\). Since \(b=2^n\),
\(a2^n=n2^{n-2}.\)
Therefore
\(a=\frac{n}{4}.\)
The coefficient of \(x^2\) is
\(\frac{n(n-1)}{2}2^{n-2}\cdot\frac14.\)
So it is
\(n(n-1)2^{n-5}.\)
This is given as \(\frac98ab\). Using \(a=\frac n4\) and \(b=2^n\),
\(\frac98ab=\frac98\cdot\frac n4\cdot2^n=9n2^{n-5}.\)
Equating the two expressions for the coefficient of \(x^2\),
\(n(n-1)2^{n-5}=9n2^{n-5}.\)
Since \(n\ne0\), divide by \(n2^{n-5}\):
\(n-1=9.\)
Hence \(n=10\).
Then
\(a=\frac{10}{4}=\frac52\)
and
\(b=2^{10}=1024.\)
This completes the solution and gives the required result.