The perimeter of any shape is a measure of the length of the peripheral of that shape.
For a triangle, it is an addition of the length of the 3 sides.
P = a + b + c where a, b, c are the lengths of the individual sides.
p = 10x + 5y = (3x + 4y) + (5x - y) + c
Collecting like terms on the RHS, we have
p = 10x + 5y = 8x + 3y + c
Subtracting 8x + 3y from both sides to give c leaves us with
10x + 5y - (8x + 3y) = c
c = 10x - 8x + 5y - 3y
c = 2x + 2y