It takes a lot to create the extraordinary displays we enjoy on the 4th of July. Sometimes, the staging alone can take hours of planning for a few minutes worth of display—it takes even longer when a show is set to music. And fireworks aren't cheap.

The July Fourth Boston Pops Fireworks Spectacular costs in excess of $2.5 million. Shorter, simpler shows like what you'd find in a small town can run between $2,000 and $7,000. The use of larger shells bursting in synchronization with music can cost around $2,000 a minute, putting a 20-minute display at $40,000.

The science behind fireworks is just as fascinating as their cost. Ever wonder just how they make so many colorful shapes during an Independence Day firework display? Wonder no more.