# Factor of 2

I'm taking a machine learning class with the kid, mostly because three weeks ago, he said he wanted to do machine learning, that was what he was most passionate about. So, to help him achieve his goals, I searched for different machine learning classes and meetups, realized Coursera's class was starting up this past week, signed up, and asked him to sign up, too. There are now three in our group of Coursera Machine Learning class students, meeting twice a week to review what we've learned and work on the lessons.

Early in the class, when the instructor was writing out the cost function J, which is a summation i from 1 to m, m being the number of elements in his set of data, the instructor commented,

"We're just going to add a 2 in there, makes the math easier later."

In particular, he divided the summation by 2, (factor of ½), without explanation.

Well, further along in the first week's lesson, we see why he added the two. He's taking the derivative of a square, which puts a factor of two in front of the answer. Hey, divide that by 2 (say, by multiplying by ½) and POOF, we dispose of all those pesky twos!

I LOVE MATH and computer scientists. "Let's just add a constant factor in there to make things easier." I am laughing so hard right now at the joy of this, my sides hurt.

## Add new comment