I have to prove the following statement, but I am unsure of my solution:
If $f \in L^p(\mathbb{R}^n)$, then $f$ is locally integrable for $p \geq 1$.
The definition of $f$ locally integrable is that $f$ is integrable on each compact set $K \subseteq \mathbb{R}^n$. In other words
$$\int_K|f| d \mu < \infty$$
Since $f \in L^p(\mathbb{R}^n)$,
$$||f||_p=\left| \int_{\mathbb{R}^n} |f|^p d\mu \right|^{1/p} < \infty \Rightarrow\int_{\mathbb{R}^n} |f|^p d\mu < \infty$$
$|f|^p$ is integrable iff $|f|^p\neq \infty$ almost everywhere. Therefore, $|f| \neq \infty$ almost everywhere, and
$$\int_{\mathbb{R}^n} |f| d\mu < \infty$$
Finally, for all $K \subset \mathbb{R}^n \to \mu(K) \leq \mu(\mathbb{R}^n)$ and
$$\int_K|f| d\mu \leq \int_{\mathbb{R}^n} |f| d\mu< \infty$$
I think my solution is wrong since I never used the compactness of $K$.
It is not correct.
First of all, it is recommended to write $|f|<\infty$ a.e. instead of $|f|\ne\infty$ since $0\leq|f|\leq\infty$.
And you can write $\displaystyle\int_{K}|f|d\mu\leq\int_{\mathbb{R}^{n}}|f|d\mu$ but this has nothing to do with $\mu(K)\leq\mu(\mathbb{R}^{n})$, the proper reasoning is just $|f|\chi_{K}\leq|f|$.
But it is not known whether $\displaystyle\int_{\mathbb{R}^{n}}|f|d\mu<\infty$. So it could end up with $\displaystyle\int_{K}|f|d\mu\leq\int_{\mathbb{R}^{n}}|f|d\mu=\infty$, so it is not conclusive to prove in this way.
You need Holder:
\begin{align*} \int_{K}|f|=\int\chi_{K}|f|\leq\|f\|_{L^{p}}\|\chi_{K}\|_{L^{q}} \end{align*} for $1/p+1/q=1$.