Good Will Hunting
Good Will Hunting is a 1997 American psychological drama film directed by Gus Van Sant, and written by Ben Affleck and Matt Damon. It stars Robin Williams, Damon, Affleck, Stellan Skarsgård and Minnie Driver.
The film received positive reviews from critics and grossed over $225 million during its theatrical run against a $10 million budget. At the 70th Academy Awards, it received nominations in nine categories, including Best Picture and Best Director, and won in two: Best Supporting Actor for Williams and Best Original Screenplay for Affleck and Damon. In 2014, it was ranked at number 53 in The Hollywood Reporter's "100 Favorite Films" list.

Plot
Twenty-year-old Will Hunting of South Boston is a natural, self-taught genius who was recently paroled from jail. He works as a janitor at MIT and spends his free time drinking with his friends Chuckie, Billy, and Morgan. When Professor Gerald Lambeau posts a difficult combinatorial mathematics problem on a blackboard as a challenge for his graduate students, Will solves the problem anonymously, stunning both the students and Lambeau. As a challenge to the unknown genius, Lambeau posts an even more difficult problem; he later catches Will writing the solution on the blackboard late at night, but initially thinks Will is vandalizing it and chases him off. At a bar, Will meets Skylar, a British woman about to graduate from Harvard College, who plans on attending medical school at Stanford.
The next day, Will and his friends get in a fight with a gang that includes a member who used to bully Will as a child. Will is arrested after he attacks a responding police officer. Lambeau sits in on his court appearance and watches Will defend himself. He arranges for Will to avoid jail time if he agrees to study mathematics under Lambeau's supervision and participate in psychotherapy sessions. Will agrees but treats his therapists with mockery. In desperation, Lambeau calls on Dr. Sean Maguire, his college roommate, who now teaches psychology at Bunker Hill Community College. Unlike other therapists, Sean actually challenges Will's defense mechanisms. During the first session, Will insults Sean's deceased wife, and Sean threatens him, but after a few unproductive sessions, Will finally begins to open up.
Will is particularly struck by Sean's story of how he met his wife, who later died of cancer, by giving up his ticket to the historic game six of the 1975 World Series after falling in love at first sight. Sean's explanation for surrendering his ticket was to "see about a girl", and he does not regret his decision. This encourages Will to build a relationship with Skylar, though he lies to her about his past and is reluctant to introduce her to his friends or show her his home. Will also challenges Sean to take an objective look at his own life, since Sean cannot move on from his wife's death.
Lambeau sets up a number of job interviews for Will, but Will scorns them by sending Chuckie as his "chief negotiator", and by turning down a position at the NSA with a scathing critique of the agency's moral position. Skylar asks Will to move to California with her, but he refuses and tells her he is an orphan, and that his foster father physically abused him. Will breaks up with Skylar and later storms out on Lambeau, dismissing the mathematical research he has been doing. Sean points out that Will is so adept at anticipating future failure in his interpersonal relationships that he deliberately sabotages them to avoid emotional pain. Chuckie likewise challenges Will over his resistance to taking any of the positions he interviews for, telling Will he owes it to his friends to make the most of the opportunities they will never have, even if it means leaving one day. He then tells Will that the best part of his day is a brief moment when he waits on his doorstep, thinking Will has moved on to something greater.
Will walks in on a heated argument between Sean and Lambeau over Will's potential. Sean and Will talk and realize that they were both victims of child abuse. Sean helps Will see that he is a victim of his own inner demons and to accept that it is not his fault, causing him to break down in tears in Sean's arms. Will accepts one of the job offers arranged by Lambeau. Having helped Will overcome his problems, Sean reconciles with Lambeau, deciding to take a sabbatical. Will's friends give him a used car for his 21st birthday so he can commute to work. Later, Chuckie goes to Will's house to pick him up, only to find that he is not there, much to his happiness. Will leaves a note for Sean asking him to tell Lambeau that he had to go "see about a girl", revealing he passed on the job offer and instead is heading to California to reunite with Skylar.

