Start with the length of side 2 and call it "x" (since side 1 is compared to side 2, call side 2 "x" and go from there)
Length of side 1 is 6 cm shorter than side 2, side 2 is "x" (see above), so side 1 = x -6
Length of side 3 is three times the length of side 1, side 1 = x - 6 (see above), so side 3 = 3(x-6)
Distribute the 3 and you get 3x-18 for length of side 3
Now, add all three sides and set equal to the perimeter (31)
x + x -6 + 3x -18 =31
Combine like terms (simplify): 5x -24 = 31
Add 24 to both sides: 5x =55
Divide by 5 to solve for x: x = 11
Side 2: 11 cm
Side 1: (x-6) = 5 cm
Side 3: 3(x-6) = 15 cm
Check: 11 + 5 + 15 = 31