Question: How can a candidate who regularly piles up two-million-vote victories be beaten by an opponent who is spending $750,000 in hopes of scraping together 125,000 votes?

Answer: Just watch Tuesday's Massachusetts Republican senatorial primary.

Edward W. Brooke, the Senate's lone black and a leading figure in the GOP's liberal wing, is no better than an even-money bet to survive the challenge from 36-year-old Avi Nelson, a Brookline rabbi's son best known as the host of radio and television talk shows that provided a hospitable forum for Boston's loudest antibusing agitators.

Nelson, whose previous political experience consists of losing a race for the House of Representatives, has put together a carefully targeted campaing in the commonwealth's microscopic and conservative-learning Republican Party, and has Brooke running very scared.

Despite his record of rolling up 2.0 and 2.3 million votes in his 1966 and 1972 senatorial landslides, Brooke may be hard pressed to survive Nelson's challenge.

The reason lies in the numbers that roll off Nelson's tongue, as the one-time electronics engineer talks to a group of contributors at a doctor's home in Wellesley:

"There are 5.5 million people in Massachusetts, but only 450,000 of them are registered Republicans, and only 200,000 of them normally vote in the primary.

"Here in Wellesley, you have 4,500 Republican primary voters, second only to Boston's 7,300. No city has as many as 10,000.

"We have identified, on our computer, 100,000 likely Republican supporters, and we have, we estimate, reregistered 15,000 Democrats who will vote for me in the primary. We can retire Senator Brooke with 115,000 votes and send a very loud message to Washington. If we can beat an Ed Brooke in Massachusetts, we can do it anywher."

With both Nelson's and Brooke's final polls showing the race a virtual standoff, no one in the Brooke camp is discounting the force of Nelson's mathematics.

"He [Nelson] has the organizational capacity to get 100,000 votes," says Tom Trimarco, Brooke's director of field organization. "The name of the game for us is to try to get more than 225,000 people to vote."

To that end, the 58-year-old Brooke has been motorcading and handshaking his way around the state, while volunteers (some supplied by friendly unions) try to reach 170,000 Republican households from a Boston phone center, and $45,000 a week of radio and television ads ask for votes for Brooke.

The effort to save the only remaining Republican in statewide office has brought in outside campaigners ranging from former Federal Reserve Board chairman Arthur F. Burns to civil rights leader Jesse M. Jackson.

Republican National Chairman Bill Brock has abandoned the customary pre-primary neutrality to cut radio spots for Brooke, and five of Brooke's most conservative Republican colleagues in the Senate issued a joint statement on his behalf Thursday.

But Nelson is confidently predicting victory. "We've come from 40 points back," he told his Wellesley backers, "and we're going to win."

Eagerly watching the outcome of this internal GOP battle are the five Democratic Senate hopefuls, led by two liberals, Rep. Paul E. Tsongas and Secretary of State Paul Guzzi, who are co-favorites for the nomination.

The belief among the Democrats is that Brooke might be more vulnerable in the general election this year than in the past but Nelson would be a cinch to knock off.

That view is shared by most Republicans outside the Nelson camp and is one reason why Brock and other conservatives have railed to Brooke's support.

Brooke's hold on the seat was shaken when he admitted last spring that he had made inacurrate statements about his financial holdings during divorce proceedings from his long-estranged wife. A wave of investigations followed, generating more adverse publicity, and luring several candidates into the Democratic primary field.

In the end, Brooke settled out of court with his former wife, and local authorities declined to press any further charges against him.

Whatever impact it may have in November if Brooke is the GOP nominee, the divorce is a muted and probably minor factor in Nelson's challenge.

Nelson began his campaign last winter, before Brooke's financial and family problems were publicized, and he has said nothing of the divorce other than to repeat, when asked, that "I consider the whole situation a personal tragedy and I will have no further comment on it."

Nelson challenged Brooke on the assumption that the senator's generally liberal positions are no longer representative of a Republican electorate that has grown more conservative as it has decreased in size.

In the last two elections, conservative Republicans have won close to 40 percent of the primary vote against favored GOP moderates, without making much of an effort.

