Example 1. An isosceles trapezoid is inscribed in a semicircle with a radius of 1, where the lower base is the diameter of the semicircle. (1) Try to find the functional relationship between its perimeter \( \mathrm{y} \) and the leg length \( \mathrm{x} \), and write down the domain; (2) When the leg length is how much, does the perimeter have a maximum value? (This example is similar to the 1982 Tianjin Junior High School Mathematics Exam)
Solve the projection orbit easily given by
$$
y=-x^{2}+2 x+4 \text {. }
$$

When finding the domain of this polynomial function, the answers are varied: some think it is all real numbers, some believe it is positive real numbers, some think that $x$ must be greater than a certain value but cannot increase indefinitely, and should be less than a certain constant. The teacher seizes this point to guide students to think, and some students cleverly solve this problem using the moving comparison method.
When points $\mathrm{C}$ and $\mathrm{D}$ move on $\overparen{\mathrm{A} B}$, and move to the midpoint $\mathrm{E}$ of $\overparen{\mathrm{A} B}$, they form an isosceles right triangle. At this time, $\mathrm{AE}=\mathrm{BE}=\sqrt{2}$, so $0<x<\sqrt{2}$.
It is easy to know that when $x=1$, the perimeter $y$ has a maximum value of 5,