Even among those who predicted China's bloody and probably short invasion of Vietnam, there seems no entirely satisfactory answer to one question: Why did the Chinese do it?

In return for a brief chance to test its army and cripple Vietnamese border forces, Peking has frightened Southeast Asian leaders, annoyed U.S. policymakers and bolstered Soviet attempts to cut off its supply of Western weapons. The immediate problems that led to the invasion, Vietnam's successes in Cambodia and its border raids into China, are unlikely to dissolve just because China took a quick plunge into northern Vietnam.

"I operate on the principle that if you assume everybody is going to make the worst possible decisions, you're never disappointed," said one analyst who correctly predicted the invasion. "I guess we have to stop interpreting Chinese actions from our point of view and try to see what they think they need."

Foreign observors searching for a word to explain the Chinese urge to punish Hanoi often refer to fears of loss of "credibility," which may have once motivated the ill-fated U.S. involvement in Vietnam. Other analysts speak of a more visceral desire to reestablish a national sense of "macho," or masculinity.

The later term, used only by male analysts, may be keenly understood by a Latin American diplomat such as Alejandro Orfila, who seemed to sense that sort of pride in Vice Premier Teng Hsiao-ping's remarks to him about the invasion.

"One philosophy that this country seems to have is that you can discuss and you can negotiate and you can have a dialogue with people, but if the people on the other side do not answer the dialogue, then you cannot tolerate things that could be misconstrued and could be interpreted as weakness," Orfila said in Peking after meeting with Teng.

Some analysts also think the Chinese hoped to frighten North Vietnam into important concessions that would weaken its firm grip on the new government in Cambodia, a country that was once firmly in Peking's camp. Teng and other Chinese leaders went to considerable effort to lure the irrepressible Prince Norodom Sihanouk back to Peking after his swing through Washington and New York. Many diplomats think this means Peking has hopes Sihanouk might still be their man to form a new Cambodian government. This overlooks several important factors including Hanoi's military grip on Phnom Penh and Sihanouk's own distaste for the pro-Peking Cambodian communists who imprisoned him during the three years they held power.

The invasion, if it lasts longer than most outsiders expect it to, could draw Vietnamese troops out of Cambodia and give heart to the pro-Peking insurgents, the Khmer Rouge. "They fight almost entirely on morale," said one analyst of the remnants of the pro-Chinese Pol Pot government that lost to Vietnamese troops in early January.

But in perhaps the most obvious of several losses suffered by the Chinese in this invasion, Hanoi now regains an image abroad as a valiant underdog fighting off a much bigger power. Vietnam's own invasion of Cambodia had wiped out much of the admiration it had gathered abroad during its decade-long war against the United States. Vietnam found it impossible to win a seat in the United Nations for the government it installed in Phnom Penh, but the Chinese invasion may help ease the pain of that diplomatic defeat.

Peking has placed great emphasis in the last few months on its rapidly developing relationship with the United States. The Chinese used considerable ingenulty in creating an impression that they had no further hostile intentions toward the off-shore island of Taiwan, whose eapitalist economy and relatively free environment guarantees support from Americans. But several members of Congress have objected to the Carter administration's formula for ending all official ties with Taiwan in order to recognize Peking. The administration's key argument, that the Chinese can be trusted not to engage in military adventures in the Taiwan strait, may be seriously weakened by events in northern Vietnam.

Aside from further aggravating its long feud with Vietnam's ally, the Soviet Union, China's invasion has probably fueled the Soviet campaign to spike shipments of European weapons to Peking, such as the tentative agreement to sell Harrier vertical-takeoff jets to China.China's crucial modernization program cannot profit from continued hostility on both its northern and southern borders. A demonstrated Peking weakness for flexing its military muscles may also worry Western bankers who might prefer to lend funds to more peaceful and, in their eyes, more stable clients.

In non-communist Southeast Asia China has been engaged in a diplomatic duel with Vietnam to win friends and has been trying to show Hanoi to be the greater threat to peace and internal security in such places as Malaysia and Thailand. The invasion does not help Peking's argument. It may create further problems for the Chinese resident minorities who already have difficult relationships with their Southeast Asian governments.

There is, in addition, no small irony that the attack on Vietnam was launched while Indian Foreign Minister Atal Bihari Vajpayee was in Peking trying to patch up differences stemming from the 1962 Sino-Indian border war. India, in line with its policy of nonalignment, has close ties with Vietnam and its moves toward Peking were an attempt to show some independence of the Soviet Union.

When Vajpayee learned of the attack on Vietnam, he cut short his visit by a day and said in the Indian Parliament Tuesday that China's "massive armed incursion" in Vietnam "must be... reversed as soon as possible..." One of the first clear casualties of Peking's thrust, then, is the opportunity to improve ties with its huge southern neighbor -- some would say at Moscow's expense.

"The Chinese were really beginning to be afraid they looked like a paper tiger, so this action probably made them feel better," said one observer here. "But if they have to stage a repeat performance every time they begin to feel unappreciated, they may be in trouble."