Hartshorne's Exercise II.5.1 - Projection formula I'm trying to solve Exercise 5.1 of Chapter II of Hartshorne - Algebraic Geometry.
I'm fine with the first $3$ parts, but I'm having troubles with the very last part, which asks to prove the projection formula:

Let $f:X\to Y$ be a morphism of ringed spaces, $\mathscr{F}$ an $\mathcal{O}_X$-module and $\mathcal{E}$ a locally free $\mathcal{O}_Y$-module of finite rank. Then there is a natural isomorphism
  $$ f_*(\mathscr{F}\otimes f^*\mathcal{E}) \;\cong\; f_*(\mathscr{F})\otimes \mathcal{E} $$

After thinking quite a long time about it, I checked on the internet and I found the following solution:

$$
\begin{eqnarray} 
f_*(\mathscr{F}\otimes f^*\mathcal{E}) 
&\;\cong\;& f_*(\mathscr{F}\otimes \mathcal{O}_X^{\,n}) \\\\
&\;\cong\;& f_*(\mathscr{F}\otimes \mathcal{O}_X)^{n} \\\\ 
&\;\cong\;& f_*(\mathscr{F})^{n} \\\\ 
&\;\cong\;& f_*(\mathscr{F})\otimes \mathcal{O}_Y^{\,n} \\\\ 
&\;\cong\;& f_*(\mathscr{F})\otimes \mathcal{E} \\\\ 
\end{eqnarray}
$$

Is this correct? If it is, could you explain me why do we have the isomorphism
$$ f_*(\mathscr{F}\otimes \mathcal{O}_X^{\,n})
\;\cong\; f_*(\mathscr{F}\otimes \mathcal{O}_X)^{n} \quad ?  $$
 A: As said by Martin, first you have to find a morphism between the two sheaves, then you can use that solution locally. So, here is the morphism.
Consider on $Y$ the presheaf $P$ with sections $V\mapsto \mathscr{F}(f^{-1}(V))\otimes\mathcal{E}(V)$ for all $V\subseteq Y$ open. The sheafification of $P$ is $f_*(\mathscr{F})\otimes\mathcal{E}$.
Similarly, consider $P'$ the presheaf on $X$ with sections $U\mapsto\mathscr{F}(U)\otimes f^*\mathcal{E}(U)$. The sheafification of $P'$ is $\mathscr{F}\otimes f^*\mathcal{E}$.
Now, for all open $V\subseteq Y$, we have a moprhism $\mathcal{E}(V)\to f^*\mathcal{E}(f^{-1}(V))$, this gives a morphism
$$P(V)=\mathscr{F}(f^{-1}(V))\otimes\mathcal{E}(V)\to\mathscr{F}(f^{-1}(V))\otimes f^*\mathcal{E}(f^{-1}(V))=f_*P'(V)$$
Hence I have a natural morphism $\phi:P\to f_*P'$. Now, I have the sheafication morphism $P'\to P'^{sh}=\mathscr{F}\otimes f^*\mathcal{E}$, hence a morphism $f_*P'\to f_*(\mathscr{F}\otimes f^*\mathcal{E})$ that, composed with $\phi$, gives a natural morphism $P\to f_*(\mathscr{F}\otimes f^*\mathcal{E})$. Finally, passing to the sheafification of $P$, I get a morphism
$$\psi:f_*(\mathscr{F})\otimes\mathcal{E}\to f_*(\mathscr{F}\otimes f^*\mathcal{E})$$
What a mess! Fortunately, when we restrict to an open set where $\mathcal{E}$ is free, everything looks nicer.
So, restrict to an open set $W\subseteq Y$ where $\mathcal{E}$ is free. Now, $\mathcal{E}$ and $f^*\mathcal{E}$ are free, hence you can easily check that $P$ and $P'$ are already sheaves, so $\psi=\phi=\operatorname{id}\otimes\gamma$ where we have $\gamma:\mathcal{E}\to f_*f^*\mathcal{E}$. But, for $\mathcal{E}$ free, you can easily check that this is an isomorphism.
p.s: the passage in the proof you have found not clear maybe it's simpler if viewed in this way: $f_*(\mathscr{F}\otimes \mathcal{O}_X^{\,n})\;\cong\; f_*(\mathscr{F}^{n})\cong f_*(\mathscr{F})^n$, and you can "take the $n$ out" just applying the definition of $f_*$.
A: Consider the morphism 
$$
 f^*(f_* \mathscr{F} \otimes_{\mathscr{O}_Y} \mathscr{E}) \simeq f^* f_* \mathscr{F} \otimes_{\mathscr{O}_X} f^* \mathscr{E} \to \mathscr{F} \otimes_{\mathscr{O}_X} f^* \mathscr{E}
