The perimeter is the sum of the side lengths.
P = (ax +9) + (ax +9) +(4x +b)
P = (2a+4)x +(18+b)
You are told that this is equivalent to 20x+35. Comparing coefficients, we have
20 = 2a+4
35 = 18+b
The first equation can be solved for "a" to get
(20-4)/2 = a = 8
And the second equation can be solved for "b" to get
35-18 = b = 17