The Art of Rainbow Engineering

by Pineta

Rating: everyone
Tags: My Little Pony: Friendship is Magic, Rainbow Dash, Comedy, Spitfire, Slice of Life, Zecora, Twilight Sparkle, Main 6
Length: 5162

Can you make a rainbow just with sunlight and water?

Can you make a rainbow just with sunlight and water? No magic required? With the help of the pegasus weather team, Rainbow Dash and Twilight Sparkle investigate.

Published 2012-11-30 20:10:01 UTC
Last updated 2013-08-02 22:13:32 UTC

Rainbow Engineering for Pegasi

From her high altitude cloud lookout, Rainbow Dash surveyed the bright green Equestria countryside, reviewing the next moves in her head: swoop down to Ponyville, picking up speed; streak past the town to get their attention; shoot up to cloud height, loop around, fall again, and repeat a dozen times, each at a slightly greater angle to create a patterned effect in the clouds; then rocket upwards and perform as many improvised tricks as she cared for; and finally glide down to Sugarcube Corner, relax with a rainbow sherbet ice cream, and brag about it to everypony.

Weathers conditions were looking good. It was raining over the Everfree Forest, but bright sun in Ponyville with just a bit of moisture in the air. It was late afternoon, soon the schoolhouse doors would open and the streets would be filled with young foals joining the adult ponies. The audience was waiting. The pegasus dipped in the cloud to get just the right amount of moisture on her feathers, then spread her wings wide and leapt off. The initial approach required only limited effort – let gravity do the work – she focussed on the sky ahead, the sun behind her. Looks like there might be some thermal currents above the road ahead – that would make things easier. Entering the town now... adjust altitude... close to the roof tops, but not too low... stay focussed... look straight ahead...

She blinked. There ahead of her was a rainbow. Or at least the end of an arc leading from the clouds to the ground, just before Everfree. What? How? Was her mane in front of her eyes? No. This looked real. There was no rainbow in the weather schedule. She would know. Who's been playing around? Where had this fallen from? Rainbows needed considerable skill and pegasus magic to construct – it was a job for a full weather team (or one awesome supersonic flyer). This couldn't be real. But there it was – incomplete and slightly transparent – but a rainbow nonetheless.

Her attention lost, Rainbow realised she had veered off course. Scraping the tops of a patch of pine trees, she flapped her wings to gain height and lose speed. Original plan aborted, she paused, hovering above the tree tops, staring at the rainbow. “I need to get to the bottom of this,” she said to herself.

The bottom of the rainbow appeared to be at Sweet Apple Acres. She accelerated hard, and was there in seconds. Hovering above the farm field next to the forest, she looked around. The rainbow had disappeared. But just a moment ago, she had seen it touching the edge of this field. She looked carefully around the perimeter, and noticed Applejack patrolling the boundary. She flew down and landed by her friend.

“Hey Applejack, what have you done with that rainbow?”

The farm pony stared at the pegasus blankly. “What rainbow?”

“There was a rainbow here a moment ago. Where did it go? And who put it here in the first place? Rainbows are my department, and that one wasn't authorised.”

“Ain't seen no rainbow here all day – 'cept you RD.”

“But I saw it right here!” Rainbow started to argue, then stopped abruptly, staring the element of honesty in the face. Weird that Applejack hadn't seen it, but it had to be nearby – it must be hiding in the trees. She took off again glancing around.

“Hey Rainbow!”

“Yeah.”

“When are you going to give us some more rain? That shower today was welcome, but we really need a good downpour. Ground's so hard.” She stamped her hooves on the solid earth to make the point.

“Yeah, all in good time...”

Rainbow flew up high and scanned the ground for any sign of a rogue light spectrum hidden among the undergrowth. The bright colours should be easily visible against the dark green, but there was no sign of it. She flew back and forth searching without success. After a few minutes, she paused in exasperation and looked up at the sky. And there it was – back at the horizon – now inside the Everfree forest – as clear as before.

“I got you now...”

This time, keeping her eyes fixed on her quarry, she flew in a straight line above the trees. Not far away now... Just another minute...

Except the rainbow seemed to be moving further away. As soon as she reached the point where it had been a moment ago, it had moved further back into the forest. Was it running away? Or had it really been where she thought it was? It was difficult to pin down where it landed, it seemed to fade away as it reached the ground. Now it was trying to hide in the clouds.

