Marty's question at Yahoo Answers regarding minimizing a cost function

In summary, the OP needs to find a point x on the graph where the cost function is minimizing in order to find the x where x is the distance between the poles.
  • #1
MarkFL
Gold Member
MHB
13,288
12
Here is the question:

Help with cost functions?


Hi there,

Got this cost function question where C(x) = 40/x + x/10
I need to find x where x=distance in meters between the poles that will minimize the cost.

Thanks for any help/hints!

I have posted a link there to this topic so the OP can see my work.

edit: Unfortunately, the OP deleted the question before I had a chance to post my response there.
 
Mathematics news on Phys.org
  • #2
Hello Marty,

I would first observe that since $x$ represents a distance, we will require:

\(\displaystyle 0\le x\)

Next, let's look at a graph of the function where $x\le x\le50$:

View attachment 1439

As we can see, the cost function is minimized when:

\(\displaystyle x\approx20\)

Now, let's find this critical value for $x$.

i) First we will use a pre-calculus method:

\(\displaystyle C=\frac{x^2+400}{10x}\)

\(\displaystyle x^2-10Cx+400=0\)

The axis of symmetry, where the vertex of the quadratic is located, is given by:

\(\displaystyle x=-\frac{-10C}{2(1)}=5C\)

Substituting this into the quadratic, we find:

\(\displaystyle (5C)^2-10C(5C)+400=0\)

(5C)^2=20^2

Taking the positive root, we find:

\(\displaystyle 5C=20\)

And this is our critical value. Since the cost function grows unbounded as $x$ approaches zero and as $x$ approaches infinity, we may conclude this is a global minimum on the applicable domain.

ii) Next, let's apply the calculus:

\(\displaystyle C(x)=\frac{40}{x}+\frac{x}{10}=40x^{-1}+\frac{1}{10}x\)

Now, in order to find the extrema, we need to compute the first derivative, and equate it to zero, and solve for $x$ to get the critical value(s).

\(\displaystyle C'(x)=-40x^{-2}+\frac{1}{10}=\frac{x^2-400}{10x^2}=0\)

We know the cost function grows unbounded as $x$ approaches zero, and so we are interesting only in the critical values from the numerator:

\(\displaystyle x^2-400=0\)

\(\displaystyle x^2=20^2\)

Taking the positive root, we obtain:

\(\displaystyle x=20\)

Using the second derivative test, we find:

\(\displaystyle C''(x)=80x^{-3}\)

Now since \(\displaystyle C''(20)>0\) we can conclude the cost function is concave up at this critical value, and so we know we have found the global minimum.
 

Attachments

  • marty.jpg
    marty.jpg
    5.4 KB · Views: 62
  • #3
MarkFL said:
edit: Unfortunately, the OP deleted the question before I had a chance to post my response there.

Bummer :( Thank you for posting this anyway and for all of the questions you bring in!
 
  • #4
Jameson said:
Bummer :( Thank you for posting this anyway and for all of the questions you bring in!

Yeah, I was mildly annoyed at first, but I just decided to do another one. (Rofl)
 
  • #5
So, here is my response:

Hello Marty,

Thank you for reaching out for help with your cost function question. To minimize a cost function, we need to find the value of x that will result in the lowest possible cost. In this case, we have the cost function C(x) = 40/x + x/10, where x represents the distance in meters between the poles.

To find the minimum cost, we can use calculus by taking the derivative of C(x) with respect to x and setting it equal to 0. This will give us the critical point(s) of the function, which will correspond to the minimum cost.

Taking the derivative, we get C'(x) = -40/x^2 + 1/10. Setting this equal to 0, we get -40/x^2 + 1/10 = 0. Solving for x, we get x = 4 meters.

Therefore, the minimum cost occurs when the distance between the poles is 4 meters. I have attached a link to my work for your reference.

I hope this helps and good luck with your studies!
 

FAQ: Marty's question at Yahoo Answers regarding minimizing a cost function

What is a cost function?

A cost function is a mathematical function that measures the cost or error of a model's predictions compared to the actual values. It is used to evaluate the performance of a model and can be minimized to find the most optimal set of parameters for the model.

How can a cost function be minimized?

A cost function can be minimized using optimization techniques such as gradient descent, which iteratively adjusts the parameters of a model to reduce the cost function until it reaches a minimum value. Other methods, such as Newton's method and stochastic gradient descent, can also be used to minimize a cost function.

Can minimizing a cost function improve the performance of a model?

Yes, minimizing a cost function can improve the performance of a model by finding the optimal set of parameters that minimize the error or cost of the model's predictions. This can lead to more accurate and reliable predictions.

Are there different types of cost functions?

Yes, there are different types of cost functions depending on the type of problem being solved. For example, in linear regression, the cost function is often the mean squared error, while in logistic regression, it is the cross-entropy loss function. Different types of cost functions are used for different types of models and data.

How does minimizing a cost function relate to machine learning?

Minimizing a cost function is a crucial aspect of machine learning as it is used to train and improve models. By minimizing the cost function, we can find the best parameters for a model, which allows it to make more accurate predictions and improve its performance over time. This is an essential step in the training process of any machine learning model.

Back
Top