Cast
Production
Development
Matt Damon started writing the film as a final assignment for a playwriting class he was taking at Harvard University. Instead of writing a one-act play, Damon submitted a 40-page script. He wrote his then-girlfriend, medical student Skylar Satenstein (credited in the closing credits of the film), into his script. Damon said the only scene from that script that survived – "it survived verbatim" – was when Will Hunting (Damon) meets his therapist, Sean Maguire (Robin Williams), for the first time. Damon asked Ben Affleck to develop the screenplay together. They completed the script in 1994. At first, it was written as a thriller about a young man in the rough-and-tumble streets of South Boston who possesses a superior intelligence and is targeted by the government with heavy-handed recruitment.Castle Rock Entertainment bought the script for $675,000 against $775,000, meaning that Damon and Affleck would stand to earn an additional $100,000 if the film was produced and they retained sole writing credit. Castle Rock president Rob Reiner urged them to drop the thriller aspect of the story and to focus on the relationship between Will and his therapist. Terrence Malick told Affleck and Damon over dinner that the film ought to end with Will's decision to follow his girlfriend Skylar to California, not them leaving together.At Reiner's request, screenwriter William Goldman read the script. Goldman consistently denied the persistent rumor that he wrote Good Will Hunting or acted as a script doctor. In his book Which Lie Did I Tell? Goldman jokingly writes, "I did not just doctor it. I wrote the whole thing from scratch," before dismissing the rumor as false and saying his only advice was agreeing with Reiner's suggestion.Affleck and Damon proposed to act in the lead roles, but many studio executives said they wanted Brad Pitt and Leonardo DiCaprio. Meanwhile, Kevin Smith was working with Affleck on Mallrats and with both Damon and Affleck on Chasing Amy. Castle Rock put the script in turnaround, and gave Damon and Affleck 30 days to find another buyer for the script who would reimburse Castle Rock the money paid, otherwise the script reverted to the studio, and Damon and Affleck would be out. All the studios that were involved in the original bidding war for the screenplay now turned the pair down, taking meetings with Affleck and Damon only to tell them this to their face. As a last resort, Affleck passed the script to his Chasing Amy director Kevin Smith, who read it and promised to walk the script directly into Harvey Weinstein's office at Miramax. Weinstein read the script, loved it, and paid Castle Rock their due, while also agreeing to let Damon and Affleck star in the film. Weinstein asked that a few scenes be removed, including an out-of-place, mid-script oral sex scene that Damon and Affleck added to trick executives who were not looking closely.
After buying the rights from Castle Rock, Miramax put the film into production. Several well-known filmmakers were originally considered to direct, including Mel Gibson and Michael Mann. Originally, Affleck asked Kevin Smith whether he was interested in directing. He declined, saying they needed a "good director," that he only directed projects he wrote, and that he was not much of a visual director, but he still served as one of the film's executive producers. Damon and Affleck later chose Gus Van Sant for the job, whose work on previous films like Drugstore Cowboy (1989) had left a favorable impression on the fledgling screenwriters. Miramax was persuaded and hired Van Sant to direct the film.

Filming
Filming took place between April and June 1997. Although the story is set in Boston, and many of the scenes were shot on location in the Greater Boston area, many of the interior shots were filmed at locations in Toronto, with the University of Toronto standing in for MIT and Harvard University. The classroom scenes were filmed at McLennan Physical Laboratories (of the University of Toronto) and Central Technical School. Harvard normally disallows filming on its property, but permitted limited filming by the project after intervention by Harvard alumnus John Lithgow. Likewise, only the exterior shots of Bunker Hill Community College were filmed in Boston; however, Sean's office was built in Toronto as an exact replica of one at the college.The interior bar scenes set in "Southie" were shot on location at Woody's L Street Tavern. Meanwhile, the homes of Will (190 West 6th Street) and Sean (259 E Street), while some distance apart in the movie, actually back up to each other on Bowen Street, the narrow street Chuckie drives down to walk up to Will's back door.The Bow and Arrow Pub, which was located at the corner of Bow Street and Massachusetts Avenue in Cambridge, doubled as the exterior of the Harvard bar in which Will met Skylar for the first time. The Baskin-Robbins/Dunkin' Donuts featured in the "How do you like them apples?" scene was next door to the pub at the time of the film's release.  The Harvard Bar interior scenes were filmed at the Upfront Bar and Grill on Front St. E. in Toronto.The Tasty, at the corner of JFK and Brattle Streets, was the scene of Will and Skylar's first kiss. The Au Bon Pain, where Will and Skylar discuss the former's photographic memory, was at the corner of Dunster Street and Mass Ave.The Boston Public Garden bench on which Will and Sean sat for a scene in the film became a temporary shrine after Williams's death in 2014.

Soundtrack
The musical score for Good Will Hunting was composed by Danny Elfman, who had previously collaborated with Gus Van Sant on To Die For and would go on to score many of the director's other films. The film also features many songs written and recorded by singer-songwriter Elliott Smith. His song "Miss Misery" was nominated for the Academy Award for Best Original Song, but lost to "My Heart Will Go On" from Titanic. Elfman's score was also nominated for an Oscar, but lost to Titanic as well. On September 11, 2006, The Today Show used Elfman's song "Weepy Donuts" while Matt Lauer spoke during the opening credits.
A soundtrack album for the film was released by Capitol Records on November 18, 1997, though only two of Elfman's cues appear on the release.