$$
obtained by tensoring the morphism $f^* f_* \mathscr{F} \to \mathscr{F}$ with $f^* \mathscr{E}$ over $\mathscr{O}_X$. By the push-pull adjunction, this corresponds to a morphism 
$$
 f_* \mathscr{F} \otimes_{\mathscr{O}_Y} \mathscr{E} \to f_*(\mathscr{F} \otimes_{\mathscr{O}_X} f^* \mathscr{E}). 
$$
Note that it is defined by "doing nothing to sections", e.g. if $U \subseteq X$ is an open subset, $s \in \mathscr F(f^{-1}(U))$ and $t \in \mathscr E(U)$, then the morphism of presheaves associated to the tensor product sends $s \otimes t$ to the section $s \otimes (1 \otimes [(U,t)])$ of $\mathscr F \otimes_{\mathscr O_X} f^* \mathscr E$ over $f^{-1}(U)$  (recall that $f^*\mathscr E = \mathscr O_X \otimes_{f^{-1} \mathscr O_Y} f^{-1} \mathscr E$, hence the direct limit of sheaves notation $[(U,t)]$). If you are curious as to why, look at what the push-pull adjunction does to morphisms and the isomorphism of $f^*$ commuting with tensor products. 
To check that it is an isomorphism when $\mathscr{E}$ is locally free, we may work locally, which means we may assume $\mathscr{E}$ is free of finite rank. Because both sides commute with direct sums (they are all compositions of additive functors), we may assume $\mathscr{E} = \mathscr{O}_Y$. We have isomorphisms
$$
 f_* \mathscr{F} \otimes_{\mathscr{O}_Y} \mathscr{O}_Y \simeq f_* \mathscr{F} \simeq f_*(\mathscr{F} \otimes_{\mathscr{O}_X} \mathscr{O}_X) \simeq f_* (\mathscr{F} \otimes_{\mathscr{O}_X} f^* \mathscr{O}_Y). 
$$
Since this morphism corresponds to the morphism $f^*(f_* \mathscr{F} \otimes_{\mathscr{O}_Y} \mathscr{O}_Y) \to \mathscr{F} \otimes_{\mathscr{O}_X} f^* \mathscr{O}_Y$ (because it also "does nothing to sections" as above), we see that our morphism is an isomorphism by the pull-push adjunction. 
Hope that helps,
A: $\newcommand{\H}{\operatorname{Hom}{}}$
$\newcommand{\HH}{\mathscr{H}}$
The crucial part is finding a natural morphism $f_*F\otimes E \to f_*(F\otimes f^* E)$, then it's easy to check that affine-locally this is an isomorphism. To find the map we will use $3$ facts (We denote by $\HH$ the Hom sheaf):

  
*
  
*Exercise 5.1.c of [HAG] : 
  $$ \H_X(A\otimes B,\; C) \cong \H_X(A,\; \HH_X(B,C)) $$
  
*Well known adjunction isomorphism :
  $$\H_Y(f_* F,\; E ) \cong \H_X (F,\; f^*E)$$
  
*Identity which follows from the definitions of the $\HH$ sheaf and of pushforward :
  $$f_* \mathscr{H}om_X(A,\;B) \cong \mathscr{H}om_Y(f_* A,\; f_* B)$$

