Why is it x and 1-x on both sides.

The triangle inscribed inside the square divides the top side into two parts. So we named the smaller part as x and the remaining side will be 1-x because the length of the side of the square is 1. Similar approach on the other side too.

But how do we know that the triangle is dividing both sides in same proportion i.e it could be 1 and 1-x on one side and 1 and 1-y on the other.

It’s a square so all the sides have an equal length so we’ve taken it as x and 1-x. There’s another approach too for this question. If you’re familiar with trigonometry then this can be solved using trigonometry too.

Using trigonometry @raunaqsingh3199

I see it now . Thank you so much