The Descendants

Matthew "Matt" King (George Clooney) is a Honolulu-based attorney and the sole trustee of a family trust of 25,000 pristine acres on Kauai island. The land has great monetary value, but is also a family legacy. While Matt has always ably managed his own finances, most of his cousins have squandered their inheritances. With the trust expiring in seven years due to the rule against perpetuities, the King clan is pressuring Matt to sell the land for hundreds of millions of dollars. Amidst these discussions, a boating accident has rendered Matt's wife, Elizabeth, comatose. With Elizabeth hospitalized, Matt is forced to cope with his two troubled daughters, 10-year-old Scottie (Amara Miller) who seeks attention by bullying other children, and 17-year-old Alex (Shailene Woodley) who has a history of substance abuse and is away at a private boarding school on the Big Island. Doctors determine that Elizabeth's coma is irreversible and her living will directs all life support to be discontinued. When Matt tells Alex, she reveals that Elizabeth was having an affair at the time of the accident, causing a major rift between mother and daughter.
Two close family friends tell Matt that Elizabeth was unhappy and wanted to leave him for her lover, Brian Speer (Matthew Lillard), a real estate agent. After Matt arranges for friends to bid Elizabeth goodbye, he decides Speer should also have an opportunity. He and the girls, and also Alex's slacker boyfriend Sid (Nick Krause), travel to Kauai to find Brian. While there, Matt's cousin, Hugh (Beau Bridges) mentions that Brian is brother-in-law to Don Hollitzer, the developer to whom the family wants to sell the land. Brian stands to make a small fortune from the sales commission. Matt confronts Brian and informs him Elizabeth is dying and offers him an opportunity to see her one last time. Brian declines, admitting that although Elizabeth was in love with him, it was only a fling to him; he loves his wife, Julie (Judy Greer) and their children, then apologizes to Matt for the pain he caused.
When Elizabeth is disconnected from life support, her father, Scott (Robert Forster) admonishes Matt for not being a more generous and loving husband. Choosing not to disclose the details of her affair to Scott, Matt agrees, but Sid and Alex both unexpectedly defend Matt. At the King family meeting, Matt overrules the majority of his cousins who favor selling to Hollitzer. Matt decides to keep the land and look for a different solution to the problem posed by the Rule Against Perpetuities. Shocked, Hugh tells Matt that he and the other cousins will take legal action if Matt refuses to sell, but Matt is undeterred.
After learning of Brian's affair with Elizabeth and realizing that he will not visit, Julie comes to the hospital, partly feeling that decency obliges her to. She tearfully admits to Elizabeth that she wants to hate her for "trying to destroy" her family, but that she forgives her. Matt finally comes to terms with his wife's betrayal and her impending death. He tenderly kisses her goodbye, followed by Alex and Scottie, and later, scatter Elizabeth's ashes in the ocean off Waikiki. The film concludes with the three at home sitting together sharing ice cream and watching television, all wrapped in the Hawaiian quilt Elizabeth had been lying in.

Question: What does Matt learn Elizabeth was doing at the time of the accident?
Answer: Having an affair