Orthogonal Projection onto a Subspace

How to find the orthogonal projection of a vector y onto a subspace W? A popular method is to use an orthogonal basis in W. Then, the output is the sum of the orthogonal projections of y onto the coordinate axes. This applet also illustrates the formula for the Fourier coefficients, see the projections of y on the coordinate axes. Remark: This is a modified version of the applet https://www.geogebra.org/m/zxxfqa4t by Trefor Bazett