Twilight Sparkle is a student of Princess Celestia who used to live in Canterlot until she was assigned to Ponyville to oversee the Summer Sun Celebration preparations, which became her permanent home after she expressed an interest in staying with her friends, and Princess Celestia assigned her to Ponyville full time to "study the magic of friendship."
In Magical Mystery Cure, Twilight Sparkle moved back to Canterlot again, because she had became a Princess.
For a unicorn who's new to the magic of friendship, Twilight Sparkle gets an "A+." She uses her magical powers to help her friends, and she's always ready to lend a helping hoof. Sometimes she gets on her high horse, but her love for her friends makes her a natural leader. She earned her cutie mark when Rainbow Dash's first sonic rainboom made her go crazy with magic while doing an entrence exam to Celestia's School for Gifted Unicorns. The exam was for her to hatch a baby dragon from an egg, but couldn't do it until the rainboom came caused by Rainbow Dash.
ElementEditTwilight's element is Magic, which is one of the Elements of Harmony. The others are: Kindness, Generosity, Honesty, Loyalty, and Laughter.
Twilight is an alicorn pony (formally a unicorn) who has indigo hair with purple and pink streaks, and a light violet body. Her cutie mark is a large pink sparkle, surrounded by five small white sparkles.
These six total sparkles on her cutie mark represent the six Elements of Harmony and the ponies who are associated with them:
Magic/Leadership (Twilight Sparkle)