"Afternoon Delight" by the Starland Vocal Band was featured in the film, but did not appear on the soundtrack album.

A limited edition soundtrack album featuring Elfman's complete score from the film was released by Music Box Records on March 3, 2014. The soundtrack, issued in 1500 copies, includes all of Elfman's cues (including music not featured on the rare Miramax Academy promo) and also contains the songs by Elliott Smith. One of the tracks is Smith's songs with Elfman's arrangements added into the mix.
Main Title (2:44)
Genie Mopper (0:37)
First Calculation (1:08)
Theorem (0:42)
Kick Ass Choir (0:59)
Mystery Math (2:28)
Them Apples (0:57)
Jail (1:13)
Second Shrink (1:14)
Any Port (1:25)
Times Up (1:14)
Oliver Twist (1:58)
Staring Contest (0:49)
Secret Weapon (0:57)
Retainer (Part A) (0:58)
Retainer (Part B) (0:20)
Tell You Something (0:48)
No Love Me (0:47)
Fire Music (1:11)
Whose Fault (2:34)
End Titles (3:50)
Between the Bars (Orchestral) (1:09) – Performed by Elliott Smith / Arr. by Elfman
No Name #3 (3:04) – Performed by Elliott Smith
Say Yes (2:15) – Performed by Elliott Smith
Between the Bars (2:21) – Performed by Elliott Smith
Angeles (2:55) – Performed by Elliott Smith
Miss Misery (3:12) – Performed by Elliott Smith

Mathematics
In an early version of the script, Will Hunting was going to be a physics prodigy, but Nobel Laureate in Physics Sheldon Glashow at Harvard told Damon that the subject should be math instead of physics. Glashow referred Damon to his brother-in-law, Daniel Kleitman, a mathematics professor at MIT. Columbia University's physics and math professor Brian Greene at the Tribeca Sloan retrospectively explained that for physics, "Having some deep insight about the universe [⁠ ⁠.⁠ ⁠.⁠ ⁠.⁠ ⁠] typically [⁠ ⁠is ⁠] a group project in the modern era," while "doing some mathematical theorem is a singular undertaking very often." In the spring of 1997, Damon and Affleck asked Kleitman to "speak math to us" for writing realistic dialogue, so Kleitman invited postdoc Tom Bohman to join him, giving them a "quick lecture". When asked for a problem that Will could solve, Kleitman and Bohman suggested the unsolved computer science P versus NP problem, but the movie used other problems.
Patrick O'Donnell, professor of physics at the University of Toronto, served as the mathematical consultant for the film.The main hallway blackboard is used twice to reveal Will Hunting's talent, first to the audience, second to Professor Lambeau. Matt Damon based it on his artist brother Kyle visiting MIT's Infinite Corridor and writing "an incredibly elaborate, totally fake, version of an equation" on a blackboard, which lasted for months. Kyle returned to Matt, saying that MIT needed those blackboards "because these kids are so smart they just need to, you know, drop everything and solve problems!"

The first blackboard problem
Near the start of the film, Will sets aside his mop to study a difficult problem posed by Lambeau on the blackboard. The problem has to do with intermediate-level graph theory, but Lambeau describes it as an advanced "Fourier system."
To answer the first part of the question, Will chalks up an adjacency matrix:

  
    
      
        A
        =
        
          
            (
            
              
                
                  0
                
                
                  1
                
                
                  0
                
                
                  1
                
              
              
                
                  1
                
                
                  0
                
                
                  2
                
                
                  1
                
              
              
                
                  0
                
                
                  2
                
                
                  0
                
                
                  0
                
              
              
                
                  1
                
                
                  1
                
                
                  0
                
                
                  0
                
              
            
            )
          
        
        .
      
    
    {\displaystyle A={\begin{pmatrix}0&1&0&1\\1&0&2&1\\0&2&0&0\\1&1&0&0\end{pmatrix}}.}
  To answer the second part, he determines the number of 3-step walks in the graph, and finds the third power matrix:

  
    
      
        
          A
          
            3
          
        
        =
        
          
            (
            
              
                
                  2
                
                
                  7
                
                
                  2
                
                
                  3
                
              
              
                
                  7
                
                
                  2
                
                
                  12
                
                
                  7
                
              
              
                
                  2
                
                
                  12
                
                
                  0
                
                
                  2
                
              
              
                
                  3
                
                
                  7
                
                
                  2
                
                
                  2
                
              
            
            )
          
        
        .
      
    
    {\displaystyle A^{3}={\begin{pmatrix}2&7&2&3\\7&2&12&7\\2&12&0&2\\3&7&2&2\end{pmatrix}}.}
  The third and fourth parts of the question concern generating functions. The other characters are astounded that a janitor shows such facility with matrices.

