The perimeter of the rectangle:
![P_R=2(4x+2+2x)=2(6x+2)=(2)(6x)+(2)(2)=12x+4](https://img.qammunity.org/2019/formulas/mathematics/middle-school/ijrixvjhxuu8hg5xoorcprwi7uwaqeew3z.png)
The perimeter of the square:
![P_S=2(5x-3+3x+1)=2(8x-2)=(2)(8x)+(2)(-2)=16x-4](https://img.qammunity.org/2019/formulas/mathematics/middle-school/ckl3mi5k2ua0dw8pl0ourkmcaefy5ht30o.png)
The perimeter of the rectangle is equal to the perimeter of the square. We have the equation:
![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](https://img.qammunity.org/2019/formulas/mathematics/middle-school/cu99bf8oxoug14bjilk6tyg09qubgmrhv0.png)
The side lengths of the square:
![5x-3\to5(2)-3=10-3=7](https://img.qammunity.org/2019/formulas/mathematics/middle-school/lbvqirjlwpjaaj1m5nkbfi4u8wmbxmnxkc.png)
The side lenghts of the rectangle:
![4x+2\to4(2)+2=8+2=10\\2x\to2(2)=4](https://img.qammunity.org/2019/formulas/mathematics/middle-school/lxfrezy67lrtqzsd9cmd8hy8yjmzsyltsu.png)
Other method.
If the first figure is a square, then the length of the sides are equal.
Therefore
![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](https://img.qammunity.org/2019/formulas/mathematics/middle-school/p11pho03s3xckgk8psxtuk1hmk7zn47ijh.png)
Further part of the solution as above.