(a)
We will use

formula to expand this.
The formula is

In the question, a is 3x and b is 1
Thus,

(b)
The trick here is to put "31" somehow being into the form (3x+1), so that we can use the formula from part (a).
So, what value in "x" would make (3x+1) into 31?? Simple! x = 10!
How?

So, for x = 10, 3x+1 becomes "31", so 31^2 would be simply putting x = 10 into the answer (expanded) form of part (a).
So,

Part (b) is 961