Concept:
Since both given points lie on the line \(ax+by=1\), substitute them to obtain equations in \(a\) and \(b\).
Step 1: Form equations.
Using \((1,2)\),
\[
a+2b=1
\]
Using \((2,1)\),
\[
2a+b=1
\]
Step 2: Solve for \(a\) and \(b\).
Subtracting,
\[
a-b=0
\]
\[
a=b
\]
Substituting into \(a+2b=1\),
\[
3a=1
\]
\[
a=b=\frac13
\]
Step 3: Calculate \(9(a^2+b^2)\).
\[
9\left(\frac19+\frac19\right)
\]
\[
=9\cdot\frac29
\]
\[
=2
\]