In Search of Gender
A demystification of the biology of sex, gender, and those who do not conform with the sex assigned at birth
The topic of gender identity is still the source of controversy in the public discourse and often leads to skepticism about the existence and legitimacy of people who do not conform to the sex they were assigned at birth. In the midst of this, the idea that this subject has no scientific integrity and, even worse, that biology is on the side of those who defend the binary essentialism of sexuality, has somehow prevailed. However, the complex variability of the biological world is inherently opposed to this idea.
This article was originally published in Diferencial in Portuguese.
The existence of the sexes — that is, the biological distinction between male and female — is, from an evolutionary point of view, something that demands explanation. In general, organisms’ traits vary continuously and independently; jumps are not observed. However, in polymorphisms such as sexual dimorphism, these do occur: a single gene or signaling molecule is enough to give rise to completely different morphologies, despite these being made from essentially the same genomes¹. How can we explain this? 
The Castes of Ants
The caste of an ant is defined by molecular signals, as is often the case with sex. For ants, it is the food they eat as larvae that determines whether they will be a worker or a queen. But how is this distinction maintained, biologically speaking? To understand it, it is enough to consider that, in the context of an ant colony, the activation of queen genes does not bring any benefit — and indeed, brings detriment — in bodies that in everything else are workers' bodies, and vice versa. A fat worker who cannot move or a queen who cannot lay eggs are — generally speaking — equally incapable of contributing to the upkeep of the colony, and therefore natural selection keeps them as distinct phenotypes², even if intermediate forms sometimes arise. [2, 3]
There is no one to decide that there are ants of one type and another — there is a selective pressure that gives rise to the illusion that there are distinct castes, when in fact all ants are made from the same genomes.
But throughout evolutionary history, these intermediate forms can become new castes, which bring their own benefits to the colony. And, after all, once upon a time the wasps that gave rise to ants were all fertile and did not live in colonies. Even so, natural selection reinvented the wasp, such that infertile workers became fit organisms.  It is, then, due to the existence of these intermediate forms that we cannot fall into essentialism: there are in fact no “queen ants” and “worker ants”. There are sets of genes that tend to be expressed together in the same body, giving rise to a set of traits that, on the one hand, come statistically distributed in the population in two “peaks” and which, on the other hand, are associated. Winged ants tend to become large egg-laying ants, and wingless ants tend to grow less and have instincts to work on the maintenance of the anthill. It is from these trends and statistical dependencies that we infer — or impose — the existence of two castes, queen ants and worker ants, merely as a linguistic aid. Mother Nature does not follow a plan, and so intermediate morphologies are not “mistakes”. There is no one to decide that there are ants of one type and another — there is a selective pressure that gives rise to the illusion (so to speak) that there are distinct castes, when in fact all ants are made from the same genomes.
And what applies to castes also applies to the sexes.
Sex, Gender & Chromosomes
What distinguishes a male from a female? If we cannot use a simple criterion, such as the gametes they produce (because an infertile organism is not sexless), perhaps we can say that males are those whose phenotype is associated with sperm production, and females are those whose phenotype is associated with egg production. But how do we define “associated”? What is it that determines how the phenotype of a given organism will develop?
In humans, the main component of sex determination is only a small part of the Y chromosome, the SRY region, which initiates the masculinization of the fetus.  However, for the molecular signal produced by the genes of this region to be read by the developing body, it is also necessary that the molecules that read it are working “correctly”. When this is not the case, situations such as Androgen Insensitivity Syndrome occur, in which XY individuals are assigned female at birth and, in most cases, also self-identify as female. Despite this, internally these women do not have a “female” reproductive system, and in most cases do not produce either sperm or eggs (although the production of the former is sometimes possible).  Looking at the definition I used above, that “the females are those whose phenotype is associated with egg production,” we see that even here we find difficulties — to what parts of the phenotype are we referring to, after all? The body of an organism does not appear all at once, and the different aspects of sexual dimorphism do not always arise in sync. And this is just one example of the variety of chromosomal arrangements that people can have, a variety which does not end at that level, as there is an abundance of ways in which people can be what is called intersex. Like intermediate castes, these individuals are not nature's “mistakes” — they are examples of how nature is not based on plans.  Further, it is important to point out that the abstract concept of an organism being “fit” is often nebulous and flexible and that, especially in the context of humans, it is completely orthogonal to a person’s societal role and value.
If in sex we see a wide variety and not a true dimorphism, then in sexual behavior and identity (if there is such a thing in other animals) we should expect this as well. Biology does not draw hard lines.
Sexual dimorphism does not refer exclusively to outward appearances. The phenotype of an organism also encompasses its behavior and its internal states. For instance, male lions generally do not behave in the same way as female lions, and the roles they play within their communities are also distinct. Moreover, if, on the one hand, we recognize that animals have a behavioral tendency to seek sexual relations with the opposite sex (even if it is not the strictest trend), then, on the other hand, we can consider the possibility of an animal recognizing its own sexual identity. It is not only about how the animal behaves, but also how an animal self-identifies in relation to others in its community. And, if in sex we see a wide variety and not a true dimorphism, then in sexual behavior and identity (if there is such a thing in other animals) we should expect this as well. Biology does not draw hard lines. If a female lion can have a mane, is it not just as conceivable for a male lion to act like a female, or even to feel like one? This is not merely plausible — it should be expected.
A Social Construct
In 1995, Swaab et al. conducted a postmortem study in which they observed neuroanatomical differences between people who do not conform to the sex assigned at birth and people who do. In certain regions, the brains of trans women (who self-identify as women but who were assigned male at birth) are more like the brains of cis women, and the same applies to trans men and cis men.  Studies like this one can help to convince us of the legitimacy of trans people’s experiences, but we ought to be careful to avoid being transmedicalists. No one who is non-conforming with the sex assigned at birth is diagnosed with a brain scan. What is used are psychological assessments that are based on people's personal experience, which should be the sole criterion for assessing someone’s gender.³ 
No one in the sociological sphere knows the chromosomes, the private parts, nor the internal states of others. What we know is the roles we play, and it is this social construct that defines how we identify the gender of those around us.
But then, what is gender, and what is it determined by? First of all, we must recognize that trans and non-binary people report an internal gender, a sense that they are boys or girls, or maybe something in between or something undefined or entirely outside the binary. Basing our concept of gender on a feeling seems to be a fragile position, yet denying this feeling has as much legitimacy as denying anyone's subjective experience. A trans or non-binary person can prove their gender identity as easily as they can prove that they experience the color red, or that they feel pain. This is, therefore, a facet of what gender is: an inner feeling, or a mental state. And, based on the aforementioned study and others like it, it seems that this internal feeling is something that is determined during fetal development — being established before birth — and that it is closely related to the neurophysiology of the person. This does not mean, however, that we can see gender in a brain scan or medical exam — any relationship between physiology and identity will be statistical, with ample room for variation.
A second facet of what gender is relates to behavior and social presentation, but the situation becomes complicated when we talk about humans. Men and women behave and present themselves in different ways, but these factors vary throughout history and from culture to culture, so they cannot be totally innate. There is nothing about pink, dresses, or makeup that is inherently “feminine”, there is nothing about being a construction worker that is fundamentally “masculine”, and there are no biological reasons why any set of pronouns should be imposed on any individual. In this case, gender is not just about behavioral trends inherent to the physiology of the person: it is a performance, guided by social norms. No one in the sociological sphere knows the chromosomes, the private parts, nor the internal states of others. What we know is the roles we play, and it is this social construct that defines how we identify the gender of those around us.
Thus, if the traits related to sexual dimorphism, like all others, can vary continuously and independently, then we must conclude, from a biological standpoint, that there might be people who feel like men, and who wish to live life as men, but who in all external respects appear to be women — or vice versa. Likewise, we should conclude that there may well be people whose internal states are neither particularly masculine nor feminine. Moreover, we should recognize that such a dissonance between the psychological state and the social role and physical aspect of a person could give rise to distress, so-called gender dysphoria. These ideas are not opposed to biology; quite the contrary, they are in perfect agreement with it. Unfortunately, however, these people’s existence, their needs, and the injustices they highlight in our societal structures are consistently sidelined or otherwise regarded with undue skepticism and revulsion. Perplexingly, this treatment is often justified with the idea that the sexual binary is “basic biology”. This could not be further from the truth.
¹The genome is an organism’s set of genes.
²The phenotype is an organism’s set of observable traits.
³Transmedicalism refers to the notion that suffering from gender dysphoria or going through gender transition are necessary factors for being trans, but it is also otherwise associated with the idea of treating being trans as a medical (and sometimes specifically neurological) diagnosis. The DSM, quoted here, defines the diagnosis of gender dysphoria uniquely in terms of a person’s experience, and also states that experiencing gender dysphoria is not necessary for a person to be trans.
 R. Singh, Elements of Entomology, Rastogi Publications, 2006, p. 284.
 American Psychiatry Association, Diagnostic and Statistical Manual of Mental Disorders (DSM-5), 5 ed., American Psychiatric Publishing.