# Let $f : (X, A) → (Y, B)$ be a map such that both $f : X → Y$ and $f : A → B$ are homotopy equivalences.

Let $$f : (X, A) → (Y, B)$$ be a map such that both $$f : X → Y$$ and $$f : A → B$$ are homotopy equivalences. Show that $$f_∗ : H_n(X, A) → H_n(Y, B)$$ is an isomorphism for all $$n$$.

I know that there is a function $$g:Y\to X, g:B\to A$$ such that $$fg\simeq Id_Y, gf\simeq Id_X$$ and that $$fg\simeq Id_B$$ and $$gf\simeq Id_A$$. Is it true $$g:(Y,B)\to (X,A)$$ is the homotopic inverse of $$f:(X,A)\to (Y,B)$$? Thanks!

It is not necessarily true that $$f$$ is a homotopy equivalence of pairs--the homotopy $$fg\simeq Id_Y$$ may not map $$B$$ to itself at all times, for instance. (We know that there does exist a homotopy $$fg\simeq Id_B$$ restricted to $$B$$, but that homotopy need not be the restriction of our homotopy on all of $$Y$$.)

Instead, you can use the long exact sequence of homology for the pairs. There is a commutative diagram $$\require{AMScd} \begin{CD} H_n(A) @>{}>> H_n(X) @>>> H_n(X,A) @>>>H_{n-1}(A) @>{}>> H_{n-1}(X)\\ @VVV @VVV @VVV @VVV @VVV\\ H_n(B) @>{}>> H_n(Y) @>>> H_n(Y,B) @>>>H_{n-1}(B) @>{}>> H_{n-1}(Y) \end{CD}$$ where the rows are exact and the vertical maps are all induced by $$f$$. By hypothesis, all the vertical maps except the middle one are isomorphisms, so the middle one is an isomorphism too by the five lemma.

The question of obtaining a homotopy equivalence of pairs assuming $$A \to X, B \to Y$$ are cofibrations is answered by 7.4.2 of Topology and Groupoids,(T&G), and the Addendum to that result shows how the homotopy inverse to $$f$$, and the homotopies, may be constructed from the given data. That answers your question on $$g$$. Here is a slightly transliteratwed version of that Addendum_:
Let $$g^{0} : B \to A$$ be any homotopy inverse of $$f^{0}:A \to B$$ and let $$H^{0}_{t} : f^{0}g^{0} \simeq 1$$, $$K^{0}_{t} : g^{0}f^{0} \simeq 1$$ be homotopies. Then $$g^{0}$$ extends to a homotopy inverse $$g':Y \to X$$ of $$f$$ such that the homotopy $$fg'\simeq 1$$ extends $$H^{0}_{t}$$ while the homotopy $$g'f\simeq 1$$ extends the sum $$K^{0} + g^{0}H^{0}f^{0} - g^{0}f^{0}K^{0}$$ of the homotopies $$g^{0}f^{0} = g^{0}f^{0}1_{A} \simeq g^{0}f^{0}g^{0}f^{0} \simeq g^{0}1_{B}f^{0} \simeq 1_{A}$$ determined by $$H^{0}_{t}$$ and $$K^{0}_{t}$$.
I do not know of examples showing that the description of the homotopies cannot be simplified. However the explicit form has useful implications, for example if $$H,K$$ are constant homotopies, and also to a gluing theorem (7.4.3 of T&G). It is not clear if $$g'$$ is homotopic to $$g$$.
These results were found in the 1960s by generalising the well known result that a homotopy equivalence $$f: X \to Y$$ induces an isomorphism of homotopy groups $$\pi_n(X,x) \to \pi_n(Y, f(x))$$. That proof involves an operation of fundamental groups on homotopy groups, so the more general result uses a more general operation, as in T&G, compare Section 5.2 of tom Dieck's "Algebraic Topology".