I recently started learning machine-learning and just learned the basics of linear regression.

So gradient descent and other optimization algorithms can be used to find the values of θ in the hypothesis hθ(x) = θ0x0 + θ1x1 + ... + θnxn

But is there any way to figure out whether the hypothesis function should be a polynomial or other types of functions like hθ(x) = θ0x0 + θ1x1 + θ2x12

I know that if I graph the sample data for a model that has one or two features I can see if a polynomial function would predict the graph better, but what if there were more than 2 features? How would I go about determining what kind of function to use?