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