Let $S$ be a compact subset of the open first quadrant of the plane. Show that there is point $p_0=(x_0,y_0)$ in $S$ such that the ray connecting it to the origin has the maximum slope. Is this true if $S$ is only closed?
Let $f: S \rightarrow \mathbb{R}$ be such that $f(p)=\frac{y}{x}=\tan \alpha$ where $p=(x,y)$ and $\alpha$ is slope. This function is continuous on $S$ and since $S$ is compact it attains maximum. So the first part is proved.
The closedness is not enough, consider graph of a function $g: (0,\infty)\rightarrow \mathbb{R}$ given by $g(x)=e^x$.
Is this correct or am I missing sth?
You're correct that closedness itself is not enough. An easy counterexample is the closed set $$ K = \{(x,y): x = 1, y \geq 1\}.$$ The slope of the ray connecting any $(x_0, y_0) \in K$ to the origin has slope $\frac{y_0 - 0}{x_0 - 0} = \frac{y_0}{1} = y_0$, which is unbounded in $K$.