Results 1 to 9 of 9

Math Help - Chain rule application

  1. #1
    Member garymarkhov's Avatar
    Joined
    Aug 2009
    Posts
    149
    Awards
    1

    Chain rule application

    Suppose you have two functions

    q1(P,S,y) = 6*P^(-2)*S^(3/2)*y

    q2(P,S,y) = 4*P*S^(-2)*y^2



    P(t) = (12*t)^(1/2)
    S(r,t) = 10*r*t^2
    y(r) = 20r.



    I'm interested in the area around (P=6,S=9,y=2) and want to find the derivative of q1 and q2 with respect to both time t and interest rate r when t=3 and r=0.1. What I find particularly difficult is how to handle P being a function of t, y being a function of r, while S is a function of both t and r.



    I would be grateful if someone would provide a step by step solution.



    Thanks so much!
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Member alunw's Avatar
    Joined
    May 2009
    Posts
    188
    Well I'm not give a step by step solution, but if you are having problems because the functions are functions of different variables just regard all of P,S and T as functions of r and t. The partial derivative of P wrt r and S wrt t is just 0. Then I guess you could do things using the multivariable form of the chain rule if you really want to.
    Personally I think it would be much easier just to multiply out your functions q1 and q2 to express them directly as functions of t and r, and calculate the partial derivatives directly. There are lots of cancellations - in fact I get that q2 is independent of r altogether. Then you can differentiate the functions easily and since all your functions are products you don't even have to use the product rule as you can collect all the terms in t and r in both functions together.
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Member garymarkhov's Avatar
    Joined
    Aug 2009
    Posts
    149
    Awards
    1
    Quote Originally Posted by alunw View Post
    The partial derivative of P wrt r and S wrt t is just 0.
    Agree that partial p wrt t is 0, but are you sure partial S wrt t is 0? Do you mean partial y wrt t is 0?

    Quote Originally Posted by alunw View Post
    Personally I think it would be much easier just to multiply out your functions q1 and q2 to express them directly as functions of t and r, and calculate the partial derivatives directly.
    Could be easier, but I've got to do a lot of this sort of problem and they're only going to get more complicated. Need to start using the chain rule.

    Okay, this is what I did:

    partial q1/partial t = partial q1/partial P*dP/dt + partial q1/partial S*dS/dt + partial q1/partial y*dy/dt

    partial q1/partial r = partial q1/partial P*dP/dr + partial q1/partial S*dS/dr + partial q1/partial y*dy/dr

    partial q2/partial t = partial q2/partial P*dP/dt + partial q2/partial S*dS/dt + partial q2/partial y*dy/dt

    partial q2/partial r = partial q2/partial P*dP/dr + partial q2/partial S*dS/dr + partial q2/partial y*dy/dr

    After inputting the points 6,9,2, I threw the partials into a matrix:

    Row 1 (q1): -3 1.5 4.5
    Row 2 (q2): 16/9 -32/27 32/3

    Then multiplied by the derivatives of the functions upon which the first functions depend, evaluated at t=3 and r=0.1:

    Row1: 1 0
    Row 2: 6 90
    Row 3: 0 20

    The derivative wrt t is in the first column, and the derivative wrt r is in the second column.

    Multiplying my two matrices together, I get:

    Row 1: 6 225
    Row 2: -5.33 106.66

    But that is not the correct answer (unless there is a mistake in the text I am using). Alunw, can you see where I've gone wrong? Or do you get something similar?

    Thanks and all the best!
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Member alunw's Avatar
    Joined
    May 2009
    Posts
    188
    Yes, I mistyped but you understood what I meant.
    I'm afraid I don't have the time right now to look at what you've done closely, and multivariable calculus is not my forte. Your method seems plausible in principle but you need to explain better how you've calculated the numbers in the matrices. Unless you show the general term for the partial derivatives you are calculating its very hard to spot what you are doing wrong without solving the whole problem.
    I'm fairly confident that function q2 is independent of r, so that at least the dq2/dr entry in your solution is wrong. I can only suggest you double check how you got the values in the relevant parts of your 2*3 & 3*2 matrices.
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Member garymarkhov's Avatar
    Joined
    Aug 2009
    Posts
    149
    Awards
    1
    Quote Originally Posted by alunw View Post
    Unless you show the general term for the partial derivatives you are calculating its very hard to spot what you are doing wrong without solving the whole problem.
    Sure. From

    q1(P,S,y) = 6*P^(-2)*S^(3/2)*y

    q2(P,S,y) = 4*P*S^(-2)*y^2


    I get:

    partial q1/partial P = -12*P^(-3)*S^(3/2)*y

    = -3 when evaluated at (P=6,S=9,y=2)

    partial q1/partial S = 9*P^(-2)*S^(1/2)*y

    = 1.5 when evaluated at (P=6,S=9,y=2)

    partial q1/partial y = 6*P^(-2)*S^(3/2)

    = 4.5 when evaluated at (P=6,S=9,y=2)

    ---------------------------

    partial q2/partial P = 4*P^(-1)*y^2

    = 16/9 when evaluated at (P=6,S=9,y=2)

    partial q2/partial S = -4*P*S^(-2)*y^2

    = -32/27 when evaluated at (P=6,S=9,y=2)

    partial q2/partial y = 8*P*S^(-1)*y

    = -32/3 when evaluated at (P=6,S=9,y=2)

    Quote Originally Posted by alunw View Post
    I'm fairly confident that function q2 is independent of r, so that at least the dq2/dr entry in your solution is wrong. I can only suggest you double check how you got the values in the relevant parts of your 2*3 & 3*2 matrices.
    I'm probably being dense, but why? q2 is a function of P, S and y, and both S and y are functions of r.
    Follow Math Help Forum on Facebook and Google+

  6. #6
    Member alunw's Avatar
    Joined
    May 2009
    Posts
    188
    The reason I say q2 is independent of r is because given

    P(t) = (12*t)^(1/2)
    S(r,t) = 10*r*t^2
    y(r) = 20r.
    q2(P,S,y) = 4*P*S^(-2)*y^2
    then q2(t,r) = 4 * (12*t)^0.5 * 0.01 * r^-2 * t^-4 * 400 * r^2, and the terms in r cancel out completely so that in fact q2 only depends on t.
    So when you calculate the partial derivative of q2 with respect to r the non-zero terms in r should cancel out.
    In fact looking at your work you seem to have made a mistake calculating the partials of q2 with respect to both to P and S. Not sure why you've done that since you look OK on the q1 terms.
    Follow Math Help Forum on Facebook and Google+

  7. #7
    Member garymarkhov's Avatar
    Joined
    Aug 2009
    Posts
    149
    Awards
    1
    Quote Originally Posted by alunw View Post
    The reason I say q2 is independent of r is because given

    P(t) = (12*t)^(1/2)
    S(r,t) = 10*r*t^2
    y(r) = 20r.
    q2(P,S,y) = 4*P*S^(-2)*y^2
    then q2(t,r) = 4 * (12*t)^0.5 * 0.01 * r^-2 * t^-4 * 400 * r^2, and the terms in r cancel out completely so that in fact q2 only depends on t.
    So when you calculate the partial derivative of q2 with respect to r the non-zero terms in r should cancel out.
    In fact looking at your work you seem to have made a mistake calculating the partials of q2 with respect to both to P and S. Not sure why you've done that since you look OK on the q1 terms.
    Ah crap, I made a mistake in specifying q2. It's q2(P,S,y) = 4*P*S^(-1)*y^2.

    Thanks for pointing that out. Too bad we can't get rid of r so easily! As far as I can tell, the rest of what I wrote is correct.
    Follow Math Help Forum on Facebook and Google+

  8. #8
    Member alunw's Avatar
    Joined
    May 2009
    Posts
    188
    You also have a misprint in what you have written for dq2/dp. You wrote

    partial q2/partial P = 4*P^(-1)*y^2 but it should be P = 4*S^(-1)*y^2 and this seems to be what you actually used to get your 16/9 figure. So I'm at a bit of a loss as to where to go next. I've not checked all your figures, but enough of them seem to be OK for me to feel that you certainly seem to know what you are doing. I can only suggest that you follow my original suggestion for at least one of q1 and q2 (q2 still looks easier) and calculate the partial derivatives directly after expressing it as a function of t and r directly. Then you can recheck all your matrix calculations for that function and see if you can get the same answer that way. If you can't there must be something wrong with your method that I've not appreciated, and it might be best to see if someone else can help - maybe one of the calculus gurus.
    Follow Math Help Forum on Facebook and Google+

  9. #9
    Member garymarkhov's Avatar
    Joined
    Aug 2009
    Posts
    149
    Awards
    1
    Quote Originally Posted by alunw View Post
    You also have a misprint in what you have written for dq2/dp. You wrote

    partial q2/partial P = 4*P^(-1)*y^2 but it should be P = 4*S^(-1)*y^2 and this seems to be what you actually used to get your 16/9 figure. So I'm at a bit of a loss as to where to go next. I've not checked all your figures, but enough of them seem to be OK for me to feel that you certainly seem to know what you are doing. I can only suggest that you follow my original suggestion for at least one of q1 and q2 (q2 still looks easier) and calculate the partial derivatives directly after expressing it as a function of t and r directly. Then you can recheck all your matrix calculations for that function and see if you can get the same answer that way. If you can't there must be something wrong with your method that I've not appreciated, and it might be best to see if someone else can help - maybe one of the calculus gurus.
    Thanks for all your help! I've tried what you've suggested with no luck, so I think I'll try the main calculus section. And I'll be sure to fix those natty transcription errors first!

    Take care.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Chain Rule Application
    Posted in the Calculus Forum
    Replies: 2
    Last Post: October 27th 2009, 01:15 AM
  2. Chain Rule Inside of Chain Rule
    Posted in the Calculus Forum
    Replies: 3
    Last Post: October 22nd 2009, 09:50 PM
  3. Replies: 5
    Last Post: October 19th 2009, 02:04 PM
  4. Replies: 3
    Last Post: May 25th 2009, 07:15 AM
  5. Replies: 2
    Last Post: December 13th 2007, 06:14 AM

Search Tags


/mathhelpforum @mathhelpforum