Hi Minecraftwarrior,
This question isn't too bad if you recall that the "perimeter" is just a fancy way of saying "how far is it around". If the perimeters of the triangle and the square are the same, then if you add up the length of the three sides of the triangle and the four sides of the rectangle they should add up to the same number.
So...
(x + 5) = (x + 6) + (x + 7) = perimeter of the triangle
(x + 7) + (x +7) + (2x - 1) + (2x - 1) = perimeter of the rectangle
Remember that the opposite sides of the rectangle are the same length, so you simply double them (it would be easier to just multiply by 2, but I wrote it out long hand to make it clearer).
(x + 5) = (x + 6) + (x + 7) = (x + 7) + (x +7) + (2x - 1) + (2x - 1)
It looks pretty messy, but don't get scared -- just simplify each of the expressions:
(x + x + x) + (5 + 6 + 7) = (x + x + 2x + 2x) + (7 + 7 - 1 - 1)
3x + 18 = 6x + 12
3x + (18 - 12) = 6x
3x + 6 = 6x
6 = 6x - 3x
6 = 3x
2 = x
Now, go back and check your work:
(x + 5) = (x + 6) + (x + 7) = (2 + 5) + (2 + 6) + (2 + 7)
7 + 8 + 9 = 24
(x + 7) + (x +7) + (2x - 1) + (2x - 1) = (2 + 7) + (2 + 7) + (4 - 1) + (4 - 1)
9 + 9 + 3 + 3 = 24
So, x = 2.