a programming and math blog.

Wednesday, March 19, 2014

Introduction to derivatives

7:49 PM Posted by Unknown , No comments

Introduction

Derivatives are functions that are (as you can assume) derived from other functions. Derivatives tell you the slope (a.k.a. rate of change) of a function at a given point.

For example, assume we have a function $f(x)=\frac{x^3}{3}$:


 The derivative of this function is $f'(x)=x^2$. Notice the $'$ after the $f$. This is one of the ways you can denote a derivative. It's read 'f prime of x'.

We can graph the derivative on top of $f(x)$ to get an idea of what is going on:


If we compute $f'(1)$ we see get the result of $1$. This means that the slope at $f(1)=1$. You can easily tell if the slope is $1$ if it appears to make a $45^\circ$ turn from either positive axis. Likewise, $f'(1)=-1$, therefore, the slope at $f(-1)$ is -1.

You can compute $f'(x)$ for any $x$ in the domain of $f$.

Definition

The simplest definition of a derivative involves computing a limit.

Imagine that we want to get the tangent line of the curve $f(x)=\frac{x^3}{3}$ at $x=1$. We could start by making an approximation by drawing a line through two points on the curve. those points are at a distance $h$ on the x-axis.



If we would infinitely keep making $h$ smaller, we would eventually get the tangent line at the point $x=1$. If we can get the slope of the tangent line (which measures the instantaneous rate of change at a point), we have the derivative. This is the limit definition of the derivative:

$$\lim_{h\to0}=\frac{f(x+h)-f(x)}{h}$$

Example:

Find the derivative of $f(x)=4x^2$.

Start with the limit definition of the derivative.
$f'(x)=\lim\limits_{h\to0}\frac{f(x+h)-f(x)}{h}$

Substitute.
$f'(x)=\lim\limits_{h\to0}\frac{4(x+h)^2-4x^2}{h}$

Expand numerator.
$f'(x)=\lim\limits_{h\to0}\frac{4x^2+8xh+4h^2-4x^2}{h}$

Subtract.
$f'(x)=\lim\limits_{h\to0}\frac{8xh+4h^2}{h}$

Divide.
$f'(x)=\lim\limits_{h\to0} (8x+4h)$

Solve the limit.
$f'(x)=8x$


The limit definition of the derivative is one of the building blocks for some shortcuts for finding derivatives more quickly. I will write more posts concerning derivatives soon. I hope this was useful. All feedback is welcome!

Hello World!

5:06 PM Posted by Unknown No comments
I decided to start a blog (mostly) about programming and mathematics to:
  • help me remember things that I learn.
  • use as a reference.
  • improve my writing skills.
  • hopefully help someone else out.
I work with many diverse computer topics. So, as you can imagine, I bounce all over the place. One day I'll be working on a project, lose interest or rage quit, then find myself doing something totally different. Probably a lack of self-discipline. Here is a list of some of my interests (order doesn't matter):
  • web development & design
  • general c/c++ programming
  • algorithms
  • 3D graphics
  • game programming
  • shaders
  • procedural generation
  • language parsing
  • cryptography
  • calculus
  • physics
  • computer engineering
  • music
  • networks (of all kinds; "friends, money and bytes")
  • user experience
I'm going to try to install MathJax so that I can write equations and whatnot on here.

If you're wondering what the blog's title means, it's two's complement.

If you passed by, please leave a comment. Cheers. Follow me on g + if you want.