these concepts are very important. In doubt feel free to re-warch the course or ask any open question in this forum.
A cost function provides a metric you can use to improve your optimization. When fitting a model you actually want to minimise the costs, (the model error). See also:
Gradient descent is a powerful method for above mentioned optimization when fitting your model. It is really well explained by Andrew Ng in this video:
Also this thread might be interesting for you:
see also this source.
Happy learning!
Best regards
Christian