Let us compare 9x2+18x with expansion of (a+b)2.
(a+b)2=a2+2ab+b2
On comparing terms of RHS of above equation and 9x2+18x, it is clear that-
a2=9x2 .... (1)
18x=2ab .... (2)
From (1) a=3x
Substituting value of a in (2),
18x=2×(3x)×b
⇒b=3
Therefore, b2 is the term that needs to be added to it to make it perfect square.
Thus, we need to add 9.
Therefore, if we add 9 to 9x2+18x, it becomes
9x2+18x+9=(3x+3)2
which is a perfect square.