Bias is much harder to demonstrate scientifically in real life, which may be why large numbers of people do not believe that sexism and other forms of prejudice still exist. Many people think we live in a "post-racial" and "post-sexist" world where egalitarian notions are the norm. Indeed, if you go by what people report, we do live in a bias-free world, because most people report feeling no prejudice whatsoever. What would be remarkably instructive in real life would be if women in various professions could experience life as men, and vice versa. If the same person got treated differently, we would be sure sexism was at work, because the only thing that changed was the sex of the individual and not his or her skills, talent, knowledge, experience, or interests. Joan Roughgarden and Ben Barres are biologists at Stanford University. Both are researchers at one of the premier academic institutions in the country; both are tenured professors. Both are transgendered people. Stanford has been a welcoming home for these scientists; if you are going to be a transgendered person anywhere in the United States, it would be difficult to imagine a place more tolerant than Palo Alto and the San Francisco Bay Area. Ben Barres did not transition to being a man until he was 50. For much of her early life, Barbara Barres was oblivious to questions of sexism. She would hear Gloria Steinem and other feminists talk about discrimination and wonder, "What's their problem?" She was no activist; all she wanted was to be a scientist. She was an excellent student. When a school guidance counsellor advised her to set her sights lower than MIT, Barbara ignored him, applied to MIT, and got admitted in 1972. During a particularly difficult maths seminar at MIT, a professor handed out a quiz with five problems. He gave out the test at 9am, and students had to hand in their answers by midnight. The first four problems were easy, and Barbara knocked them off in short order. But the fifth one was a beauty; it involved writing a computer program where the solution required the program to generate a partial answer, and then loop around to the start in a recursive fashion.

"I remember when the professor handed back the exams, he made this announcement that there were five problems but no one had solved the fifth problem and therefore he only scored the class on the four problems," Ben recalled. "I got an A. I went to the professor and I said, 'I solved it.' He looked at me and he had a look of disdain in his eyes, and he said, 'You must have had your boyfriend solve it.' To me, the most amazing thing is that I was indignant. I walked away. I didn't know what to say. He was in essence accusing me of cheating. I was incensed by that. It did not occur to me for years and years that that was sexism." By the time she was done with MIT, Barbara had more or less decided she wanted to be a neuroscientist. She decided to go to medical school at Dartmouth in New Hampshire. Gender issues at med school were like the issues at MIT on steroids; one professor referred Barbara to his wife when she wanted to talk about her professional interests. An anatomy professor showed a slide of a nude female pin-up during a lecture. During the first year of Barbara's residency, when she was an intern, she found herself clashing with the chief resident. "When you have to learn to do a spinal tap or do a line, at some point only one person can do the procedure. What I noticed is that every time a male resident would do the picking, he would pick a guy to do the procedure. I had to often say, 'He did it last time. It is my turn this time.' " But things changed in large and subtle ways after Barbara became Ben. Ben once gave a presentation at the prestigious Whitehead Institute in Cambridge, Massachusetts. A friend relayed a comment made by someone in the audience who didn't know Ben Barres and Barbara Barres were the same person: "Ben Barres gave a great seminar today, but, then, his work is much better than his sister's."

Ben also noticed he was treated differently in the everyday world. "When I go into stores, I notice I am much more likely to be attended to. They come up to me and say, 'Yes, sir? Can I help you, sir?' I have had the thought a million times, I am taken more seriously." When former Harvard president Larry Summers (who went on to become a senior economic adviser to President Barack Obama) set off a firestorm a few years ago after musing about whether there were fewer women professors in the top ranks of science because of innate differences between men and women, Ben wrote an anguished essay in the journal Nature. He asked whether innate differences or subtle biases - from grade school to graduate school - explained the large disparities between men and women in the highest reaches of science. "When it comes to bias, it seems that the desire to believe in a meritocracy is so powerful that until a person has experienced sufficient career-harming bias themselves they simply do not believe it exists … By far, the main difference that I have noticed is that people who don't know I am transgendered treat me with much more respect: I can even complete a whole sentence without being interrupted by a man." Joan Roughgarden came to Stanford in 1972, more than a quarter century before she made her male-to-female transition in 1998. When the young biologist arrived at Stanford, it felt as though tracks had been laid down; all Roughgarden had to do was stick to the tracks, and the high expectations that others had of the young biologist would do the rest. "It was clear when I got the job at Stanford that it was like being on a conveyer belt," Roughgarden told me in an interview. "The career track is set up for young men. You are assumed to be competent unless revealed otherwise. You can speak, and people will pause and people will listen. You can enunciate in definitive terms and get away with it. You are taken as a player. You can use male diction, male tones of voice. … You can assert. You have the authority to frame issues."

