Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site utcsri.UUCP Path: utzoo!utcsri!panos From: panos@utcsri.UUCP (Panos Economopoulos) Newsgroups: net.puzzle Subject: Re: More on Interview Questions. Message-ID: <917@utcsri.UUCP> Date: Sat, 23-Mar-85 02:40:05 EST Article-I.D.: utcsri.917 Posted: Sat Mar 23 02:40:05 1985 Date-Received: Sat, 23-Mar-85 04:16:55 EST References: <379@cavell.UUCP> Distribution: net Organization: CSRI, University of Toronto Lines: 81 > > Here are the answers to the following questions: > From: mouli@cavell.UUCP (Bopsi Chandramouli) > Subject: More on Interview Questions. > Message-ID: <379@cavell.UUCP> > Date: 14 Mar 85 06:00:58 GMT > Organization: U. of Alberta, Edmonton, AB > > > Here are two more 'good' interview questions. Actually I was asked > the first question in a job interview. > > 1) Hope you agree that > > x**2 = x + x + x + ... x such terms. > > Then consider these two derivatives. > > d(x**2) > ---- = 2*x. > dx > > d(x + x + x + x .. x such terms) > ____ = 1 + 1 + 1 + 1 .. x such terms > dx > = x. > > Why is this anamoly? The problem appears because differentiation is a linear operator, i.e. d(af(x)+bg(x))/dx = a df(x)/dx + b dg(x)/dx for a,b constants. Therefore, d(x+x+x+..+x)/dx = dx/dx + dx/dx + ... + dx/dx ONLY for a constant number of additions. However, the way the problem is presented, we have x additions at the righthand side, i.e. a function of the variable and the above property does NOT hold, i.e., we cannot get rid of the brackets and differentiate each term independently. > > 2) what is the derivative of factorial x? > Factorial x or x! for short, is in general defined as x! = G (x+1) = integral from 0 to inf (t to the power of x times e to the power of -t) dt where G(x) is the Gamma function. The derivative of x! is, therefore, the derivative of the integral with respect to x. Because the function g(t,x) (t to the power ... -t) which is to be integrated is continuous w.r.t. t and x, and because its derivative dg(t,x)/dx is also continuous, we can interchange the integral and the derivative, i.e. integrate the derivative of g(t,x) w.r.t. x (Leibnitz?? thrm??) Doing this we get: dx!/dx = integral from 0 to inf ( x * t to the power of (x-1) * e to the power -t) dt = x * integral from 0 to inf ( t to the power of (x-1) * e to the power -t) dt = x * G (x) = x * (x-1)! = x! That is, the derivative of x! is x! I wasn't expecting this result, since the one function you can easily get that equals its derivative is the exponential. A question one could ask is can you really find ALL functions, defined in any way, that equal their derivatives and which are they? -- Panos Economopoulos UUCP: {decvax,linus,ihnp4,uw-beaver,allegra,utzoo}!utcsri!panos CSNET: panos@toronto