  Let $A= \Lambda \oplus C$ be a trivial extension algebra. The aim of this
paper is to establish formulas for the projective dimension and the injective
dimension for a certain class of $A$-modules which is expressed by using the
derived functors $- \otimes^{\mathbb{L}}_{\Lambda}C$ and
$\mathbb{R}\text{Hom}_{\Lambda}(C, -)$. Consequently, we obtain formulas for
the global dimension of $A$, which gives a modern expression of the classical
formula for the global dimension by Palmer-Roos and L\"ofwall that is written
in complicated classical derived functors.
  The main application of the formulas is to give a necessary and sufficient
condition for $A$ to be an Iwanaga-Gorenstein algebra.
  We also give a description of the kernel $\text{Ker} \varpi$ of the canonical
functor $\varpi: \mathsf{D}^{\mathrm{b}}(\text{mod} \Lambda) \to
\text{Sing}^{\mathbb{Z}} A$ in the case $\text{pd} C < \infty$.