The rainbow faded completely before her eyes. In its place there were now just grey clouds. She slowed down, then halted, flapping her wings, staring at the grey horizon searching for any sign of the weather feature. Nothing. It started to rain.

Dash turned and headed back towards Ponyville, pondering the mystery. Somepony was making rainbows on her territory. And mysterious rainbows which eluded detection. They might not mean any harm, but she wanted to know who it was, and check they were doing it properly. Incorrectly mixed rainbows could be toxic. If swallowed they could turn a pony's face all manner of colours. She thought of the Cutie Mark Crusaders. It would be just like them to try something like this, but where would they get any rainbow formula? The Cloudsdale factory had strict controls on distribution. Was somepony selling it illegally? She shuddered at the thought of foals passing it around the school playground. But the misadventures of Apple Bloom and friends were usually a bit more visible.

Looking down through the trees she spotted a zebra mare walking in a forest clearing and remembered this was Zecora's home. Could the old 'Evil Enchantress' have anything to do with this? Rainbows weren't really her thing, but she might know something. The pegasus turned, and glided down to the forest floor. She found the zebra carrying a bag of plants back to her tree.

“Why, the second rainbow I have seen today,
And you, I hope, will choose to stay,
For while the first was a great beauty,
A talking pony is better company.”

Zecora lead Rainbow into her tree. Glad to get out of the rain, the pegasus looked around at the slightly creepy interior, with its exotic masks and abundant amphorae. She smiled at the zebra. “Er, Hi Zecora, you saw that rainbow then. That's what I wanted to ask about. It shouldn't have been there. Who made it? And why did it run away and disappear when I chased it?”

Zecora poured two cups of tea and stood facing Rainbow.

“That rainbow was not a pegasus design,
But born solely of rain and sunshine,
It did not move when in you flew,
But can only be seen as a distant view.”

“Right, err, this is a bit weird. So it's not made by anypony, and I can only see it from far off. How can that be?”

“Light rays will always follow a line,
Which takes them from point to point in the minimum time,
Each, at its own speed, takes a different direction,
And the resulting image is a full colour spectrum.”

“This is a bit beyond me, can you... maybe... be a bit clearer?'

“The nature of weather, light, and time,
Is not so easy to explain in rhyme,
If my riddles, you do not comprehend,
I suggest you seek your librarian friend.”

“Yeah. Good idea... This is egghead stuff... I'll go and ask Twilight. Thanks Zecora!”

The zebra watched the rainbow coloured tail of the pegasus disappear into the darkening sky, and said to herself, cryptically,

“Into the sun-lit rain-cloud she stared,
Yearning to fathom the reflection she shared,
Now under her nose, she will expose,
The prospect of making double rainbows.”

The western sky was still glowing, but to the east it was dark and the first stars were visible between gaps in the clouds. Twilight Sparkle was setting up her telescope on the balcony of the tree library. She pointed the instrument at the brightest star, and stared at it through the eyepiece, adjusting the knobs to bring it into focus. The star was abruptly obscured by something in the foreground. Twilight turned the knob widely trying to get it in focus. Something coloured... getting bigger and bigger... still way out of focus...

With a thud, Rainbow Dash landed on the balcony, and lost no time in getting to the point.

“Twilight, we've got a problem. There's this freak rainbow out there which nopony made, and you can only see it from a long way off, and it's loose somewhere in Everfree, and if we don't get it some foal is going to get hurt. Zecora knows about it, but she couldn't explain it to me, but she said you could. What's going on?”

Twilight focussed her vision on the pegasus in front of her, but her mind was still fuzzy. “Sorry... you said?..” she replied.

Ten minutes later both ponies were seated inside the library, with mugs of hot chocolate, joined by Pinkie Pie, who had stopped at the library in order to check some references on citrus arboriculture and quadrupedal choreography. Twilight summarised the situation. “So you saw a rainbow, but whenever you flew close to it, it either disappeared, or moved further away, and Zecora says it was just made from rain and sunshine.”

“That's it,” replied Rainbow Dash.

“Hmm, I wonder,” she pondered before jumping up suddenly. “I need that book on geometric optics.”

Rainbow followed her into the library hall where Twilight was selecting tome after tome, levitating them into view, and discarding them at speed. “No. No. No. Where is it?”

Pinkie bounded into the room in a series of jumps, “Hi Dashie. Do you like libraries? I love libraries. I've just been reading this totally fascinating book on Kumquats. What are you here to research?”

