Nibcode Solutions Blog

Learn about math applications and other interesting topics

Using matrix operations to solve the Einstein

Using matrix operations to solve the Einstein's riddle. Part II.

Anibal Rodriguez
Anibal Rodriguez
November 16, 2015

In the previous part of this article we formulated the Einstein's riddle in terms of matrices, and presented three matrix operations that will be the base for an algorithm to solve the riddle. In this part we'll be talking about this algorithm, and a JavaScript implementation which will allow solving this riddle and any other grid riddle similar to this one.

There are some programming languages as Prolog, designed to work with logic facts, where you can deal with logical problems in a natural way. By using the matrix formulation we can use any programming language to deal with this kind of riddles. Here we provide the implementation, in JavaScript, of the matrix object with the three basic operators used to solve the riddles. The selection of JavaScript is not arbitrary, it allows to show the effectiveness of the algorithm in this same post.

Using matrix operations to solve the Einstein

Using matrix operations to solve the Einstein's riddle. Part I.

Anibal Rodriguez
Anibal Rodriguez
October 27, 2015

There are several logical grid puzzles you can find on the internet, but undoubtedly, one of the most popular known is the Einstein's riddle. Although it's attributed to Einstein, there's no evidence to back up that claim. It's rumoured that only 2% of the world can solve it, but it's really not so hard, all one needs is logic and deduction. In this article we are going to present a method based entirely on matrix operations to solve this riddle and any other similar.

The riddle

There are five houses in five different colours in a row. In each house lives a person with a different nationality. The five owners drink a certain type of beverage, smoke a certain brand of cigar and keep a certain pet. No owners have the same pet, smoke the same brand of cigar, or drink the same beverage. The question is: Who owns the fish?

The perfect game pack for the whole family

The perfect game pack for the whole family

Yudit Blanco
Yudit Blanco
December 29, 2014

There is no such thing as a 'bad memory', we can all improve our memory, and an ideal way is through daily practice. Some days ago Nibcode Solutions released a new product: Nibcode Memorize, a game pack with 3 games to train and improve your memory, while you will have fun as well.

These games, as it has been scientifically proven, will also improve your concentration, increase the functionality of your brain, improve your short-term visual memory, strengthen your cognitive abilities and will help you avoid related diseases to the brain.

Search engines and linear algebra

Search engines and linear algebra

Anibal Rodriguez
Anibal Rodriguez
July 10, 2014

Nowadays information is at hand. Just open your browser, type some words about what you want to know, and thousands of pages will arise to satisfy your information needs; and surprisingly, you will find the most relevant information in the first proposed pages. It’s not a mystery the way the search engines work to make their magic, it’s just mathematics. Behind their complex algorithms is hidden the linear algebra and other mathematical theories.

Every search engine needs three basic elements: a web crawler, a database to save the data it finds, and an algorithm to determine the order of pages returned by any search inquiry. The two first elements can be automated easily, the main problem lies on the third one, and here is where the mathematical tools are the key to the solution.

Cryptography and linear algebra

Cryptography and linear algebra

Anibal Rodriguez
Anibal Rodriguez
June 25, 2014

Since humans invented the written language, they have tried to share information secretly. This is basically, the objective of Cryptography, the study of the techniques to protect sensitive communications by means of data encryption and its posterior decryption. Encryption is the transformation of data into some unreadable form, so, even those who can see the encrypted data cannot understand the hidden information. Decryption is the reverse of encryption; it is the transformation of encrypted data back into some intelligible form.

Although there are different methods to encrypt and decrypt messages, we'll focus on a linear algebra based cipher, the Hill cipher, which uses a matrix as a cipher to encode a message, and it's extremely difficult to break when a large matrix is used. The receiver of the message decodes it using the inverse of the matrix.