We're looking for factors of 12 and factors of 7. If a,b are the factors of 12 then we can have 1,12 12,1 4,3 3,4 2,6 and 6,2; for 7 we can have 1,7 and 7,1 (call them c,d). The sign in front of 7 is plus, and in front of 31 it's minus. That tells us that the sign inside the brackets after we factorise is - because - times - is +, and - plus - is -. So we play a and b against c and d so that ad+bc=31. We have 6 pairs of factors for 12 but only two pairs for 7. After a bit of experimentation, we can see that the correct combination is 4*7+3*1=31. The factors therefore are (4x-1)(3x-7).