“Rainbows...” started her friend.

“Ooo, got it. Let me help you find the right book.” She bounced over to a shelf, prised off a volume with her hoof, and tossed it to the pegasus, who read the title: 'DIY Psychoanalysis for Pegasi'.

“No Pinkie, this isn't about me. We need something to explain how you can create a rainbow without magic.”

“Oh right... I've seen something with lots of rainbow drawings somewhere around here. How about this: 'Everypony's guide to geometric optics'. It was next to 'Everypony dances the hippopotamus polka', that's good too!”

“Pinkie – you found it!” cried Twilight, appearing in a flash of white light in front of the book. She began hastily turning pages.

“Here we are,” she said after scanning the page she had found. “It explains how in certain weather conditions – if you have bright sunlight shining into a rain-shower, the light is internally reflected in the raindrop, and on passing through the droplet, the white light is split into the spectrum of colours. Hence from a distance, when looking at the rain-shower, you see a rainbow. No magic required. You see?”

“No.”

“Hang on...” Twilight rushed across the room, opened a draw full of telescope components, and started throwing out the contents. Various lenses and mirrors were scattered around the room, before she returned to her friends levitating a small glass prism in front of her.

“Take a look at this...” She held the prism in front of a lamp, and before a blank page of a discarded book, then rotated it slowly until it gave the effect she was looking for, splitting the lamplight into a spectrum of colours.

“Ooo pretty,” murmured Pinkie Pie.

“Wow, you can make a sort-of rainbow just with a piece of glass,” said Rainbow Dash.

“Exactly,” replied Twilight, “white light contains all the colours of the rainbow mixed together. By using the glass prism, we can split it up. When the light enters the glass, it slows down, but the different colours move at different speeds. The red light moves faster than the blue. When the light hits the glass at an angle, the light on one side will enter the glass and slow down, while the light on the other side is still moving faster. This bends the whole light ray to one side, and the angle it is refracted by is greater for blue light than for the red.”

“So you can make a rainbow with just a piece of glass?”

“Well at least the image of one. And what you saw in the sky today was the same thing, but instead of glass, the sunlight was passing through raindrops.”

Rainbow paused to take this in. “Hang on Twilight. This doesn't fit. The sun wasn't behind the rainbow I saw today, it was on the other side of the sky.”

“What you saw today was sunlight reflected by the rain. The light passed inside the droplets, and was reflected off the far side. As it passed through the water, it split the white light into all the different colours. Let me draw a picture.”

Seizing a quill and sheet of paper, she drew a circular water droplet, “The light enters here, is bent by an angle, reflected internally, then exits here, bent by the same amount.”

“But,” said Rainbow Dash, “the sky is full of sunlight and water. Why don't we see rainbows all the time?”

“Because you can only see it in certain conditions – you need to be in the right place at the right time. One droplet won't reflect much light, so you need a bright sunbeam shining on a dense rain-shower, so the light reflected by all the raindrops adds together. And then you will only see it when the angle between the sunlight and the rainbow is forty-two degrees.” She pointed at her diagram. “That's why when you flew towards the rainbow, you could no longer see it. But you could see a rainbow further away as at that point the angle to the sunlight was the right value.”

“And,” she continued smiling with enthusiasm, “that's why it appears as an arc. Every point along the rainbow is at the same angle to the sun, and whenever you see it, the sun is directly behind you...”

“What kind of daft rainbow is that!” interrupted Pinkie Pie. “If you can only see it from a distance, how can you twist it into shapes and prank ponies with it. How can it point the way home if it's always flat opposite to the sun. Duh!”

“But it's amazing to think that you can make it with just light and water, and no magic,” said Twilight, “I wish I'd seen it.”

“You can take a look tomorrow,” said Rainbow.

“I doubt it,” replied Twilight, “they're rare phenomena. It's unlikely to happen two days in a row.”

“Bright sunlight shining onto a dense cloud of water droplets, to reflect it at forty-two degrees to the centre of Ponyville. That's a pretty easy order for the weather patrol.”

“You can do that?”

“No problem.”

The following morning Twilight and Rainbow met for breakfast at Sugarcube Corner to discus the planned meteorological engineering project. “Okay,” said Twilight, levitating a quill above a draft checklist and map of Ponyville, “we need a bright sun, not too far above the horizon, and on the other side of the sky, a high density of water droplets, but don't let it rain too heavily. Make it high and wide enough to fit in the full arc. And some dark clouds behind that will make it easier to see.”

