I'm having some trouble proving the first part of Exercise IV.2.6 in Hartshorne's Algebraic Geometry. In particular, it wants me to prove that for any divisor $D$ on a curve (nonsingular, proper, etc.) $X$, $$\det (f_* \mathcal{L} (D)) \cong \det (f_* \mathcal{O}_X) \otimes \mathcal{L}(f_*D),$$ where $f_* (\sum n_ip_i) = \sum n_i f(p_i)$. My attempt is to follow the hint given in the text, namely consider first an effective divisor $D$, and the short exact sequence $$0 \to \mathcal{L}(-D) \to \mathcal{O}_X \to \mathcal{O}_D \to 0.$$ We can check that the direct image of sheaves is an exact functor, so applying $f_*$ and using exercise II.6.11b gives that $\det f_* \mathcal{O}_D \cong \det f_* \mathcal{O}_X \otimes \det f_* \mathcal{L}(-D)^*.$ Since this is in the Picard group, we can rearrange to obtain $$\det f_* \mathcal{L}(-D) \cong \det f_* \mathcal{O}_X \otimes \det f_* \mathcal{O}_D^*.$$ From here, we notice that $f_* \mathcal{O}_D$ is a locally free sheaf of rank $n$, and we can identify $f_* \mathcal{O}_D \cong \oplus \mathcal{O}_{f_*D},$ which implies (by exercise II.6.11b) that $\det f_* \mathcal{O}_D \cong \mathcal{L}(f_* D)$.
Putting this all together, we get that $$\det f_* \mathcal{L}(-D) \cong \det f_* \mathcal{O}_X \otimes \mathcal{L}(-f_* D)$$ where you can see that there are two extraneous minus signs from what I want to show. From here I'm not sure how to proceed, as this seems contradictory to the statement I'm trying to show.
I tried to look up hints online to see where I went wrong, and I found many people using a short exact sequence for $D = D_1-D_2$ of the form $0 \to \mathcal{L}(D) \to \mathcal{L}(-D_2) \to \mathcal{O}_{D_1} \to 0$, which I am almost completely convinced is wrong, as this exact sequence does reproduce the earlier one when $D_2 =0$.
I'm looking for help completing this problem, either via a good hint or a critique of my attempt.
I have found (with the help of my colleague - thank you, you know who you are) the correct solution. It is written below for posterity.
Since we can write any divisor as the difference of two effective divisors, we can first look at just effective divisors. So let $D$ be effective, and consider the short exact sequence $$0 \to \mathcal{L}(-D) \to \mathcal{O}_X \to \mathcal{O}_D \to 0.$$ Now twist with $\mathcal{L}(D)$ to obtain $$0 \to \mathcal{O}_X \to \mathcal{L}(D) \to \mathcal{O}_D \to 0$$ (note that $\mathcal{O}_D$ is a skyscraper sheaf, so $\mathcal{O}_D \otimes \mathcal{L}(D) = \mathcal{O}_D$).
We can easily check that the direct image functor is exact in this context (higher direct images vanish), so we get another short exact sequence $$0 \to f_* \mathcal{O}_X \to f_* \mathcal{L}(D) \to f_* \mathcal{O}_D \to 0.$$ So by Exercise II.6.11b, we get that $\det f_*\mathcal{O}_D \cong \det (f_*\mathcal{L}(D)) \otimes \det(f_* \mathcal{O}_X)^{-1}.$
We first look at the left-hand side. This can be seen (by definition of $\mathcal{O}_D$ and $f_*$) to be $f_* \mathcal{O}_D \cong \oplus_{i=1}^n \mathcal{O}_{f_* D}$. Also by Exercise II.6.11b, $\det f_*\mathcal{O}_D \cong \mathcal{L}(f_* D)$. So rearranging yields $\det (f_* \mathcal{L}(D)) \cong \det (f_* \mathcal{O}_X) \otimes \mathcal{L}(f_* D)$. Now given a general divisor, write $D = D_1-D_2$ as a difference of effective divisors, and we get the short exact sequence $$0 \to \mathcal{L}(D) \to \mathcal{L}(D_1) \to \mathcal{O}_{D_2} \to 0.$$ As before, apply $f_*$ and follow the same chain of equalities.
We obtain $\det (f_* \mathcal{L}(D)) \cong \det (f_* \mathcal{L}(D_1)) \otimes \mathcal{L}(f_* D_2)$, and using the formula above, we substitute $\det (f_* \mathcal{L}(D_1))$ to obtain the result for a general divisor $D$.