Thread: Function with open set properties

1. Function with open set properties

Suppose $f: \mathbb{R}^{n} \to \mathbb{R}^{k}$ has the following property: For any open set $U \subset \mathbb{R}^{k}$, $S = \{x : f(x)\in U\}$ is an open set in $\mathbb{R}^{n}$. Show that $f$ is continuous.

I am completely stuck on this. I know that there is a connection between the $\epsilon - \delta$ definition of continuity and how if $S$ is an open set, then given $y\in S$, there exists $r>0$ such that $|x - y | < r \implies x\in S$ but I am missing the connection and can't really formalize any sort of proof. Thanks in advance.

2. The balls B(x,r)={y : |x-y|<r} are open sets.
Given $\epsilon > 0$ and $a\in \mathbb{R}^{n}$, let $U=B(\epsilon , f(a))$, which is clearly an open set $\{y : |y - f(a)| < \epsilon \}$. Since $f(a)\in U$, we have that $a\in S = \{x : f(x)\in U\}$. So $a$ is an interior point of $S$, which means there exists $\delta > 0$ such that $|x - a|< \delta$ implies $x\in S$, which in turn implies $f(x)\in U$. Since $f(x)\in U$ implies $|f(x)-f(a)|<\epsilon$, we have that given $\epsilon > 0$, there exists $\delta > 0$ such that $|x - a| < \delta$ implies $|f(x) - f(a)| < \epsilon$, which means $f$ is continuous at $a$. Since $a$ was arbitrary, we have that $f$ is continuous on $\mathbb{R}^{n}$. Q.E.D.
Given $\epsilon > 0$ and $a\in \mathbb{R}^{n}$, let $U=B(\epsilon , f(a))$, which is clearly an open set $\{y : |y - f(a)| < \epsilon \}$. Since $f(a)\in U$, we have that $a\in S = \{x : f(x)\in U\}$. So $a$ is an interior point of $S$, which means there exists $\delta > 0$ such that $|x - a|< \delta$ implies $x\in S$, which in turn implies $f(x)\in U$. Since $f(x)\in U$ implies $|f(x)-f(a)|<\epsilon$, we have that given $\epsilon > 0$, there exists $\delta > 0$ such that $|x - a| < \delta$ implies $|f(x) - f(a)| < \epsilon$, which means $f$ is continuous at $a$. Since $a$ was arbitrary, we have that $f$ is continuous on $\mathbb{R}^{n}$. Q.E.D.