“You got it. One totally non-magical rainbow scheduled for landing 16:00.”

“We could try it this morning. Will it take so long to set up the clouds?”

“My team can set it up in minutes. But late afternoon is when we'll get the most ponies out walking around town. No point putting on a show if there's nopony around to see it.”

“Rainbow, this is a science experiment not a public show.”

“Don't you want to show off this awesome not-magic trick?”

“No. What if it doesn't work out?”

“What, is there a flaw in your hypothesis?”

“Well no, I don't think so, but what if... I don't know... what if you can't get enough moisture in the air?”

“Relax Twi, I saw the weather that did this yesterday. We can do it. And if it doesn't appear as you predict, I'll just do a sonic rainboom to keep the crowd happy.”

Twilight grimaced. “Okay, but please don't go around telling everyone we're going to do this.”

“Sure thing.”

“No need,” said Rainbow to herself, “Pinkie will take care of that without any encouragement.” She spent the morning visiting her list of reserve weather ponies recruiting volunteers, then after lunch settled down on a convenient cloud for a nap.

By mid-afternoon, a large crowd had gathered in the centre of Ponyville, all talking about the rumour that Twilight Sparkle and Rainbow Dash were about to combine unicorn magic and pegasus awesomeness to create something truly spectacular. The nature of the spectacle was unclear, but would reportedly involve rain explosions, solar flares, and, according to one report, some sort of exotic water horse.

Twilight had retreated to the library balcony, and was setting up various instruments to monitor the sky, trying to ignore the attention she was attracting from the street below. She had allowed Rarity and Fluttershy to join her.

“Erm, Twilight?” asked Fluttershy nervously.

“Yes,” replied the unicorn, not looking up from her telescope.

“Erm, are you sure that this experiment you're doing is quite safe?”

Twilight looked up surprised. Compared to some of Rainbow Dash's stunts, this was remarkably risk-free. “Of course,” she replied, “what could go wrong?”

“Well, somepony said you were going to summon a rainbow-breathing dragon...” said Fluttershy.

Twilight sighed. “That's nonsense,” she said. “This does not involve any dragons. Nor any manticores, hydras, gargoyles, griffins, or any magic or zoology of any kind, flying ponies excepted. Rainbow Dash is just going to produce the weather conditions to allow the sunlight to shine onto the rain, such that according to the laws of physics, it will produce the image of a rainbow, just like those produced by Cloudsdale.”

On cue, Rainbow Dash flew into view, the team of weather pegasi behind her.

“All set?” she asked.

“Ready when you are,” replied Twilight.

“Okay team,” said Rainbow, addressing the aerial assembly. “This is a scientific experiment, so we need one hundred percent precision, controlled conditions. You know your tasks. Blossomforth – take your squad and clear the western sky of all clouds, to let the sunlight through. Cloudpine, Morning Glory – collect all the darker clouds you can find and move them over to the Everfree boundary, then form them into a black wall, high as you can. The rest of you, follow me and collect as much moisture vapour as you can. Move to it to the zone centred just south of Sweet Apple Acres, spread out to the north and south, and lift to a higher altitude if necessary. Agitate gently to create a fine rain shower. Is that clear?” Rainbow flew a few laps around the weather team, giving each pegasus a big grin, then blew sharply on her whistle. “Let's go!”

Cloud management was a well rehearsed operation, and aware that all Ponyville was watching, the pegasus team moved with extra efficiency. The clouds remaining to the west were quickly moved away, and minutes later the horizon to the east grew dark. The flying ponies then assembled more clouds in the foreground.

Now, they just had to wait. Twilight focussed a pair of binoculars on the action and watched the pegasi hopping up and down on the clouds, illuminated by the bright sunshine. Soon there was a good rain-shower. She looked down at the ground, and saw Applejack and Big Macintosh running for cover.

And there it was – the promised rainbow – a perfect arc centred over Sweet Apple Acres. The same band of colours as usual, yet somehow this rainbow seemed more perfect due to its geometric exactness and transparent, ethereal glow. The crowd of ponies in the street were speechless, just staring at the horizon.

“Oh my!” said Fluttershy.

