What derivative should be taken for relative maxima and absolute maxima (or minima)? I get confused on what derivative should be taken for defining relative maxima and absolute maxima because some sources said to use first derivative while the others said to use second derivative.
Also is relative maxima same as local maxima?
I really need detail with prove or example about them.
 A: The first derivative is used to detect critical points.  Find where the first derivative is zero or undefined.  These critical points can be local maxima, local minima, and inflection points.  
Now that you have a list of critical points, you want to know which of them are maxima, which are minima, and which are critical points.  For this you need(*) the second derivative.  If the second derivative is strictly positive, you have a local minimum.  If strictly negative, a local maximum.  If zero, you can't tell; the critical point could still be any of the three cases.
"relative maximum" and "local maximum" are synonyms.
(*) You don't really need the second derivative, this is just one way.  Another way is to look at the sign pattern of the first derivative.  If it goes from negative, to zero, to positive, then you have a local minimum.  If from positive, to zero, to negative, then you have a local maximum.  If from positive, to zero, to positive, then you have an inflection point.
A: For simplicity, I talk about functions $\mathbb{R} \to \mathbb{R}$.
An extremum means either a maximum or a minimum. 
A relative extremum is a local extremum, they are synonyms. Some older texts seem to prefer to use "relative" rather than "local", say Apostol's calculus. 
That the derivative of a function $f$ at a point $x$ equals $0$ is a necessary condition for $f(x)$ to be a local extremum and for $f'(x)$ to exist. We refer to a point $x$ such that $f'(x) = 0$ as a critical point of $f$. 
If $x$ is a critical point of $f$, then $x$ can be either a local extremum or not a local extremum. For example, if $f: x \mapsto x^{3}$ on $\mathbb{R},$ then $f'(0) = 0$ but $f(0)$ is never a local extremum of $f$. Such a point is called a saddle point. 
To determine whether a critical point is a point at which $f$ attains its local maximum or minimum we can use the sign of $f''$, which is the so-called second derivative test.
