HER COFFIN bore a dollar sign six feet tall; her first best seller celebrated a rape; her masterwork bears a dedication naming both her husband and a young lover 25 years her junior. Entirely dominant in her own marriage and the creator of some of literature's most forceful heroines, she fervently upheld a code of male supremacy and hero worship; a lifelong atheist and enemy of faith, she expressed a persistent belief in a "benevolent universe."

Through a life fraught with contradictions, she denied the logical possibility of contradiction and dismissed as morally depraved anyone who dared to persist in disagreement with her. She was in some ways a monster as well as a prodigy. Yet by relentlessly attacking the "unspeakable evil" and creative impotence of socialism at the time of its greatest ascendancy and by celebrating the moral and practical imperative of capitalism at its nadir -- in books that commanded the fealty of millions -- she was one of the great benefactors of the modern world.

Her masterpiece, Atlas Shrugged, stands as the most important novel of ideas since War and Peace. Yet this implacably intellectual work was first roundly hated and condemned and then obdurately ignored by America's intelligentsia. The book was saved for posterity by the word of mouth of masses of mostly non-intellectual readers who continue to buy her novels at the rate of some 300,000 copies a year and read them over and over for inspiration and guidance.

Who was Ayn Rand? The answer emerges at last in a superb biography written with much of the sweep, drama and narrative momentum of the great works of Ayn Rand herself -- and with the psychological insight and sensitivity that forever eluded her. The author is Barbara Branden, for 19 years Ayn Rand's closest friend. Also the former wife of Nathaniel Branden, Rand's lover and leading apostle, she brings to the biography unique insights into the sexuality of this great writer. Working with some 50 hours of biographical tapes, she achieves a remarkable balance of intimacy and objectivity in telling the tempestuous story of a flawed but heroic woman, who bore the moral defense of capitalism on her back like Atlas for nearly two decades, and never shrugged.

Born in Petrograd in 1905 as Alice Rosenbaum, daughter of a Jewish pharmacist, Rand lived through all the early horror and chaos of the Bolshevik Revolution, the brutal expropriation of her father and other shopkeepers, the murder and dismemberment of the Russian royalty and their children. Then through a series of dramatic events stirringly told by Branden, Rand finally made her way to the United States, which had served for her as a promised land ever since her first encounter with the movies of Cecil B. DeMille. After several months with relatives in Chicago, she traveled to Hollywood where through an amazing series of coincidences she was adopted as a protege' by DeMille himself. But after a few years as a screenwriter, she found herself struggling through the Great Depression in an intellectual environment in which the Soviet charnel house she had managed to escape was widely seen as the last great hope for humanity. She resolved to tell the world what she knew of the reality behind the fatuous dream. The result was a series of prophetic novels, manifestos, and the creation of her own philosophy, Objectivism.

Ayn Rand's greatness stems from the fact that unlike the scores of other intellectual refugees from the East and defectors from Communism, from George Orwell to Arthur Koestler, she understood from the beginning that the source of the evil was the ideology of socialism itself. Unlike other critics of the morality of socialism, moreover, she never imagined for a moment that the system could work. She believed that socialism was evil and that the very essence of its evil was the suppression of the individual heroism and creativity that is indispensable to all human progress. Unlike other defenders of capitalism, she did not indulge the claims that it is somehow amoral and in a sense less idealistic than socialism. She knew that capitalism could not prevail unless its superior morality as well as its efficiency was recognized and acclaimed.

Despite the evidence of 30 years' stagnation in most socialist nations (which have been sustained only by subsidies and technologies from a generally flourishing capitalist world), many of Rand's insights are still not understood by pro-capitalist intellectuals today. Many still maintain that the system is amoral and then wonder why it is not embraced by idealistic youth. Many still ascribe the Great Depression not to a remorseless 10-year onslaught of tariffs, taxes, and tight money but to the "excesses" of capitalism. But partly thanks to her work, the consensus today is far more favorable to capitalism than the prevailing views of her time. Rand flung her gigantic books into the teeth of an intelligentsia still intoxicated by state power, during an era when even Dwight Eisenhower maintained tax rates of 90 percent and confessed his inability to answer Nikita Khrushchev's assertion that capitalism was immoral because it was based on greed. FROM THE EARLY struggles of this penniless immigrant with faltering English and hated views, to the long trials of The Fountainhead, rejected by 12 publishers, released in niggling printings of a few thousand, demolished by most critics, and finally discovered by a tide of readers that continues in flood 30 years later -- and on to the similar ordeal and triumph of Atlas Shrugged -- Rand's life story is one of the great sagas in the history of literature. With the help of long quotes from Rand that at times give the book the feel of autobiography, Branden triumphantly rises to the occasion of telling it.

