Reflections on maths, learning and maths learning support, by David K Butler

Tag: mistakes

  • Holding the other parts constant: It’s everywhere!

    It seems like ages ago – but it was only yesterday – that I wrote about differentiating functions with the variable in both the base and the power. Back there, I had learned that the derivative of a function like \(f(x)^{g(x)}\) s the sum of the derivative when you pretend \(f(x)\) is constant and the derivative when you pretend \(g(x)\) is constant.

    Since then I have realised that this idea actually dictates ALL of the differentiation rules where two functions are combined through an arithmetic operation! It’s everywhere!

    Multiplication…

    Let \(h(x)=f(x)\cdot g(x)\).

    Suppose \(f(x)\) is constant, say \(f(x)=a\). Then

    \[\begin{aligned}
    h(x)&=a g(x)\\
    h'(x)&= ag'(x)\\
    &= f(x) g'(x)\end{aligned}\]

    Suppose \(g(x)\) is constant, say \(g(x)=b\). Then

    \[\begin{aligned}
    h(x)&=f(x)\cdot b\\
    &=bf(x)\\
    h'(x)&= bf'(x)\\
    &= g(x) f'(x)\\
    &= f'(x) g(x)\end{aligned}\]

    Adding these:
    \[ f(x)g'(x) + f'(x)g(x) = h'(x) !!!\]

    Oh my goodness — it’s the product rule!

    Division…

    Let \(h(x)=\frac{f(x)}{g(x)}\).

    Suppose \(f(x)\) is constant, say \(f(x)=a\). Then

    \[\begin{aligned}
    h(x)&=\frac{a}{g(x)}\\
    &= a[g(x)]^{-1}\\
    h'(x)&= a(-1)[g(x)]^{-2}\cdot g'(x)\\
    &=-\frac{ag'(x)}{[g(x)]^2}\\
    &= -\frac{f(x)g'(x)}{[g(x)]^2}\end{aligned}\]

    Suppose \(g(x)\) is constant, say \(g(x)=b\). Then

    \[\begin{aligned}
    h(x)&= \frac{f(x)}{b}\\
    &=\frac{1}{b} f(x)\\
    h'(x)&= \frac{1}{b}f'(x)\\
    &= \frac{f'(x)}{b}\\
    &= \frac{f'(x)}{ g(x)}\end{aligned}\]

    Adding these…
    \[\begin{aligned}
    \frac{f'(x)}{ g(x)}-\frac{f(x)g'(x)}{[g(x)]^2}&= \frac{f'(x)g(x)}{ [g(x)]^2}-\frac{f(x)g'(x)}{[g(x)]^2}\\
    &=\frac{f'(x)g(x)-f(x)g'(x)}{[g(x)]^2}\\
    &= h'(x) !!!\end{aligned}\]

    Oh my GOODNESS — it’s the quotient rule!

    Addition…

    Let \(h(x)=f(x)+g(x)\).

    Suppose \(f(x)\) is constant, say \(f(x)=a\). Then

    \[\begin{aligned}
    h(x)&=a +g(x)\\
    h'(x)&= g'(x)\end{aligned}\]

    Suppose \(g(x)\) is constant, say \(g(x)=b\). Then

    \[\begin{aligned}
    h(x)&=f(x)+ b\\
    h'(x)&= f'(x)\end{aligned}\]

    Adding these:
    \[ f'(x)+g'(x) = h'(x) !!!\]

    OH MY GOODNESS— it’s the addition rule!

    So it’s everywhere! This is totally awesome!

    In the comments in the last post, it was mentioned that the reason all this happens is because of the multivariable chain rule, which is all about holding all but one variable constant and adding together the different results. When I realised this I thought to myself “duh!” – I was using the same words to tell myself what to do in both situations.

    The issue is that when students learn these rules, they don’t know multivariable calculus so this can’t be used as a way to explain what’s happening. But I have a good feeling that it might be able to help make sense of the multivariable chain rule when they do learn it because it will connect perfectly so something they already know. I’ll let you know if I ever try.

  • Differentiating exponents: Two wrongs make a right

    I was talking to a student about his calculus last week. He was trying to differentiate \(x^x\). (Actually he was trying to differentiate \(x \ln(x)\) and had decided the best place to start was to raise e to the power of it, thus producing \(x^x\).) At first he tried this:

    \[\begin{aligned}
    f(x)&=x^x\\
    f'(x)&=x\cdot x^{x-1}\\
    &= x^x\end{aligned}\]

    I asked him what he thought about that and he said he wasn’t sure it was right because of the x in the power. I asked him how you normally dealt with an x in the power. He thought about it and then produced this:

    \[\begin{aligned}
    f(x)&=x^x\\
    f'(x)&=\ln(x)\cdot x^x\end{aligned}\]

    I confirmed that this is indeed what you would do if there was an x in the power but the base was constant. But I also confirmed that because there was an x in both the power and the base, it was going to be a bit trickier. He asked how you did deal with that, and I started out by writing \(x^x = \left(e^{\ln(x)}\right)^x\). (On reflection, if I was doing SQWIGLES properly, I should have helped him find this definition in his notes.) Together we continued this working as follows. Interestingly, we ended up having to differentiate \(x \ln(x)\) as part of this, but by this time he realised it would be much simpler to use the product rule!

    \[\begin{aligned}
    f(x) &= x^x\\
    &= \left(e^{\ln(x)}\right)^x\\
    &= e^{x \ln(x)}\\
    f'(x) &= e^{x \ln(x)} \cdot \frac{d}{dx}(x \ln(x))\\
    &= x^x \cdot \frac{d}{dx}(x \ln(x))\\
    &= x^x \left[x \cdot \frac{1}{x}+1\cdot \ln(x)\right]\\
    &= x^x [1+\ln(x)]\\
    &= x^x + x^x \ln(x)\end{aligned}\]

    Do you notice anything interesting about that result? Well, I did: it’s the sum of the other two wrong answers! If we treat the base as a constant we get a (wrong) result, and if we treat the power as a constant we get a (wrong) result, but if we add those two results together we get the correct result! This is WILD!

    After we did the summing up what we’ve learned bit, I absolutely had to try this out generally to see what would happen:

    Let \(h(x) = [f(x)]^{g(x)}\).

    If \(g(x)\) is constant, say \(g(x)=b\), then
    \[\begin{aligned}
    h(x) &= [f(x)]^b\\
    h'(x) &= b[f(x)]^{b-1}\cdot f'(x)\\
    &= g(x)[f(x)]^{g(x)-1}\cdot f'(x)\\
    &=g(x)f'(x)[f(x)]^{g(x)-1}\end{aligned}\]

    If \(f(x)\) is constant, say \(f(x)=a\), then
    \[\begin{aligned}
    h(x) &= a^{g(x)}\\
    h'(x) &= \ln(a)\cdot a^{g(x)}\cdot g'(x)\\
    &= g'(x)\ln(a)a^{g(x)}\cdot f'(x)\\
    &=g'(x)\ln(f(x))[f(x)]^{g(x)}\end{aligned}\]

    Consider the general case:

    \[\begin{aligned}
    h(x)&=[f(x)]^{g(x)}\\
    &=\left[e^{\ln(f(x))}\right]^{g(x)}\\
    &=e^{g(x)\ln(f(x))}\\
    h'(x)&=e^{g(x)\ln(f(x))}\cdot \frac{d}{dx}{g(x)\ln(f(x))}\\
    &=[f(x)]^{g(x)}\cdot \frac{d}{dx}{g(x)\ln(f(x))}\\
    &=[f(x)]^{g(x)}\left[g(x)\cdot\frac{1}{f(x)}\cdot f'(x)+g'(x)\ln(f(x))\right]\\
    &= [f(x)]^{g(x)}\left[g(x)f'(x)[f(x)]^{-1}+g'(x)\ln(f(x))\right]\\
    &= g(x)f'(x)[f(x)]^{g(x)-1}+g'(x)\ln(f(x))[f(x)]^{g(x)}\end{aligned}\]

    Oh my goodness! It worked again! I am reeling with the wildness of this! Currently I don’t know if there’s a more conceptual/visual approach to this that will help me feel like I understand why it is true, but for now I’m just going to relish the wildness of these two wrong results adding up to the correct one.

    PS: Isn’t it cool the stuff you learn when you listen to students? If I’d just told him what to do I’d never have noticed this.

    UPDATE: There’s more to learn in a blog post the following day.


    These comments were left on the original blog post:

    David 21 September 2016

    This can be explained using the multivariable chain rule. Let f(u,v) = u^v, u=x, v=x. Then df/dx = ∂f/∂u du/dx + ∂f/∂v dv/dx = ∂f/∂u + ∂f/∂v. The product rule is also a special case of the multivariable chain rule.

    David Butler 21 September 2016

    Ah you beat me to it! I was just going to do an update to say exactly this!
    In my head it was something like f=u^v with u=f(x) and v=g(x).
    So df/dx = df/du*du/dx + df/dv*dv/dx
    = (derivative of f treating v as constant) + (derivative of f treating u as constant)

    Of course, this student won’t see multivariable calculus in their course for another several months yet…

  • Two wrongs make a right

    Students make a lot of mistakes when doing their maths, but sometimes they will make two mistakes in such a way that their final answer is still correct. This happened last week with one student quite spectacularly, because his doubly wrong method of doing a particular problem always produces the correct answer.

    Let me explain: the Maths 1A students are currently learning about vectors in Rn and one of their assignment questions gives them several lists of vectors and asks them to decide if they are linearly independent or linearly dependent.

    What they are supposed to do (based on what they are shown in the lectures) is put the vectors into a matrix as columns, then do row operations until they can tell where the pivots will be. If every column has a pivot, then the vectors are linearly independent; if there is a column with no pivot, then the vectors are linearly dependent. Check out this example to see how it works (it has a little extra for later on).

    Mathematical working to show that three vectors are linearly independent by putting them as columns and using row operations.

    The reason for this method goes right back to the definition of linear independence: the vectors v1, …, vr are linearly independent when the equation x1v1 + … + xrvr = 0, has only the trivial solution of x1 = 0, … , xr = 0. If there are any solutions where any of the xi‘s are not zero, then they are linearly dependent.

    If you write out the vectors in full using their coordinates, then you find that using the first coordinates, you can make a linear equation involving the xi‘s, and similarly each successive coordinate produces a separate equation. So solving the vector equation is the same as solving n linear equations. And the students know how to do this: you put the coefficients of the equations into a matrix with one row per equation and do row operations. The final matrix represents a reduced set of equations, and if you can get to a stage where each row has a 1 in one spot and 0’s in the others then you’ve got x1 = 0, …, xr = 0. This would mean your original vectors had to be independent. If any one variable doesn’t have a pivot, then you can let it be any value at all and still find a solution. This is called a free variable. Since it can be anything, it could be something other than zero, and so your vectors will be linearly dependent.

    So this is what the student was supposed to do. However, what they did do was put the vectors into a matrix as rows, do row operations, and then look to see if there was a row of zeros. If he got a row of zeros, then he said the vectors were linearly dependent, and if he didn’t, then he said the vectors were linearly independent.

    His first mistake was to put the vectors in as rows. I am often repeating the mantra “vectors are columns, equations are rows” to students to remind them that for most situations, vectors really ought to be columns. We usually mutliply matrices on the left of a vector (Ax) which would only make sense if the vector was a column, and also this arrangement corresponds exactly to doing a specified linear combination of the columns of A. Finally, in this specific situation, the matching coordinates of each vector together make an equation, and equations are definitely rows, so this forces the vectors to line up their coordinates in rows. That is, they have to be columns (if we are to be solving equations anyway).

    His second and much more fundamental mistake was to think that a row of zeros meant there had to be a free variable. (I know he was thinking this because he actually said it to me.) This is wrong because if a matrix does represent a set of equations, then whether you get rows of zeros at the end is actually not strongly related to whether there are free variables. Firstly, a row of zeros with a nonzero number in the answers position indicates no solution at all, independently of what the rest of the matrix is doing. Secondly, if there’s a pivot in every column, then there will be a unique solution regardless of how many rows of zeros there are at the bottom. Whether you get infinitely many solutions is all about the pivots in the columns, not about the zeros in the rows!

    It’s not surprising that the student had this misconception because many high school students only ever see square matrices, and a row of zeros in a square matrix prevents there being a pivot in one of the columns and so does in fact indicate a free variable. But it doesn’t apply for non-square matrices, especially ones with more rows than columns.

    I explained all of this to him and he was happy with what I said. But then he frowned and asked, “Then why did I still get the answers right?” Why indeed?

    If my student had put his vectors in as columns and looked for zero rows, he would have gotten his answers wrong. This is because with the vectors as columns, the rows are equations and the aim is to solve the equations and look for free variables. Since zero rows do not always force free variables, he would be looking for the wrong thing and would have been wrong a lot of the time.

    If my student had put his vectors in as rows and looked for columns without pivots, he would also have gotten his answers wrong. This is because pivots are supposed to refer to variables in equations, whereas this matrix wouldn’t actually represent equations at all, letalone ones related to the definition of linear independence.

    However, he did neither of these combinations and instead put the vectors in as rows and looked for rows of zeros, and he got his answer right every time! The key to resolving this paradox is to figure out what the row operations represent when the rows of your matrix are vectors rather than equations.

    Row operations basically perform linear combinations of rows. So when you do a sequence of row operations, you are actually doing a linear combination of the original rows. Therefore any row produced by this process is a linear combination of the original rows. So if you are able to produce the zero vector then it is actually possible to produce the zero vector by linear combinations! And it’s not the trivial one either. Hence the original vectors must have been linearly dependent. Amazing huh?

    An important question arises: what if you wanted to know what the actual linear combination was? With the vectors-as-columns approach, you are literally solving to find the xi‘s, and so at the end if you pick a nonzero value for the free variables, you can find the rest of them and there you have it!

    With the vectors-as-rows approach, the linear combinations you do are recorded in the row operations. We need a way to keep track of the linear combinations / row operations we have done. One way to do this is to reason that if the original vectors were the standard basis, then whatever final vector we got would tell us what linear combination we had done (for example, (1,3,-2) = 1(1,0,0) + 3(0,1,0) -2 (0,0,1)). So why don’t we do the same operations on the standard basis as we do on the original matrix?

    What this means is that if you place an identity matrix next to your original matrix and do the same row operations on both, then whatever vector is next to the row of zeros when it happens will be the linear combination of the original rows that produced the zero vector! Check out the same example as before but by this new method.

    Mathematical working to show that three vectors are linearly independent by putting them as rows and using row operations.

    Isn’t it amazing the things you can learn by being wrong first!


    This comment was left on the original blog post:

    Stephen Wade 20 May 2014:
    It’s funny how convention comes into play and that you could prove that either approach works. I had to check quickly, and I think this is right, that if you put vectors as rows in an m x n matrix A, then if dim ker A^t > 0 means you have linear dependence. Using rank theorem, dim ker A^t = m – dim col A = numbers of rows – number of rows with pivots = number of rows of zeros in the rref of A. So if the number of rows in rref of A > 0, you should have linear dependence. Cool 🙂