At the Hopkins Marine Station in Pacific Grove, an outpost of the university about 150 kilometres from campus, Roughgarden ruffled feathers in the scientific establishment by arguing that a prominent theory that described the life cycle of marine animals was wrong. Where previous research had suggested that tide pools were involved in the transportation of certain larvae, Roughgarden reframed the issue and showed that the larger ocean played a significant role. The new theory got harsh reviews, but Roughgarden's ideas were taken seriously. In short order, Roughgarden became a tenured professor, and a widely respected scientist and author. Like Ben Barres, Roughgarden made her transition to Joan relatively late in life. Stanford proved tolerant, but very soon Joan started to feel that people were taking her ideas less seriously. In 2006, for example, Joan suggested another famous scientific theory was wrong - Charles Darwin's theory of sexual selection. Among other things, the theory suggests that men and women are perpetually locked in a reproductive conflict. Men are supposed to be sexually promiscuous because they stand to gain from spreading their genes as widely as possible, whereas women are supposed to value monogamy because they can have relatively few biological children. Even when women and men escape from this "battle of the sexes", it is only because a temporary truce has been declared. A monogamous husband, for example, "forgoes" his natural inclination to infidelity because his partner offers him something of exceptional value - such as beauty or youth. The theory essentially suggests that conflicting goals are basic to all male-female human relationships - and even purports to "explain" why men rape women. Using ideas from game theory, Joan published a review article in the prestigious journal Science, where she explained why she thought the theory was wrong. Thinking about sex purely in terms of reproduction was flawed, Joan argued. Sex was also about building alliances, trading, co-operation, social regulation and play. Joan used the example of the Eurasian oystercatcher, a wading bird, in her 2006 paper. In particular, she looked at nests involving three birds, a male and two females. In some of these families, the females fought viciously with each other, whereas in others, the females mated with each other almost as often as they mated with the male. Nests where females bonded sexually were much more likely to have offspring that survived, compared with nests where the females fought each other, since the co-operative nest could call on the resources of three birds to defend offspring against predators. Sex between the females may not have produced offspring, but it had a powerful effect on the survival rate of offspring.

Where Darwin's theory of sexual selection would argue that the competing interests of males and females are what produce a range of sexual behaviours, Joan's theory of "social selection" offered a different viewpoint: conflict between Eurasian oystercatchers, as perhaps with conflict between human mates, was not the starting point of relationships but an unfortunate outcome. Co-operation, not conflict, Joan argued, was basic to nature. "Reproductive social behaviour and sexual reproduction are co-operative. Sexual conflict derives from negotiation breakdown.'' THE scientific establishment, Joan said, was livid. But in contrast to the response to her earlier theory about tide pools and marine animals, few scientists engaged with her. At a workshop at Loyola University, a scientist "lost it" and started screaming at her for being irresponsible. "I had never had experiences of anyone trying to coerce me in this physically intimidating way," she said, as she compared the reactions to her work before and after she became a woman. "You really think this guy is really going to come over and hit you." At a meeting of the Ecological Society of America in Minneapolis, Joan said, a prominent expert jumped up on the stage after her talk and started shouting at her. Once every month or two, she said, ''I will have some man shout at me, try to physically coerce me into stopping …When I was doing the marine ecology work, they did not try to physically intimidate me and say, 'You have not read all the literature.' "They would not assume they were smarter. The current crop of objectors assumes they are smarter." Joan is willing to acknowledge her theory might be wrong; that, after all, is the nature of science. But what she wants is to be proven wrong, rather than dismissed. Making bold and counter-intuitive assertions is precisely the way science progresses. Many bold ideas are wrong, but if there isn't a regular supply of them and if they are not debated seriously, there is no progress. After her transition, Joan said she no longer feels she has "the right to be wrong".

Where she used to be a member of Stanford University's senate, Joan is no longer on any university or departmental committee. Where she was once able to access internal university funds for research, she said she finds it all but impossible to do so now. Before her transition, she enjoyed an above-average salary at Stanford. But since her transition, "My own salary has drifted down to the bottom 10 per cent of full professors in the School of Humanities and Sciences, even though my research and students are among the best of my career and are having international impact, albeit often controversial." I asked her about interpersonal dynamics before and after her transition. "You get interrupted when you are talking, you can't command attention, but above all you can't frame the issues," she said. With a touch of wistfulness, she compared herself to Ben Barres. "Ben has migrated into the centre whereas I have had to migrate into the periphery." Shankar Vedantam is a 2009-10 Nieman fellow at Harvard University and a national science writer at The Washington Post. This is an edited extract from The Hidden Brain, published in Australia by Scribe. RRP $35