Exercise 1: Why a Word in Every Document Gets IDF Exactly Zero — Possible Solution ==================================================================== THE IDF FORMULA, PER THIS CHAPTER ------------------------------ Per this chapter: IDF(word) = log( total documents / documents containing word ) WORKING THROUGH A WORD IN EVERY DOCUMENT ------------------------------ If a word appears in every single document in the corpus, then "documents containing word" equals "total documents" — the two numbers in the formula are identical. Substituting this into the formula: IDF(word) = log( total documents / total documents ) = log(1) WHY log(1) EQUALS EXACTLY ZERO ------------------------------ The logarithm of 1 is 0 for any valid logarithmic base — this is a basic property of logarithms (any base raised to the power of 0 equals 1, so the logarithm of 1 is always 0, regardless of which base is used). There's nothing approximate or asymptotic about this — dividing identical numbers always produces exactly 1, and the logarithm of exactly 1 is always exactly 0. WHAT THIS MEANS FOR THE OVERALL TF-IDF SCORE ------------------------------ Per this chapter, "TF-IDF = TF × IDF." If IDF is exactly 0, then TF-IDF = TF × 0 = 0, regardless of what TF's own value happens to be. Even a word that appears extremely frequently within one specific document — a high TF value — still produces a final TF-IDF score of exactly zero once multiplied by an IDF of zero. WHY THIS MAKES SENSE GIVEN WHAT TF-IDF IS TRYING TO MEASURE ------------------------------ Per this chapter, TF-IDF scores high specifically for words that are "frequent in this document and rare across the corpus overall — genuinely distinctive for this specific document." A word appearing in literally every document, by definition, cannot distinguish any one document from any other — there's no document it's absent from to contrast against. Assigning it a TF-IDF score of exactly zero correctly reflects that this word carries zero distinguishing power for identifying what makes any particular document unique, no matter how often it's repeated within that document. WHY THIS WORKS AS AN ANSWER ------------------------------ It substitutes the specific case (a word in every document) directly into the chapter's own IDF formula, shows algebraically why this produces log(1) = 0, and explains why a zero IDF forces the entire TF-IDF score to zero regardless of TF, in a way that correctly reflects the word's own genuine lack of distinguishing power.