I didn’t know until the other day that Paul Simon once wrote a song called “Mrs. Roosevelt.” Yes, that Mrs. Roosevelt. Mike Nichols was my source on this trivia tidbit, and it ties in with a point a number of filmmakers have been making lately.

With so many movies tanking at the box office, it takes a remarkable confluence of good luck to create a hit these days. The stars (no, not just movie stars) have to be in perfect alignment for a film to break through the competitive maze.

Nichols was talking about his 1967 hit “The Graduate” — a restored print of the pic was shown at the Academy’s Goldwyn Theater May 6. The picture holds up remarkably well thanks to a number of factors, including the casting of Dustin Hoffman and Anne Bancroft, and thanks to Mrs. Roosevelt. But more of that later.

“The Graduate” is a reminder that most memorable films represent delicious accidents of history.

William Goldman recalls a long-ago conversation he had with Ingrid Bergman about “Casablanca” that illustrates this phenomenon. Early in the shoot of that brilliant movie, Bergman desperately sought out the advice of director Michael Curtiz. “Which man am I supposed to be in love with — Bogart or Paul Henreid?” she asked him. “I don’t know how to play my character.”

Curtiz, a grizzled veteran of the studio wars, told her the truth. “Be ambiguous,” he counseled. “I don’t know the answer yet because the pages are still coming in. The damned script isn’t finished.”

Bergman’s ambiguous performance was a key to the movie, of course. Not only did the studio not know the answer to her question, it didn’t even want Bogie for the role. Jack Warner was high on George Raft, of all people, and that would have created a very different and perplexing movie.

Most great movies had to endure nightmarish struggles in production and post-production. The set of “The Godfather” was a true battle zone — Francis Ford Coppola even faced incipient rebellion from his camera crew.

As with “Casablanca,” most memorable movies started with casting disputes. “The Graduate” went to Doris Day before Bancroft. “Butch Cassidy and the Sundance Kid” went first to Brando and Beatty, not Newman and Redford, who turned out to be perfect for their roles (the chemistry between Brando and Beatty probably would have been frigidly nonexistent).

From time to time, of course, surprise elements come together to save a film — even a great score. While shooting “The Graduate,” Nichols recalls how he became increasingly fixated on the songs of Simon & Garfunkel, but had trouble figuring out how to use their music. Larry Turman, his producer, finally worked out a deal and Paul Simon agreed to write three new songs.

By the end of editing, however, Simon still had delivered only one and he was touring constantly. When Nichols begged for more, Simon said he was too busy, but he did play a few notes of a song he was working on for the tour. “It’s not for the movie,” he said. “It’s a song about times past — about Mrs. Roosevelt and Joe DiMaggio and stuff.”

Always the opportunist, Nichols said, “It’s now about Mrs. Robinson, not Mrs. Roosevelt.” Thus was born the great song that provided the perfect third-act impetus for “The Graduate.” Indeed, the Simon & Garfunkel music gave the film important lifts at moments when the story seemed to sputter. It’s impossible to imagine the film without these moments.

So here’s to you, Joe DiMaggio — and Mrs. Roosevelt, too.