4. Given $\vec{O} P=(2,1), \vec{O} A=(1,7), \vec{O} B=(5,1)$, let $X$ be a point on the line $O P$ (where $O$ is the origin). Then, the value of $\angle A X B$ when $\vec{X} A \cdot \vec{X} B$ is minimized is ( ).
A. $90^{\circ}$
B. $\operatorname{arccos} \frac{4 \sqrt{17}}{17}$
C. $\operatorname{arccos}\left(\frac{-4 \sqrt{17}}{17}\right)$
D. $\pi-\arccos \frac{4 \sqrt{17}}{17}$
4. C

Let $\vec{O} X=\left(x_{0}, y_{0}\right), \vec{O} P=(2,1)$, then $\frac{x_{0}}{2}=\frac{y_{0}}{1}$, so $x_{0}=2 y_{0}$, then $\vec{X} A=$ $\left(1-2 y_{0}, 7-y_{0}\right), \vec{X} B=\left(5-2 y_{0}, 1-y_{0}\right)$.
Thus, $\vec{X} A \cdot \vec{X} B=\left(5-2 y_{0}\right)\left(1-2 y_{0}\right)+\left(1-y_{0}\right)\left(7-y_{0}\right)=5 y_{0}^{2}-20 y_{0}+12$.
Therefore, when $y_{0}=2$, $\vec{X} A \cdot \vec{X} B$ has its minimum value, at this time, $\vec{O} X=(4,2), \vec{X} A=(-3, 5)$, $\vec{X} B=(1,-1),|\vec{X} A|=\sqrt{34},|\vec{X} B|=\sqrt{2}$,
so $\cos \angle A X B=\frac{\vec{X} A \cdot \vec{X} B}{|\vec{X} A| \cdot|\vec{X} B|}=\frac{(-3,5) \cdot(1,-1)}{\sqrt{34} \cdot \sqrt{2}}=\frac{-8}{\sqrt{68}}=-\frac{4 \sqrt{17}}{17}$.