“What a truly graceful phenomenon,” contributed Rarity, “and that has just given me the most amazing idea for a new line of raincoats.”

“At exactly the predicted altitude,” said Twilight, using her telescope to measure the angle of the rainbow in the sky, and scribbling calculations on a piece of paper.

Rainbow Dash zoomed into view, flying backwards, eyes on the horizon, “No...No...Yes...There it is... No! Where'd it go?”

As she drew up to the balcony, the rainbow was fading from view.

“That was amazing Rainbow, the weather patrol really outdid themselves,” praised Twilight.

“My congratulations, I never knew weather could be so inspiring,” added Rarity.

But the airborne pegasus continued to stare at the horizon. “I don't see anything, where did it go?”

“It seems,” said Twilight, surveying the scene, “that the rain shower has stopped, as the clouds broke up as soon as the pegasi dispersed. The wind is quite fast that high and it's blowing the clouds away.” Sure enough, the pegasus ponies were now all following their leader and flying towards Ponyville. Without supervision, the clouds were drifting northwards. Rainbow Dash went straight to confront the patrol.

“Get back to it! We're not done yet!” she cried.

“But we want to see the magic-free rainbow,” protested Blossomforth.

“Nopony will get to see it if you can't keep the rain-shower in the right place.”

Twilight sighed. Rainbow was very good at giving orders, and flying in to help out any team member who needed it, but she never grasped basic project management. She shouted up to the arguing pegasi. “Set up a rota. Each pony can stay here for five minutes, then return to the cloud layer to relieve another. Then you'll always have enough ponies on site to maintain the shower.”

The weather team looked down at her. “That makes sense,” said Rainbow Dash. They huddled together to draw up shifts, then flew back to work.

Ten minutes later, with the rota implemented, the rainbow had returned to the sky, and Rainbow was able to admire it.

“Yes yes yes! We did it!” she cried, then flew off back to the action.

“Erm, Twilight,” said Fluttershy quietly, “why are there two of them?”

She pointed a hoof at the sky. Twilight looked up and saw what she meant – above the primary rainbow, a second bow was now visible, fainter than the first, with the colours in the opposite order – red at the bottom, violet at the top.

“I-I...don't know,” replied the unicorn, “this doesn't make sense, it should only be visible at a fixed angle.” She stared back the sky for a moment in thought, then went back to her notes. “Where's the diagram I drew last night?” She shuffled through the heap of loose paper and found the figure of a circular water drop with the path of a reflected light ray, “...the light enters the rain drop... it's refracted towards the normal... then hits the far side at an angle greater than the critical angle, and is hence reflected, then refracted again on leaving the drop. This can only happen around one angle.” She paused to think it over, “...unless...”

Magically seizing a quill, she began drawing extra lines over the diagram and scribbling calculations to the side. “Of course! The light hitting the bottom of the droplet, will be refracted upwards, and reflected twice inside the drop before it exits, giving an inverted image, at an angle of...” she pause to finish her calculation, “...fifty-one degrees.” She rushed back to her telescope to measure the angle of the second rainbow. “Fifty-one degrees,” she announced, “spot on. This is amazing.”

“I don't entirely follow you, Twilight my dear,” said Rarity, “but I do agree it is a most dazzling spectacle.”

Rainbow Dash flew back to the balcony, towing a dark cloud. “Hey Twilight, check this – we found if we create a really dense waterfall, you can see a rainbow from just a few metres away.” She moved the cloud into the sunlight, and gave it a vigorous kick, creating a heavy spray of water droplets. A small but vivid rainbow appeared in the water. The pegasus grinned at them, expecting more of a response. She then turned, kicked the cloud to one side, and followed their glaze back to the image in the eastern sky.

“Wow. A double rainbow. We are the best!”

The pegasus weather team kept up their rota into the evening, by which time every pony in Ponyville had come outdoors to admire the coloured arch. Rainbow Dash brought in extra clouds and created temporary waterfalls all around the town centre to demonstrate the rainbow-at-close-proximity. This proved very popular with the young fillies and colts, who invented a new game of rainbow hoofball, with the objective of kicking a ball under a rainbow. It was impossible to agree on the score as the goalposts appeared in a different place to every player. Points were lost for hitting the pegasus linesponies maintaining the clouds, which also earned the guilty player a drenching of cold water. Before long the centre of Ponyville was awash with mud.

