  In this work we start by determining all irreducible spherical functions
$\Phi$ of any $K $-type associated to the pair $(G,K)=(\SO(4),\SO(3))$. The
functions $P=P(u)$ corresponding to the irreducible spherical functions of a
fixed $K$-type $\pi_\ell$ are appropriately packaged into a sequence of matrix
valued polynomials $(P_w)_{w\ge0}$ of size $(\ell+1)\times(\ell+1)$. Finally we
prove that $\widetilde P_w={P_0}^{-1}P_w$ is a sequence of matrix orthogonal
polynomials with respect to a weight matrix $W$. Moreover, we show that $W$
admits a second order symmetric hypergeometric operator $\widetilde D$ and a
first order symmetric differential operator $\widetilde E$.
  Later, we establish a direct relationship between the spherical functions of
the $n$-dimensional sphere $S^n\simeq\SO(n+1)/\SO(n)$ and the spherical
functions of the $n$-dimensional real projective space
$P^n(\mathbb{R})\simeq\SO(n+1)/\mathrm{O}(n)$. Concluding that to find all the
spherical functions of one of these pairs is equivalent to do the same it with
the other.
  Finally, we study the spherical functions of certain types of the
$n$-dimensional sphere $S^{n}\simeq \SO(n+1)/\SO(n)$, for any $n$. More
precisely, we give explicitly all the spherical functions whose associated
functions $H$ are scalar valued, including those of trivial type, and then we
study the irreducible spherical functions of fundamental type, describing them
in terms of matrix valued hypergeometric functions $_2!F_1$. Thereafter, for
every fundamental type we build a sequence of ortogonal matrix valued
polynomials with respect to a weight $W$, which are associated to the spherical
functions. We also prove that, for any $n$, $W$ admits a second order symmetric
differential operator.
