Posts

Showing posts from January, 2019

PtEn< change language Being able to do basic arithmetic calculations in your head is a great skill. Not because it is sexy but because it is useful in your daily life: it can help you check the change you are given when shopping, it can help you know if you will have enough money to pay for your groceries, it can help you estimate how much things cost after the discounts, etc...

This often reduces to being able to sum and subtract decently; sometimes you need to make a couple of small multiplications, but that is it.

More likely than not, you don't need to compute averages every day. But sometimes you just want the scoring average of your team for the past few games, or the average price per person of a given meal, or the average time you spent stuck in traffic this past week... And averages may appear nastier than simply adding or subtracting, because averages also require you to perform a division: in fact, you have to add all the numbers you want and then divide the total b…

Problem #13 - a circular train

PtEn< change language This is that type of problem that can be phrased as a riddle that you can tell everyone. Of course some people will try to think it through while other people will just ask you for the solution.

Problem statement: suppose you are in a circular train, i.e. a train where the first carriage is connected to the last carriage. Suppose, furthermore, that all carriages are identical and that you have no way to tell them apart. Additionally, each carriage has a light bulb that you can turn on and off to your own liking. If you are put inside such a train, how can you find how many carriages the train has, assuming that in the beginning the light bulbs have an unknown state?

To sum up, the main characteristics of this riddle are:
the train is circular, hence you can go forward indefinitely; the same backwards;all train carriages are exactly identical, so you can't tell them apart;each carriage has a light bulb that you can turn on/off;each carriage will start with i…

Introduction to the Hill Cipher

PtEn< change language The Hill cipher is a very simple cipher that works by using modular arithmetic and matrices.

In a nutshell, your key is a matrix in some \$\mathbb{Z}_m\$ and you encrypt messages by breaking them up into pieces and then multiplying the pieces by the key matrix. That's it.

I will be giving a workshop on this subject in a near future, and so I decided to write a Python notebook with a brief explanation of how the Hill cipher works, as well as providing an implementation of said cipher. The notebook can be downloaded and read here. I will be glad if you leave any suggestions/comments in the section below! A cifra de Hill é uma cifra simples que faz uso de noções de aritmética modular e de álgebra linear (mais concretamente, matrizes).

Em duas frases, a cifra de Hill tem como chave uma matriz num dado \$\mathbb{Z}_m\$ e o modo como encripta mensagens é partindo-a em bocados com o mesmo tamanho e depois multiplicando a matriz chave por esses bocados.

Num futuro…

Problem #12 - it is just a matter of time

PtEn< change language Today's problem is really simple! But when you know the solution, you can reverse the question and it will sound like a riddle, so you can ask it to your non-mathematician friends.

Problem statement: assume that the minute and hour hands of your clock are overlapping. How long will it take for that to happen again?

Solution: it is quite easy to come up with the solution for the problem if we think the right way. In fact, this can be solved with equations involving angles but we won't follow that path.
Notice that at 00h00 the minute and hour hands are overlapping. At 12h00 the hands will be overlapping again at the exact same spot, and by that time the minute hand will have given 12 turns while the hour hand will have given a single turn. When the time starts ticking at 00h00, to 00h01, 00h02, 00h03, ... the minute hand will start in front of the hour hand and until 01h00 we know, for sure, that the two hands won't overlap! Now we just have to notic…