The sound is a fluke. Newer trains run on alternating current, but the third rail delivers direct current; inverters chop it into frequencies that can be used by the alternating current motors, said Jeff Hakner, a professor of electrical engineering at Cooper Union. The frequencies excite the steel, he said, which  in the case of the R142 subway cars  responds by singing “Somewhere.” Inverters on other trains run at different frequencies and thus are not gifted with such a recognizable song.

Image The No. 2 train produces a familiar three-note whine. Credit... Fred R. Conrad/The New York Times

The playwright Tony Kushner told New York magazine last year that it was his favorite New York noise. Riders often ask transit officials about it, and readers still write to the City section of The Times to report their discovery. The filmmaker Julie Talen told me about it months before I finally caught it.

When it’s heard by people who haven’t been tipped off, they distrust their own ears.

“Everyone sort of noticed it, and then this corroboration process started where people said to each other, ‘Did you hear it?’ ” said Jamie Bernstein, a writer and broadcaster whose father, Leonard Bernstein, composed “West Side Story.” “People still are asking me about it.”

How can a subway car evoke a song that has been fixed in memory by great singers like Marni Nixon, Aretha Franklin and Jessye Norman?

“What makes a melody sound like a melody is not the note it starts on  it’s the relationship from the first note you hear to the next one,” said John Mauceri, the chancellor of the University of North Carolina School of the Arts and a conductor who worked with Mr. Bernstein for 18 years.

What the mind knows as melody, Mr. Mauceri said, are these intervals between notes. “Our brains are built on pattern matching,” he said. “How does a finch recognize another finch singing from a tree a half-mile away? Once you have two or three intervals, they become locked in your brain as that song.”

In the first sung line of “Somewhere,” there are two intervals, Mr. Mauceri said. Between the first note  “there’s”  and the second note  “a”  the interval is known as an ascending minor seventh. From that second note to the third  “place”  there’s a descending half-step interval. The songs from “West Side Story,” which opened on Broadway in 1957 and was made into a movie in 1961, are often used to teach intervals to music students.