The film begins in September 2008 (opening against the backdrop of news of the Islamabad Marriott Hotel bombing) with an elderly Lady Thatcher buying milk unrecognized by other customers and walking back from the shop alone. Over the course of three days, we see her struggle with dementia and with the lack of power that comes with old age, while looking back on defining moments of her personal and professional life, on which she reminisces with her (now-dead) husband, Denis Thatcher, whose death she is unable to fully accept. She is shown as having difficulty distinguishing between the past and present. A theme throughout the film is the personal price that Thatcher has paid for power. Denis is portrayed as somewhat ambivalent about his wife's rise to power, her son Mark lives in South Africa and is shown as having little contact with his mother, and Thatcher's relationship with her daughter Carol is at times strained.
In flashbacks we are shown Thatcher's youth, working in the family grocery store in Grantham, listening to the political speeches of her father, whom she idolised –  it is also hinted that she had a poor relationship with her mother, a housewife –  and announcing that she has won a place at the University of Oxford. She remembers her struggle, as a young lower-middle class woman, to break into a snobbish male-dominated Tory party and find a seat in the House of Commons, along with businessman Denis Thatcher's marriage proposal to her. Her struggles to fit in as a "Lady Member" of the House, and as Education Secretary in Edward Heath's cabinet are also shown, as are her friendship with Airey Neave (later assassinated by the Irish National Liberation Army), her decision to stand for Leader of the Conservative Party and eventual victory, and her voice coaching and image change.
Further flashbacks examine historical events during her time as Prime Minister, after winning the 1979 general election, including the rising unemployment related to her monetarist policies and the tight 1981 budget (over the misgivings of "wet" members of her Cabinet – Ian Gilmour, Francis Pym, Michael Heseltine, and Jim Prior), the 1981 Brixton riot, the 1984–1985 UK miners' strike, and the bombing in Brighton of the Grand Hotel during the 1984 Conservative Party Conference, when she and Denis were almost killed. We also see (slightly out of chronological sequence) her decision to retake the Falkland Islands following the islands' invasion by Argentina in 1982, the sinking of the ARA General Belgrano and Britain's subsequent victory in the Falklands War, her friendship with U.S. President Ronald Reagan and emergence as a world figure, and the economic boom of the late 1980s.
By 1990, Thatcher is shown as an imperious but aging figure, ranting aggressively at her cabinet, refusing to accept that the Community Charge (the "Poll Tax") is unjust, even while it is causing riots, and fiercely opposed to European Integration. Her deputy Geoffrey Howe resigns after being humiliated by her in a cabinet meeting, Heseltine challenges her for the party leadership, and her loss of support from her cabinet colleagues leaves her little choice but reluctantly to resign as Prime Minister after eleven years in office. A teary-eyed Thatcher exits 10 Downing Street for the last time as Prime Minister with Denis comforting her. She is shown as still disheartened about it almost twenty years later.
Eventually, Thatcher is shown packing up her late husband's belongings, and telling him it's time for him to go. Denis's ghost leaves her as she cries that she actually is not yet ready to lose him, to which he replies "You're going to be fine on your own... you always have been" before leaving forever. She is finally shown in her kitchen, alone, contentedly washing a teacup (a wifely role she had told Denis she would never accept), having finally overcome her grief.

Question: How many years did Thatcher serve as Prime Minister?
Answer: Eleven