Ratio, Proportion, and YouTube Embedding

Sometimes, you will really appreciate if you are mathematically inclined. Knowing basic mathematics is a great advantage in many things – sometimes even in the simplest of things.

Happy Girl Hopscotch in Strawberry Free Creative Commons

All of us use mathematics in everyday life, but most of the time, only we who are mathematically inclined appreciate it. For example, I use math when I embed Youtube videos in my blogs; I have to customize the embed dimensions depending on the size of the blog page. A sample Youtube embed code is shown below.

<iframe width="560" height="315" src="http://www.youtube.com/embed/h60r2HPsiuM" frameborder="0" allowfullscreen></iframe>

In the embed code,  the width of the video is 560 pixels and the height is 315 pixels. Most of my blog post page are about 500 pixels, so I had to reduce its size.

So comes mathematics.

I want the width of the video to be 480 pixels instead of 560. What should be the height then? Using ratio and proportion, I have to compute for x in

560:315 = 480: x

which gives x = 270.  I have to replace the height in the code with 270. My new code now is

<iframe width="480" height="270" src="http://www.youtube.com/embed/h60r2HPsiuM" frameborder="0" allowfullscreen></iframe>

I realized later when I checked YouTube, however,  that there is a Custom box where you just have to type the custom width and the height will be automatically computed.

youtube-custom

Hmmm…. Never mind the Custom box. I used the harder method, but I loved it anyway.  For the not-so-acquainted in math, you can try the method above and use the Custom box to check if your answer is correct.

Photo Credit: Pink Sherbet Photography

This post was originally posted in Math Palette my other blog on July 15, 2012 .blog

Leave a Reply