Applejack arrived, pleased about the change of weather. Twilight descended into the street and delivered a lecture on optics to anypony who would listen. Eventually as the sun fell lower in the sky, the secondary rainbow faded from view. Then as the sun became red, the other coloured bands started to disappear, leaving a single red arc which persisted until the sun finally set. The pegasi left the clouds and flew into town to join the assembly.

Twilight had started delivering a lecture to the crowd on why the sky was blue, but the audience attention was soon distracted by Pinkie Pie, bounding around the groups of ponies.

“That was the most super awesome amazing rainbow ever – well except for the one I saw the day I got my cutie mark – and the one Dashie produced at the Best Young Flyers competition – and – but still that was one super awesome rainbow – you know what this calls for...”

The party carried on late into the evening. When it grew dark outside, the ponies moved into Sugarcube Corner where a multi-coloured spectrum of cakes were laid out. Pinkie bounced around randomly switching between eating cakes, trying out new rainbow-themed games and teaching everypony the hippopotamus polka. Rarity was enthusiastically describing her planned new fashion line to Fluttershy. Twilight had disappeared. Rainbow Dash stood in the centre of the room recounting the full day's action sequence to anyone who would listen. She was describing the weather patrol's routine for the eleventh time, when suddenly she heard her name.

“Hey Rainbow Dash!”

Turning around the blue pegasus found herself facing a familiar mare with a bright orange mane, in a Wonderbolt uniform.

“Spitfire!” Her mouth dropped open for a moment, before her play-it-cool instincts kicked in.

“There's been some reports in Cloudsdale that there was a pretty big, off-schedule rainbow down here. But we're not aware of any magical activity or sonic booms. So I came to get its licence number. You know that black-market rainbow formula is a serious issue?”

Rainbow Dash leaned back against the table smiling calmly, took a sip of punch, and said, “Oh that. Sure I know that, but don't fret this wasn't that sort of rainbow. We just had a heavy rain-shower, combined with bright sunlight, at such an angle that it was reflected by the water droplets towards Ponyville. As the white light passed through the water, refraction split up all the colours, giving a stunning image of a rainbow.”

Spitfire looked at her with a slight suspicion. This wasn't how the Ponyville weather mare usually talked.

“A refraction rainbow huh? So you didn't have anything to do with this?”

“Well, we may have just... set up the right environment...”

“And kept it up all afternoon?”

“yeah...”

“So do you have still sufficient water reserved for next week's weather schedule?”

“erm...”

Finally, late in the evening, after the party had finished, Rainbow returned to the library to see what had happened to Twilight. She found her unicorn friend surrounded by piles of books, making notes on loose sheets of paper.

“Rainbow. Just the pony I need!”

“What are you doing Twilight?”

“I've been reading. Our little experiment got me thinking some new ideas.”

The pegasus looked down at the volume she was reading: 'Upper Atmospheric Lightning: Jets, Sprites and Elves'. “What are those things?”

“They're rare lightning phenomena which occur at high altitude in particular conditions,” explained Twilight. “You would need an electric field of ten kilovolts per metre, at an altitude of thirty-five kilometres. I was wondering if the weather patrol could...”

“You bet,” replied the weather mare grinning wickedly.

Physics of Rainbows (with ponies)

Despite appearing magical to the uninitiated, rainbows can be explained using relatively simple high school physics. As Twilight explains, the parallel light rays from the sun are refracted when passing from the air into the water droplet, reflected off the far side of the droplet, and refracted again on exiting the drop.

The precise angle by which the raindrops reflect the light depends on the point where the ray enters the drop, but most of the light we see is reflected at around 42 degrees to the incident sunlight. But as Twilight learns, it is also possible for light to be reflected twice inside the drop, giving the secondary rainbow. As it’s reflected twice, the colours are in the opposite order. And as only a smaller amount of light is reflected, it’s considerably fainter.

The angle of refraction can be calculated from the incident angle and the refractive index of the water drop – the speed in air, divided by the speed in water. The separation of the colours occurs because this varies slightly with the wavelength (or colour) of the light.

The angles can be calculated in many ways. One of these, mentioned by Zecora, is the principle of least time. The light ray traveling across a boundary from point A to point B will take the quickest path. A straight line would be the shortest distance, but not the quickest route as it travels a greater distance in the slower medium. If it enters the water slightly to the side, it will increase the path length, but decrease the time taken as it travels a shorter distance in the slower medium.