The second blackboard problem
Lambeau subsequently poses a new challenge on the blackboard: state Cayley's formula and "draw all the homeomorphically irreducible trees with 
  
    
      
        n
        =
        10
      
    
    {\displaystyle n=10}
  ." Will writes eight of the ten trees correctly before Lambeau interrupts.

Reception
Box office
In the film's opening weekend in limited release, it earned $272,912. In its January 1998 wide-release opening weekend, it earned $10,261,471. It went on to gross $138,433,435 in North America and a total worldwide gross of $225,933,435.

Critical response
The film was met with highly positive reviews. On the review aggregator Rotten Tomatoes, the film holds an approval rating of 97% based on 87 reviews, with an average rating of 8.10/10. The website's critical consensus reads, "It follows a predictable narrative arc, but Good Will Hunting adds enough quirks to the journey – and is loaded with enough powerful performances – that it remains an entertaining, emotionally rich drama." On Metacritic, the film has a weighted average score of 70 out of 100, based on 28 critics, indicating "generally favorable reviews". Audiences surveyed by CinemaScore gave the film an average grade of "A" on an A+ to F scale.Roger Ebert of the Chicago Sun-Times gave the film three stars out of four, writing that while the story is "predictable", it is "the individual moments, not the payoff, that make it so effective". Duane Byrge of The Hollywood Reporter praised the performances of the cast, writing "The acting is brilliant overall, with special praise to Matt Damon for his ragingly tender portrayal of the boy cursed with genius". Peter Stack of the San Francisco Chronicle was equally positive, writing "The glow goes well beyond a radiant performance by Matt Damon ... Intimate, heartfelt and wickedly funny, it's a movie whose impact lingers". Owen Gleiberman, writing for Entertainment Weekly, gave the film a "B", stating "Good Will Hunting is stuffed – indeed, overstuffed – with heart, soul, audacity, and blarney. You may not believe a minute of it, but you don't necessarily want to stop watching". He also noted Damon's and Williams' chemistry, describing it as "a quicksilver intercepting each other's thoughts". Janet Maslin of The New York Times, called the screenplay "smart and touching", and praised Van Sant for directing with "style, shrewdness and clarity". She also complimented the production design and cinematography, which were able to effortlessly move the viewer from "classroom to dorm room to neighborhood bar", in a small setting.Quentin Curtis of The Daily Telegraph opined Williams' performance brought "sharpness and tenderness", calling the film a "crowd-pleaser, with bags of charm to spare. It doesn't bear thinking too much about its message ... Damon and Affleck's writing has real wit and vigour, and some depth". Andrew O'Hehir of Salon stated that despite the "enjoyable characters", he thought the film was somewhat superficial, writing "there isn't a whole lot of movie to take home with you ... many will wake the next morning wondering why, with all that talent on hand, it amounts to so little in the end". Writing for the BBC, Nev Pierce gave the film four stars out of five, describing the film as "touching, without being sentimental", although he felt some scenes were "odd lapses into self-help speak". Emanuel Levy of Variety called the film a "beautifully realized tale ... engaging and often quite touching". He felt that the film's visual style showcased Van Sant's talent, but the plot was "quite predictable".

Academic response
Several scholars have examined the role of class, religion and the cultural geography of Boston in the film. Jeffrey Herlihy-Mera observed that the residual Catholic–Protestant tensions in Boston is an important backdrop in the film, as Irish Catholics from Southie are aligned against ostensibly Protestant characters who are affiliated with Harvard and MIT. Emmett Winn has argued that character interactions show class conflict and stunted social mobility, while, similarly, David Lipset commented that class inequality is a driving subtext.

Accolades
See also
The Man Who Knew Infinity
Ramanujan
List of films about mathematicians
Farmers and Fishermen: Two Centuries of Work in Essex County, Massachusetts, 1630–1850

Notes
References
External links

Good Will Hunting at IMDb
Good Will Hunting at the TCM Movie Database
Good Will Hunting at AllMovie
Good Will Hunting at Box Office Mojo
Screenplay on IMSDb
Grime, James. "The Real Good Will Hunting". Numberphile. Brady Haran. Archived from the original on April 19, 2017. Retrieved April 7, 2013.
Then & Now: Revisiting Good Will Hunting – Boston.com