Image copyright Reuters Image caption Elon Musk, It Boy of Silicon Valley

The Falcon Heavy's boosters burned for 154 seconds before they were jettisoned into space. Free from the main body of the rocket, they spun 180 degrees and arced back towards the earth, burning their engines again as they descended to Cape Canaveral, to land, smoothly, improbably upright, within a second of one other.

Meanwhile, the main rocket pushed on, preparing to bring the world an even less credible sight. Four minutes into the flight, the nose cone broke apart to reveal its payload: a cherry-red electric sports car, with the top down, in space - a PR stunt for the ages.

It was all brought to you by Elon Musk, the South African-born billionaire entrepreneur and founder of Paypal, electric car company Tesla, and SpaceX, the manufacturer of the Falcon Heavy. The partly-reusable Heavy is the most powerful rocket on earth, and, if Mr Musk is to be believed, a stepping stone to a rocket to Mars.

The sports car in the nosecone was one of Mr Musk's own Tesla Roadsters. Its stereo was programmed to play David Bowie's Space Oddity on repeat as it travels for millions of years through space. Or until the battery dies, anyway.

"It's kind of silly and fun," he conceded, "but silly and fun things are important."

Image copyright SPACEX Image caption A Tesla Roadster floats in space, before heading somewhere in the direction of Mars

In the 12 years since Mr Musk sold online payments firm Paypal for $1.5bn, he has evolved in the public imagination into a kind of mad genius figure - part industrialist, part scientist, part playboy, part superhero. He has dated and married famous actresses, including Talulah Riley and Amber Heard, and had a rumoured fling with Cameron Diaz. Robert Downey Jr took inspiration from him to play Tony Stark in Iron Man.

He has cornered private space flight and the electric car industry, ventured into solar energy and artificial intelligence, and promised super-high speed magnetic train travel, in a tube, underground. Oh, and he plans to colonise Mars.

Most take Mr Musk's more wild ambitions and boasts with a galaxy-sized pinch of salt. His companies have missed deadline after deadline and recorded massive losses. But climate change campaigners have hailed the unexpected popularity of Tesla's electric cars, and the launch of the Falcon Heavy capped a string of successes for SpaceX.

Media playback is unsupported on your device Media caption Falcon Heavy: the story of the launch

It all began in Pretoria, South Africa. As a young boy, he was obsessed with science fiction novels and more or less anything you could run a current through. His parents, Maye, a model, and Errol, an engineer, separated when he was eight. His younger brother and sister would stay with their mother, so he volunteered to go with their father. It did not go well. He later recalled returning home after vicious bullying at school, "and it would just be awful there as well".

At 17, he moved to Canada to study physics and economics at Ontario's Queen's University. From Canada he migrated to the US in 1992, transferring to the University of Pennsylvania, and from Pennsylvania to a PhD in energy physics at Stanford in California, After two days, he quit.

Instead he founded Zip2, an online newspaper platform, with his younger brother Kimbal. In 1999 they sold the company to Compaq for $300m, and Mr Musk ploughed his share into an online bank, X.com. X.com became Paypal, and in 2002 Paypal sold to eBay for $1.5bn. Aged 31, Mr Musk netted $165m.

Image copyright Getty Images Image caption Falcon Heavy's booster rockets descend to land at Florida's Space Coast

By that time, Mr Musk was two years into a marriage to Justine Wilson, an aspiring fantasy writer he met in Ontario. Mr Musk asked her out for ice cream. She agreed but then blew him off. He showed up in the student centre, where she was studying, with two cups of ice cream.

"He's not a man who takes no for an answer," Ms Wilson recalled in Marie Claire magazine.

He is said to be a relentless worker. When he founded Zip2, he reportedly worked all day, slept in the office, and showered over the road at the YMCA. Asked in 2010 what advice he would give entrepreneurs, he suggested they should "put in 80 to 100-hour weeks every week".

"If other people are putting in 40-hour work weeks, and you're putting in 100-hour work weeks, you'll achieve in four months what takes them a year," he said.

As they danced at their wedding, Justine later recalled, he told her: "I am the alpha in this relationship". He was a controlling husband, she said, pushing her to dye her hair more and more blonde. "I am your wife," she recalled saying, "not your employee." "If you were my employee," he would reply, "I would fire you."

Their first son, Nevada, died at 10 weeks from Sudden Infant Death Syndrome - a tragedy that Mr Musk refused to talk about, she said. They went on to have five more children - twins and a set of triplets - via IVF, but she struggled with depression over the death of their first son.

