Matrix is a being from a pocket universe who became known as Supergirl. She was created by John Byrne as part of his Superman revamp.
In an alternate reality (a "Pocket Universe") three Kryptonian criminals escaped the Phantom Zone, and tried to take over that reality's Earth. There was no Superman in this reality (his younger self, Superboy, having died before the criminals' escape) but there was a Lex Luthor who hadn't gone bad. Using an artificial life-form called the "protoplasmic matrix," Lex created a red-headed woman, Matrix, who resembled his true love, the deceased alternate-reality Lana Lang. Matrix possessed all Lana's memories, due to Lana's synaptic pathways being copied into Matrix. Lex had also patterned her physiology to resemble Superman's, whom he had seen by using one of his many inventions to look into the mainstream universe.
Like Superman, Matrix was superhumanly strong and fast, and could fly, but she also had the powers of shapeshifting, telekinesis, and cloaking (including invisibility). Matrix wore a version of Superman's uniform, shape-shifted into a young blonde woman, and fought the three criminals as Supergirl. However, her powers were no match for theirs. Desperate, Lex sent Matrix into the mainstream universe to recruit Superman. Her efforts were successful, and Superman did aid in stopping the Kryptonian criminals, but the alternate Earth had been ruined, and was now lifeless. Superman took the orphaned Matrix back to the mainstream DC Universe with him, where she served as the Post-Crisis world's first in-continuity Supergirl.
Upon arrival on the mainstream Earth, Matrix was taken to live with Superman's parents, the Kents. Jonathan and Martha did a fine job raising their new "daughter", but Matrix (or "Mae" as the Kents named her) became delusional for a time, believing she was Clark, even assuming his form. After a fight with the real Superman, Matrix came to her senses, but concerned that she might become unstable again and cause the Kents harm, she fled into outer space.
After many adventures, and after playing an important part in the "Panic in the Sky" storyline, she returned to Earth where she met and fell in love with the mainstream Lex Luthor (disguised at the time as his own son). Again donning the uniform her reality's Lex had given her, (and once again in the form of the young blonde woman), she assumed the role of Supergirl in the mainstream DC universe, determined to make this Earth a better one than the one she left. One of her first acts was to return to Smallville, Kansas, and reunite with her "parents," Jonathan and Martha Kent.
Her parents and Superman were shocked when they learned that their dear Mae was now dating Luthor. Mae began living with Lex, and even had an altercation with her "brother" Superman over it.
During the Death of Superman arc, Matrix was eager to help in the fight against the menacing Doomsday, but Lex kept her at bay, keeping her with him. When Doomsday reached Metropolis, she rebelled against Lex and went to fight the monster, only to be knocked out in a single blow, forcing her to unconsciously take her true form of a gray, humanoid mass.
When Superman died stopping Doomsday, Supergirl used her powers to protect Metropolis, but was met with some derision, as many people saw her as Luthor's "pet". She did an admirable job of rescuing victims, teaching the new hero Superboy about the importance of being serious when saving lives, and helped Superman return once he was found to be alive again. She even posed as Clark Kent, pretending that Clark was trapped in a well-stocked cellar during Doomsday's initial attack, to help explain why Clark was gone while Superman was dead.
But her biggest shock came when she learned that Lex had cloned her, making thousands of his own personal "Supergirls". She went berserk, and destroyed his lab, his clones, and almost killed Lex before he fell into a coma. She decided to join the Teen Titans for a short while, but left shortly afterwards, realizing that it just wasn't for her.
After some soul searching, Mae began to wonder if she was even a real person or if she even had a soul. But this was solved when she held the hand of a dying girl named Linda Danvers. Matrix's shapeshifting ability merged the two into the new Supergirl and Mae became the Earth Angel of Fire, simultaneously losing her shape-shifting abilities as she subconsciously defined herself as just Linda and Supergirl. The remnants of her protoplasmic form that were not absorbed in the merge became an evil, insane Matrix, who fought the Mae/Linda merged Supergirl, until she was absorbed by Blithe, the Earth Angel of Light. Later, when the good aspect of Matrix was separated from Linda, she was merged with Twilight, and became a new Angel of Fire.