TRENTON, N.J. (AP) _ Walter Petryshyn's well-ordered world began to come apart with the terrible realization that he had made an error in a textbook.

A highly regarded Rutgers University mathematician with a reputation as a perfectionist who loved both his work and his wife, Petryshyn became depressed and paranoid, started losing weight and began obsessing over apparently imaginary health problems, said longtime friend Bohdan Boychuk.

``He felt that his prestige was destroyed, that his colleagues in mathematics would laugh at him,'' Boychuk said.

The obsession may have driven him over the edge: Early Monday, prosecutors say, Petryshyn smashed his wife's skull with a claw hammer 30 times. Her body was found in the couple's townhouse in North Brunswick.

Petryshyn, a 67-year-old Ukrainian immigrant, was charged with murder in the death of Arcadia Olenska-Petryshyn, a 61-year-old painter who exhibited her work internationally. He was jailed on $500,000 bail.

It was the textbook error that ``really broke him,'' Boychuk said.

The problems began a year ago, when Petryshyn published the textbook, ``Generalized Topological Degree and Semilinear Equations,'' said Boychuk, a Ukrainian poet who lives in Riverdale, N.Y.

``I noted very drastic changes,'' Boychuk said. ``He discovered that there was some mistake in that book and he told me that mistake was very serious, very big and he couldn't solve it.''

But Boychuk said he understood that Petryshyn's editors at Cambridge University Press in England said ``the error was small, that the book was very good, well received and selling.''

``That's the irony. It was all in his mind,'' Boychuk said.

Petryshyn's editor, Lauren Cowles, said he simply left out one assumption that was the basis for one of the book's central logical arguments _ ``a technicality'' Cowles addressed by sending corrections to book reviewers for academic journals.

``It sounds as if his perfectionism drove him to insanity,'' said Rutgers mathematician Felix Browder, who has known Petryshyn for decades.

Boychuck said the professor had complained of ``all kinds of pains.'' Antoni Kosinski, chairman of Rutgers' mathematics department, said Petryshyn was given a medical leave in February because he was losing his voice frequently, which made it difficult for him to lecture.

Petryshyn's wife and sister tried to help him, and Boychuk called frequently to boost his spirits. The professor got treatment from a psychiatrist, but when the doctor suggested he enter a mental hospital for observation, Boychuk said, Petryshyn got scared and stopped trusting everyone.

``He was constantly in fear that they would come to get him to the madhouse,'' Boychuk said.

That worried his wife, who complained to Boychuk recently that it was very oppressive living with Petryshyn's terrors.

Petryshyn is an expert in theoretical and applied mathematics, specializing in nonlinear functional analysis and numerical functional analysis.

He became a professor of mathematics at Rutgers in 1967 after teaching at University of Chicago for three years. Petryshyn holds bachelor's, master's and doctoral degrees from Columbia University, has written some 90 articles for academic publications, and has won numerous professional awards.

Boychuk said Petryshyn took the Rutgers job so his wife could be close to the New York art scene. ``He was really deeply in love with her. There's no doubt about that,'' he said.