Eight years after they married, they divorced, in a messy, multi-million dollar separation. Six weeks later, he texted her to say he was engaged to Talulah Riley, a British actress 14 years his junior.

"I will never be happy without having someone," he told Rolling Stone. "Going to sleep alone kills me."

He and Ms Riley married in 2010. They divorced in 2012 and remarried in 2013. In 2014 he filed for, then withdrew, a second divorce and in 2016 she filed for divorce and it took.

Image copyright Getty Images Image caption Elon Musk and Talulah Riley arrive at the White House in February 2014

After the sale of Paypal in 2002, Mr Musk ploughed his $165m into three new companies: Tesla, SpaceX, and a solar energy company called Solar City. Tesla was a quixotic venture, a niche electric car company in a nation addicted to gas.

With Mr Musk as CEO, the company set out a top-down plan - first, market a high-performance sports car, a machine that would set Tesla apart from a stereotype of small, underpowered electric vehicles. Then a luxury sedan, and finally a low-cost, mass-market electric car.

A $456m loan from the US government saved Tesla from near-bankruptcy in 2008, and in 2010 it became the first American car company to float on the stock market since Ford in 1956. In 2017, it surpassed Ford and General Motors to become, briefly, the most valuable car company in the country. It was the market betting on a greener future, and not a reflection of Tesla's bottom line.

Serious production delays on its low-cost Model 3 have compounded years of losses. On Wednesday, the day after its Roadster went interstellar, Tesla Inc landed with a bump. It reported a $675.4m (£487m) loss in the last quarter of 2017, more than five times worse than the previous year, although revenue climbed 44% to $3.3 billion.

"We were in a deeper level of hell than we expected, still a few levels deeper than we would like to be," said Mr Musk on a conference call with analysts. It was a characteristic take for a man preoccupied with human extinction.

Image copyright Getty Images Image caption A man prepares to plug into a Tesla charging station in Fremont, California

A few hours earlier, he had announced on Twitter that the company's cosmic Roadster was en route to the asteroid belt, having overshot the trajectory for its planned Mars orbit. Then astronomers took a closer look at the data and concluded the car wouldn't make it that far. Not for the first time, SpaceX revised its projections.

Over the past five or so years, Mr Musk has outlined varying plans and deadlines for his ultimate goal of sending humans to colonise the Red Planet. Late last year, he said he expected SpaceX to send a cargo mission in 2022, to lay groundwork, followed by a manned mission in 2024. The practical difficulties and dangers of sending humans 140 million miles to Mars are huge. Nasa has been more circumspect, putting its estimate for a manned mission somewhere in the mid-2030s.

But the successes of SpaceX's more prosaic work - resupply missions to the space station, commercial satellite launches, Nasa and Air Force contracts - have propelled it to near the top of the list of the world's most valuable privately-held companies, with a $21.2bn valuation.

The company has pioneered new reusable rocket technology, wowing the world, as on Tuesday, with the sight of pencil-like rockets gracefully descending to land with pinpoint accuracy, on land and at sea. It has undercut Nasa and major established rivals such as Boeing to provide (relatively) cheap space flight.

Image copyright SPACEX Image caption The Falcon Heavy's 27 first stage rockets - essentially three Falcon 9s strapped together

And as SpaceX looks to the heavens, another of Mr Musk's companies is going underground. In October, the Boring Company won permission from the US government to dig a 10-mile test tunnel under Maryland.

Mr Musk hopes it will one day house the "Hyperloop", an electromagnetic bullet train he has boasted will carry passengers at up to 760mph (1223km/h). In July, he tweeted that he had won "verbal government approval" to build a Hyperloop between New York and DC that would reduce the journey time from three hours to 29 minutes. Officials said no such approval had been given.

The Hyperloop idea has its fair share of critics. Thom Neff, a civil engineer, put it succinctly when he told Wired last year, "I would put what Mr Musk is saying today in the bullshit category." A working Hyperloop is, without doubt, a long way off.

But to those who admire him, Mr Musk is a visionary, an irrepressible Howard Hughes-like figure revolutionising industry after industry. His two latest ventures, Neuralink and OpenAI, take him into the world of artificial intelligence.

His madcap ideas to save humanity from itself have even earned him the honour of a parody Twitter account, "Bored Elon Musk". On Tuesday, after one of Mr Musk's companies blasted a sports car into space and another reported record losses, his bored alter-ego put out a single tweet. "Classic Tuesday," it said.