Nelson moved early to improve on that base. From a nucleus of friends who had helped him in his losing House race, he assembled a volunteer organization that collected 25,000 signatures on his nominating petitions.

The same volunteers then painstakingly assembled, from town and city voting records, the names and addresses of the 200,000 Republicans who actually voted in the last two primaries, and put them onto a computer mailing list.

Nelson had won early attention in the Boston area as a Yale-Cornell-and Harvard-trained egghead who espoused the cause of working-class whites during Boston's busing disputes. He opened his talk-show microphone to antibusing spokesmen and emerged as an unlikely hero in South Boston.

Brooke was, of course, on the other side of that controversy, but Nelson has chosen to focus his campaign on other issues on which he says Brooke has taken a stand opposite that preferred by most Massachusetts Republicans.

Those issues include Brook's support of the Panama Canal treaties, federally financed abortions and a whole arrary of demestic welfare programs.

While Brooke declined to sponsor the Kemp-Roth 33-percent, three-year tax-cut proposal, citing its "inflationary effect," Nelson joined other conservative Republicans in making that the keynote of his campaign.

His first television ad showed the boyish-looking broadcaster reminding Massachusetts voters that "in 1963, President John F. Kennedy proposed a 10 percent across-the-board tax cut . . . It's time we had another Kennedy-style tax cut."

Embracing the martyred president from Massachusetts is only one of many devices Nelson has employed to soften his earlier image as a hardline rabble-rouser on the busing issue. In a studied bit of cuteness that has produced reams of favorable newspaper copy, he began calling his computer "Melinda" and making almost every public appearance with his pet dog, Phydeaux, pronounced Fido.

Despite being forewarned by conservative challenger Jeffrey Bell's upset victory over Sen. Clifford P. Case (R) in the New Jersey primary last June, Brooke was so mired in his divorce and financial problems that he was slow in launcing his renomination drive.

Aides concede that Brooke had neglected his home-state political chores in recent years, but for the last few weeks, he has been a hardworking candidate rising early in the morning to shake hands at Boston subway stops and staying late in the evening at sparsely attended candidates' meetings.

He has emphasized the more conservative aspects of his own record, telling a Brookline senior-citizens meeting that he favors capital gains tax cuts "to create meaningful, permanent jobs in the private sector," and oppose any cutbacks in defense spending as long as "the Soviet Union is testing us."

At a coffee hour hosted by along-time Republican Party worker in Waltham, Brooke was praised by Mayor Arthur Clark, a Democrat, but pointedly responded that while he appreciated Democratic support, "I happen to believe one-party government is bad government and I happen to be the only Republican in statewide office."

There, too, as he often does, Brooke raised the "personal issue" which Nelson avoids saying that "I have been through some very difficult days - difficult for my wife, my mother and my children. I wish it could have been otherwise, but I want to tell you, I have done nothing in my private or public life - I say this, looking you in the eye - that would bring discredit to my family, my friends, my party, my state or my nation."

Brooke's effective personal campaigning has been backed by targeted letters from prominent Massachusetts conservatives, appealing to other conservatives to help him, and letters asking independents, who can vote in either primary, to move into the GOP primary to help save the senator.

Whether such appeals will expand the normal primar turnout in a year when most voters seem indifferent to the pleas of politicans is doubtful enough to make Brooke and his aides plainly nervous about Tuesday's outcome.

In the overshadowed Democratic primary, state Rep. Elaine Nobe (D), an avowed lesbian, entered the race to challenge Brooke early when it seemed a suicide mission for any Democrat.

As Brooke's problems increased, she was joined by Tsongas, Guzzi and Kathleen Sullivan Alioto, the former Boston school committee chairman now married to former San Francisco mayor Joseph Alioto. Then Howard Phillips, a conservative Republican and Nixon administration official, entered the Democratic primary, hoping to capitalize on a divided liberal vote.

Only Tsongas, Guzzi and Alioto have found sufficient funds to mount major television campaigns, and the race in its final days seems to be between the first two. Guzzi, a statewide officials, was the early favorite, but Tsongas' greater facility with national issues and cleve ads, playing off his hard-to-pronounce name, have given him a slight edge in the view of some observers.

Either Tsongas or Guzzi would be a heavy favorite over Nelson in the general election.