

When you get
a = (3q + 2)2
=> a = 9q2 + 12q + 4
=> a = 9q2 + 12q + 3 + 1
=> a = 3(3q2 + 4q + 1) + 1
This is written in this form because we have to prove that square of all positive integers are either in the form of 3m or 3(m) + 1.
Here, we suppose m = 3q2 + 4q + 1
So a = 3m + 1.
Hope you understand now.
