Consider a $C^1$ function $f:\mathbb{R}^n\to\mathbb{R}$ and a point $y\in \mathbb{R}^n$ such that $\nabla f(y)\neq 0$. Prove that there exists an unit vector $x_0\in\mathbb{R}^n$ such that $$\sup\big\{|f'(y)v|;\, v\in\mathbb{R}^n\text{ and }\|v\|=1\big\}=|f'(y)x_0|=\|\nabla f(y)\|.\tag{A}$$ Moreover, there are only two possibilities for $x_0$: $$x_0=\frac{\nabla f(y)}{\|\nabla f(y)\|}\qquad \text{ or }\qquad x_0=-\frac{\nabla f(y)}{\|\nabla f(y)\|}.\tag{B}$$
Possible solution for the first part:
Since the mapping $g:\mathbb{R}^n\to\mathbb{R}$ given by $g(v)=|f'(y)v|$ is continuous and the sphere $S=\{v\in\mathbb{R}^n;\,\|v\|=1\}$ is compact, there exists an unit vector $x_0$ such that
$$|f'(y)x_0|=g(x_0)=\max\big\{g(v);\,v\in S\big\}=\sup\big\{|f'(y)v|;\, v\in\mathbb{R}^n\text{ and }\|v\|=1\big\}.\tag{1}$$
Let $u=\frac{\nabla f(y)}{\|\nabla f(y)\|}$. Then, from $(1)$,
$$|f'(y)x_0|\geq |f'(y)u|=\langle\nabla f(y),u\rangle=\|\nabla f(y)\|.\tag{2}$$
On the other hand, by Cauchy-Schwarz inequality,
$$|f'(y)x_0|= \langle\nabla f(y),x_0\rangle\leq \|\nabla f(y)\|.\tag{3}$$
From $(1)$-$(3)$ we get $(A)$.
I'd like to know if the solution above is ok and how to get $(B)$.
Thanks.
This has nothing to do with $f$ as such.
You want to compute $\max \{ | u^T x | | \|x\| = 1 \}$. A maximiser exists because the boundary of the unit ball is compact and $x \mapsto | u^T x|$ is continuous.
Cauchy Schwarz gives $| u^T x | \le \|u\|$, and substitution shows that $x={1 \over \|u\|} u$ attains this bound.
All that remains is to show uniqueness. Suppose $| u^T x | =\|u\|$ for some unit length $\|x\|$. We can write $x = \lambda {1 \over \|u\|} u + w$, where $w \bot u$. It is easy to see that $\lambda^2+\|w\|^2 = 1$, and $|u^T x| = |\lambda| \|u\|$, hence we must have $|\lambda| = 1$.
It follows that the maximising $x$ has the form $\pm {1 \over \|u\|} u$.