Continuous function on closed unit ball
Solution 1:
Since translations are continuous, we may assume that $B^n$ is the unit ball centred at the origin. Then $$ r(x)=f(x)+\lambda_x\,(x-f(x)), $$ with $\lambda_x\geq0$ such that $$ \|f(x)+\lambda_x\,(x-f(x))\|=1. $$ This equality can be written as $\|f(x)+\lambda_x\,(x-f(x))\|^2=1$, and it expands to $$ \|x-f(x)\|^2\,\lambda_x^2+2\langle f(x),x-f(x)\rangle\,\lambda_x+\|f(x)\|^2-1=0. $$ This is quadratic in $\lambda_x$, and we want the non-negative solution, which is $$ \lambda_x=\frac{-\langle f(x),x-f(x)\rangle+\sqrt{\langle f(x),x-f(x)\rangle^2-\|x-f(x)\|^2(\|f(x)\|^2-1)}}{\|x-f(x)\|^2}. $$ The term inside the square root is always non-negative and bigger than $\langle f(x),x-f(x)\rangle^2$, so $\lambda_x\geq0$.
It is clear that $\lambda_x$ depends continuously on $x$, and so $r(x)$ is continuous.