Please help me with this

The perimeter of the rectangle:
[tex]P_R=2(4x+2+2x)=2(6x+2)=(2)(6x)+(2)(2)=12x+4[/tex]
The perimeter of the square:
[tex]P_S=2(5x-3+3x+1)=2(8x-2)=(2)(8x)+(2)(-2)=16x-4[/tex]
The perimeter of the rectangle is equal to the perimeter of the square. We have the equation:
[tex]12x+4=16x-4\qquad|\text{subtract 4 from both sides}\\\\12x=16x-8\qquad|\text{subtract 16x from both sides}\\\\-4x=-8\qquad|\text{divide both sides by (-4)}\\\\x=2[/tex]
The side lengths of the square:
[tex]5x-3\to5(2)-3=10-3=7[/tex]
The side lenghts of the rectangle:
[tex]4x+2\to4(2)+2=8+2=10\\2x\to2(2)=4[/tex]
Other method.
If the first figure is a square, then the length of the sides are equal.
Therefore
[tex]5x-3=3x+1\qquad|\text{add 3 to both sides}\\\\5x=3x+4\qquad|\text{subtract 3x from both sides}\\\\2x=4\qquad|\text{divide both sides by 2}\\\\x=2[/tex]
Further part of the solution as above.