  Let $H$ be a Hilbert space and $H_1,...,H_n$ be closed subspaces of $H$. Set
$H_0:=H_1\cap H_2\cap...\cap H_n$ and let $P_k$ be the orthogonal projection
onto $H_k$, $k=0,1,...,n$. The paper is devoted to the study of functions
$f_n:[0,1]\to\mathbb{R}$ defined by $$ f_n(c)=\sup\{\|P_n...P_2
P_1-P_0\|\,|c_F(H_1,...,H_n)\leqslant c\},\,c\in[0,1], $$ where the supremum is
taken over all systems of subspaces $H_1,...,H_n$ for which the Friedrichs
number $c_F(H_1,...,H_n)$ is less than or equal to $c$. Using the functions
$f_n$ one can easily get an upper bound for the rate of convergence in the
method of cyclic alternating projections. We will show that the problem of
finding $f_n(c)$ is equivalent to a certain optimization problem on a subset of
the set of Hermitian complex $n\times n$ matrices. Using the equivalence we
find $f_3$ and study properties of $f_n$, $n\geqslant 4$. Moreover, we show
that $$ 1-a_n(1-c)-\widetilde{b}_n(1-c)^2\leqslant f_n(c)\leqslant
1-a_n(1-c)+b_n(1-c)^2 $$ for all $c\in[0,1]$, where
$a_n=2(n-1)\sin^2(\pi/(2n))$, $b_n=6(n-1)^2\sin^4(\pi/(2n))$ and
$\widetilde{b}_n$ is some positive number.
