Amazingly, the only difference between the book version of this scene and the TV show version is a handful of sentences, which were omitted from the episode for reasons that cannot possibly be explained.
Before they part ways, Jaime reveals to Tyrion the truth about Tyrion's first wife, Tysha -- Tysha was not a whore that Jaime had hired to gaslight his younger brother, as Tyrion had spent the past several years believing. You see, Tyrion and Jaime came upon her after she'd just been attacked, and while Jaime rode off to annihilate the attackers (because he's Jaime Lannister), Tyrion stayed behind to comfort her, and they fell in love. They married in secret, and when Tywin found out, he had Jaime reveal to Tyrion that Tysha had been a whore the entire time, and the whole thing was a lie. Except it wasn't -- Tywin was so furious about the marriage that he forced Jaime to lie about it.
"We'll never have enough time to discuss all that! Now, let's talk
for five minutes about beetles."
So, when Tyrion confronts Tywin in that final scene, he's not asking about Shae -- he's asking about Tysha. Specifically, he asks where Tysha went after she was sent away, to which Tywin responds, "Wherever whores go." Tyrion says the equivalent of, "Me and this crossbow don't think you should use that word again," and Tywin respectfully ignores the suggestion, so Tyrion blasts him.