theta1 = theta(1) - alpha / m * sum((X * theta - y) .* X(:,1)); theta2 = theta(2) - alpha / m * sum((X * theta - y) .* X(:,2)); theta = [theta1; theta2]