So, the isomorphism we are looking for is an element of $\H_Y(f_*F\otimes E,\; f_*(F\otimes f^* E))$, and using the above facts we find
$$
\begin{eqnarray}
\H_Y(f_*F\otimes E,\; f_*(F\otimes f^* E)) &\overset{(1)}\cong& 
\H_Y(E,\; \HH_Y(f_*F,\;f_*(F\otimes f^* E))) \\
&\overset{(3)}\cong&
\H_Y(E,\; f_*\HH_X(F,\;(F\otimes f^* E))) \\
&\overset{(2)}\cong&
\H_X(f^*E,\; \HH_X(F,\;(F\otimes f^* E))) \\
&\overset{(1)}\cong&
\H_X(F \otimes f^*E,\; F\otimes f^* E)
\end{eqnarray}
$$
Therefore the identity does the job and we get the natural map we desired. 
To conclude, we just need to show that, in fact, this is an isomorphism. Since all the functors involved commute with open restrictions, we can reduce to the affine case and assume $E$ is free. One can check that the above global map agrees with the chain of isomorphisms
\begin{eqnarray*}
 f_*(F\otimes f^*E) 
 &\;\cong\;& f_*(F\otimes \mathcal{O}_X^{\,n}) \\
 &\;\cong\;& f_*(F\otimes \mathcal{O}_X)^{n} \\ 
 &\;\cong\;& f_*(F)^{n} \\
 &\;\cong\;& f_*(F)\otimes \mathcal{O}_Y^{\,n} \\
 &\;\cong\;& f_*(F)\otimes E
\end{eqnarray*}
where we used multiple times the fact that the functors involved are additive and thus commute with finite direct sums.
A: The adjunction formula in Hartshorne, and the one I proved myself, is that 
$$ \hom_X(f^*E,F) \simeq \hom_Y(E,f_*F)$$
How does the one used here follow from this one? Is it general non-sense? 
A: Here's the slickest way I know to do this problem. Let $\mathscr{G}$ be any $\mathcal{O}_Y$-module. I will use the following facts in my answer.


*

*Adjointness of $f_\ast$ and $f^\ast$.

*Tensor-Hom adjunction

*Part (b) of exercise 5.1.

*Tensor product commutes with pullback.
In view of these, we have
$$\begin{eqnarray*} \operatorname{Hom}_Y(f_\ast(\mathscr{F} \otimes_{\mathcal{O}_X} f^\ast \mathcal{E}),\mathscr{G}) &\stackrel{(1)}{=}& \operatorname{Hom}_X(\mathscr{F} \otimes_{\mathcal{O}_X} f^\ast \mathcal{E},f^\ast \mathscr{G}) \\
&\stackrel{(2)}{=}& \operatorname{Hom}_X(\mathscr{F},\mathscr{H}om_{\mathcal{O}_X}(f^\ast \mathcal{E},f^\ast \mathscr{G})) \\
&\stackrel{(3)}{=}& \operatorname{Hom}_X(\mathscr{F},(f^\ast \mathcal{E})^\vee \otimes_{\mathcal{O}_X} f^\ast \mathscr{G}) \\
&\stackrel{(4)}{=}&\operatorname{Hom}_X(\mathscr{F},f^\ast (\mathcal{E}^\vee )\otimes_{\mathcal{O}_X} f^\ast \mathscr{G}) \\
&\stackrel{(4)}{=}& \operatorname{Hom}_X(\mathscr{F},f^\ast (\mathcal{E}^\vee \otimes_{\mathcal{O}_Y} \mathscr{G}) ) \\
&\stackrel{(1)}{=}&  \operatorname{Hom}_Y(f_\ast\mathscr{F},\mathcal{E}^\vee \otimes_{\mathcal{O}_Y} \mathscr{G} ) \\
&\stackrel{(3)}{=}&\operatorname{Hom}_Y(f_\ast\mathscr{F},\mathscr{H}om_{\mathcal{O}_Y}(\mathcal{E},\mathscr{G}))\\
&\stackrel{(2)}{=}& \mathrm{Hom}_Y(f_\ast\mathscr{F}\otimes_{\mathcal{O}_Y} \mathcal{E},\mathscr{G})) \end{eqnarray*}$$
and so the Yoneda lemma implies $f_\ast(\mathscr{F} \otimes_{\mathcal{O}_X} f^\ast \mathcal{E}) \cong f_\ast\mathcal{F}\otimes_{\mathcal{O}_Y} \mathcal{E}$.
