The given pentagon can be divided into two figures : a triangle and rectangle as shown in figure.
Let us find area of each figure separately.
Triangle:
Area of triangle is given by:

where b=base and h=height
Height of triangle :
h=(3x+5)-(2x+1)
h=x+4
Base = 2x-2

Area of triangle= (x-1)(x+4) = x²+3x-4
Area of rectangle:
Area of rectangle is given by:
A=l*b

Area of rectangle = 4x²-2x-2
Area of pentagon = Area of triangle + Area of rectangle
Area of pentagon = x²+3x-4 + 4x²-2x-2
Area of pentagon = 5x²+x-6
If area of pentagon is 42 cm², then solving for x,


Factorising to get x,
x=-3.2 and x=3
If we take x as negative the side will be negative, so we neglect x=-3.2
So x=3 is the answer.