I have a cost function with 2 parameters. The variables are dependent on each other. So, if I just take a partial derivative with respect to one variable the slope is in terms of the other variable and vice-versa. So, how can I compute the optimal values for these variables that minimize my cost function?
What you have appears to be a non-linear function which you are trying to optimize. Whilst not as trivial as linear optimization it is not particularly difficult either. Since numerically you aren't working with symbolic variables but always with numbers (arrays of numbers called vectors) which are computed at each step of the optimization process anew, to adapt to the parameters being considered.
I'd suggest you open a book on numerical analysis at the chapter treating non-linear optimization. One method to try would be gradient descent, but there are better variations.