Perimeter is the sum of all three sides so in this case x+(3x+2)+(3x+2).
They also gave us the perimeter which is 39 so
39= x+(3x+2)+(3x+2)
Simplify so 39=7x+4. [x+3x+3x=7x and 2+2=4]
Then get x by itself so subtract 4 from both sides.
35=7x
Then divide both sides by 7 to get x by itself.
Which leaves us with
X=5