Logistic regression is a Classification algorithm that will draw a boundary to differentiate between 2 or more classes, the boundary can be linear or non-linear.

The starting logic is same as in the linear regression where we have a cost function that is the difference between the real dependent variable values and the decision boundary values.

But since this is a classification (and for more clearer explanation we consider a binary classifications), then the hypothesis function should output values between 0 and 1, and is expressed by the following Sigmoid function: