You have that the perimeter of the rectangle is given by the following formula:
l: length of the rectangle
w: width of the rectangle
Then, you replace the pevious expression for l and w in the formula for the perimeter, just as follow:
Hence, the perimeter of the rectangle is P = 4x2 - 8x + 6