K-9 was the companion to the Doctor and later to Leela, Romana and Sarah Jane Smith.
Profile
Biography
Professor Marius invented the first K-9 because weight requirements did not allow him to bring his real dog from Earth into space (DW: The Invisible Enemy) though K-9 may owe his existence to a temporal paradox. According to one account, the professor copied the remnants of one of the version of K-9 created by the Doctor and given to Sarah Jane Smith. (DWM: Tautology)
The Professor offered K-9 to the Doctor as the same weight requirements made him unable to take Mark I back to Earth with him. (DW: The Invisible Enemy) After a number of adventures with Leela and the Doctor, Mark I decided to stay on Gallifrey with his "mistress" and the Doctor left with Mark II in the TARDIS. (DW: The Invasion of Time)
Eventually, Romana and K-9 Mark II left the Doctor together, deciding to stay in E-Space. (DW: Warriors' Gate) Like Mark I, Mark II would also eventually come to live on Gallifrey. (NA: Lungbarrow)
The Doctor made K-9 Mark III as a gift for Sarah Jane Smith (A Girl's Best Friend) and then Mark IIIb after Mark III destroyed himself battling the Krillitanes. (DW: School Reunion)
Personality
K-9 had a very consistent personality from model to model. He had a polite, formal manner with just a hint of pedantry bordering on condescension. Though he often displayed feelings such as sorrow (DW: The Invasion of Time) and self-regard (DW: School Reunion), he often stated that he had not been programmed to have emotions.
He did not use contractions just as "you've" for "you have" and addressed others by titles such as "Master", "Mistress", "Doctor-Master" (to refer to the Doctor) or "Young Master" (Adric and in one instance Clyde). Though he did not seem to resent his subordinate status, he tended to side with the Doctor's companions over the Doctor himself and at times showed a dark side, regarding other artificial intelligences with contempt (DW: The Invasion of Time) and relishing a brief chance to act as a figure of power (MA: The Well-Mannered War) He usually did not engage in computer-like literal thinking, though on one occasion he followed Romana's instructions to "forget it" to the letter and erased all his knowledge of tennis from his memory banks. (DW: The Stones of Blood)