Anne, a young orphan from the fictional community of Bolingbroke, Nova Scotia (based upon the real community of New London), is sent to Prince Edward Island after a childhood spent in strangers' homes and orphanages. Marilla and Matthew Cuthbert, siblings in their fifties and sixties, had decided to adopt a boy from the orphanage to help Matthew run their farm. They live at Green Gables, their Avonlea farmhouse on Prince Edward Island. Through a misunderstanding, the orphanage sends Anne Shirley.
Anne is described as bright and quick, eager to please, talkative, and extremely imaginative. She has a pale face with freckles and usually braids her red hair. Marilla at first says the girl must return to the orphanage, but after a few days, she decides to let her stay. Marilla feels that she could be a good influence on the girl and has also learned that a disagreeable woman in town might take Anne instead.
As a child of imagination, Anne takes much joy in life and adapts quickly, thriving in the close-knit farming village. Her talkativeness initially drives the prim, duty-driven Marilla to distraction, although Matthew falls for her charm immediately. Anne says that they are "kindred spirits."
The book recounts Anne's adventures in making a home: the country school where she quickly excels in her studies; her friendship with Diana Barry (her best or "bosom friend" as Anne fondly calls her); her budding literary ambitions; and her rivalry with classmate Gilbert Blythe, who teases her about her red hair. For that, he earns her instant hatred, although he apologizes many times. As time passes, Anne realizes she no longer hates Gilbert but cannot bring herself to speak to him.
The book also follows Anne's adventures in quiet, old-fashioned Avonlea. Episodes include her play-time with friends (Diana, Jane Andrews and Ruby Gillis), her run-ins with the unpleasant Pye sisters (Gertie and Josie), and domestic mishaps such as dyeing her hair green (while intending to dye it black) or accidentally getting Diana drunk (by giving her what she thinks is raspberry cordial but is currant wine).
At fifteen, Anne goes to Queen's Academy to earn a teaching license, along with Gilbert, Ruby, Josie, Jane and several other students. She obtains her license in one year instead of the usual two and wins the Avery Scholarship for the top student in English. Her attainment of this scholarship would allow her to pursue a Bachelor of Arts (B.A.) degree at the fictional Redmond College (based on the real Dalhousie University) on the mainland in Nova Scotia.
Near the end of the book, Matthew dies of a heart attack after learning that all of his and Marilla's money has been lost in a bank failure. Out of devotion to Marilla and Green Gables, Anne gives up the scholarship to stay at home and help Marilla, whose eyesight is failing. She plans to teach at the Carmody school, the nearest school available, and return to Green Gables on weekends. In an act of friendship, Gilbert Blythe gives up his teaching position at the Avonlea School to work at White Sands School instead, knowing that Anne wants to stay close to Marilla after Matthew's death. After this kind act, Anne and Gilbert's friendship is cemented, and Anne looks forward to the next "bend in the road."

Question: How does Matthew die?
Answer: a heart attack
Alternative answer: Heart attack.