geometry – How can the area of a rectangle having base $x$ inscribed in a fixed circle of radius $a$ be expressed as a function of $x$?

We are given a circle of radius $a$, and a rectangle of base $x$ is inscribed in that circle.

How to express the area of that rectangle as a function of $x$?

My Attempt:

The centroid of the rectangle (i.e. the point of intersection of the two diagonals) is the center of the circle. So each one of the two diagonals has length $2a$, which implies that the height of the rectangle is $sqrt{ 4a^2 – x^2}$, and therefore the area is given by
$$
A(x) = x sqrt{ 4a^2 – x^2}.
$$

Is this formula correct? If so, have I applied correct logic in reaching this formula? Or, have I made a mistake somewhere?