Branden's work also dramatizes the flaws in Rand's philosophical scheme. One of the century's most important writers and thinkers, she was also one of its less sensitive human beings. Her obtuseness reached a climax in her sexual relationship with Nathaniel Branden when she brought her husband Frank O'Connor and her friend Barbara Branden together to endorse her heroism and rationality in seeking an affair with Barbara's husband.

Rand maintained that the belief in an irrational sex drive, unrelated to philosophical principles, was similar to the Marxist belief in the primacy of matter. Just as Rand asserted that the material achievements of entrepreneurs reflect a spiritual creativity akin to the greatest of artists, she contended that her desire for Nathaniel's young body reflected an exalted morality. When 10 years later -- she in her sixties, he in his thirties -- he finally rejected her body, she took it as a philosophical betrayal. She rejected him, her leading apostle and prote'ge', and began a bitter vendetta that lasted to the end of her life.

Rand's basic incomprehension of familial and sexual realities undermined all her life and works. Her all-consuming rationalism rejected all relationships that were not rationally chosen, all love that was not earned by virtue, all actions that were not motivated by self-interest and personal happiness. This philosophy collapses instantly in the context of a family, the personal fabric of every society and economy. Families depend on the acceptance of unchosen commitments and relationships. They depend on altruism: service -- unearned by proved virtue or assured reward -- to children and relations. Although Rand's mother in Russia sold her last jewels to buy Ayn's tickets to America and Ayn's relations in Chicago agreed to accept her sight-unseen and supported her for a year after she arrived -- and even though O'Connor married her chiefly to give her citizenship as her visa ran out -- Rand persisted in her claim that she owed nothing to others. When she grew rich and famous, she virtually ignored her relatives and treated Frank with callous disregard. The recognition that the altruism of her unchosen relatives and Frank had saved her would have created a "contradiction" between her life and her philosophy -- and such a contradiction she could not tolerate.

In her novels, she simply avoids the problem by excluding families altogether. Although she exalts sexual pleasure to a virtually religious pinnacle in her philosophy, her heroes and heroines are all childless: copulating abstractions that give birth to rationalizations rather than babies. By excluding the domain of procreative sexuality, she misses the altruistic and unconditional love at the very core of the human experience. Indeed, the uniquely prolonged helplessness of human offspring means that parental love is indispensable to human life and development.

Missing this dimension of family life, she also misses the essential altruism, the orientation toward the needs of others, that is crucial to production for the marketplace. As Rand eloquently and persuasively maintains, self-esteem and confidence is indispensable to entrepreneurial achievement. But so too is sensitivity and attentiveness to the needs and wants of others and alertness to the contributions of others. Only under socialism do favored industrialists pursue self-expression first and manufacture whatever they want -- or whatever the rulers dictate. In fact, one of the great appeals of socialism to intellectuals is that it avoids the need to produce vulgar goods demanded by the masses. The planners decide what the people should need. The heroes of capitalism are not arrogant producers of goods immaculately conceived in their own minds; capitalists imaginatively serve the minds and needs of others. IGNORING the altruistic aspect of family and business life, Rand also misunderstands the role of religions that uphold the unselfish moral codes essential to productive families and enterprises. Launching a false duality of her own, she asserts an inexorable divorce between reason and religion, and asserts the identity of Marxism and Christianity, collectivism and altruism (a view ironically shared by Marxist Liberation theology). As she eloquently demonstrates, however, the altruism of socialism and the welfare state is almost entirely bogus. A cheap charity that all too often spends the earnings of others in ways that degrade and demoralize the alleged beneficiaries, socialism is totally alien to Christian charity, which is freely chosen by the donors and made effective by love and moral teaching.

In addition, Rand fails to comprehend that her rationalism comes perilously close to a hermetic system of causes and effects -- a total and mechanistic logic pervading the universe -- that contradicts her assertions of free will. A world of Randian heroes would not only fail to reproduce itself; it would also find itself bound in chains of mechanistic rationality. Modern physics and mathematics both deny the sufficiency of such rationalism. Rand is objectively wrong when she asserts as an axiom that every effect must have a cause and that the perplexities of quantum theory are "mere mathematical problems." Mathematics is near the foundation of her logical system and she is inconsistent in so cavalierly dismissing its limitations. Religious commitments, including her own faith in reason and in a "benevolent universe," are crucial to a belief in meaningful free will as opposed to an irrational existentialism.

Such objections to Rand's philosophy might seem to disparage her achievement. But in fact, like every great thinker, she transcends her contradictions. In a world where most novelists lack any coherent philosophy at all, her work looms as a major triumph. Barbara Branden's own triumph is to show in full human detail the sources both of this achievement and its notable but ultimately venial flaws.

George Gilder is the author of "Wealth and Poverty." His forthcoming books include "Microcosm," an analysis of the computer and microchip industries, and a revised edition of "Sexual Suicide."