# Degrees of Freedom and Sudoku

Degrees of Freedom and Sudoku Source – datasciencecentral.com

This article is about Intuitive explanation of Degrees of Freedom and How Degrees of Freedom affects Sudoku.

A lot of aspiring Data Scientists take courses on statistics and get befuddled with the concept of Degrees of Freedom. Some memorize it by rote as ‘n-1′.

But there is a intuitive reason why it is ‘n-1’.

**The Intuitive Explanation**

Let’s consider the following example.

Imagine being asked to choose 5 numbers that sum to 100. For simplicity sake, you say 20, 20, 20, 20. Before you utter the 5th number, I tell you that your 5th number is 20 as well. This is because the first 4 numbers chosen by you summed up to 80 and the condition was to chose 5 numbers which sum to 100.

So 100 -80 = 20. The fifth number is 20.

**The fifth number in a sense chose itself** due to the condition specified.

You see you had 4 degrees of freedom alone. All one needed was the first four numbers.

This also intuitively explains the n-1. Here n being 5 and n-1 =4.

You lost one degree of freedom to the condition of **“5 numbers should sum to 100”**

or

In other words, **you had 4 degrees of freedom.**

**The Sudoku Connection**

Sudoku is a very familiar game to most of us. Wikipedia gives the following definition

Sudokuoriginally calledNumber Place)is a logic-based, combinatorial number-placement puzzle. The objective is to fill a 9×9 grid with digits so that each column, each row, and each of the nine 3×3 subgrids that compose the grid (also called “boxes”, “blocks”, or “regions”) contains all of the digits from 1 to 9. The puzzle setter provides a partially completed grid, which for a well-posed puzzle has a single solution.

I was solving a sudoku game just to kill some time. I realized that there is some connection between sudoku and degrees of freedom.

I am not sure whether the online version of the game takes into account degrees of freedom to rate the game as “Easy”, “Medium” and“Expert”. But perhaps the game could be rated this way !!

Let me illustrate with an example taken from an online sudoku puzzle.

The ‘Easy’, ‘Medium’, ‘Hard’ and “Evil’ levels of online sudoku game is depicted below.

Note there are 81 cells in a Sudoku game.

**More Degrees of Freedom = Tougher Sudoku**

In each of the levels, we notice something interesting. The number of filled in cells keeps getting smaller as the level goes from Easy to Evil !!

Basically, as you have more cells to fill in (blank cells) the level keeps getting harder. The more degrees of freedom you have, the tougher it solves the puzzle !! Having a lot of freedom is not ideal in this case at least.

This was a small article connecting a statistical concept of Degrees of Freedom to a daily game like Sudoku.

I hope to write a code to depict the above in near future.