# Approximating the Relative Extrema (Using Python, It’s Very Easy)

(D4M) — Here is the video transcript for this video.

00:00
in this episode you’ll learn how to approximate the relative extrema of a
function using the python programming language
it’s easy to follow along and it’s free to get started let’s do some math
[Music] hi everyone welcome back we’re going to uh begin by
re-looking at the definitions of relative minimum and relative maximum
and uh just to recall what these mean in terms of the actual symbols and words
and of course how how to put it together with uh you know visualization
so let’s look at a graph of a function and let’s say that continues to decrease
and this is always increasing here and so let’s
look at where the relative extrema are right so here’s where we have a relative

00:01
max right here relative max and here’s where we have a relative min
so let’s call this one right here now i like to use c’s right here so i’m
going to call this c1 and we’ll call this one right here c2 [Music]
because we have two c so i’ll use indices to distinguish them
but the point is that this is a relative maximum [Music]
relative maximum because this condition right here holds so there exists an
interval in other words i can find an interval let’s say we put the interval
in red i can find an interval right here so let’s say this interval is x1 x2
so that if i pick any any x in this interval
if you if you write this implication so if you pick an x in the interval
then f of c is greater than or equal to the output that you get here so if i
pick any x that’s that’s how this is working right

00:02
here if you pick any x in between any x in here
then the high if you go up and compute the height
it will not be as high as the f of c the f c in this case it’ll be f of c one
f of c one will be higher it’ll be greater than or equal to all the x’s no
matter which x you choose in here it’ll be greater than or equal to that
so that’s what we mean by relative max we don’t mean it’s a global max
although in this case it may look like it
but it doesn’t necessarily have to be a global max for example if we make this
one go a little higher here so it’s certainly not the maximum when
you take into account the whole domain but it is a maximum relative to some
interval does there exist an interval where it’s the maximum the answer is yes
relative minimum so again we do the same thing
i claim this is a relative minimum now that doesn’t mean it’s a global minimum

00:03
like i said this keeps going down here so it’s not a minimum everywhere
but it’s a minimum and it’s a relative minimum because it’s a minimum relative
to some interval right here and this one since i already used x1 x2 i’ll say x3
x4 so that if i pick any x in here if i pick any x in between these two so
there exists an interval here’s the interval right here and if i pick any x
in here and i go and compute the height this height right here is lower
so that’s what we mean right here the f of c in this case f of c 2
is less than or equal to all the f x’s no matter which x you choose all right so
that’s just to uh recall now i want to point out that this video
is part of the series uh functions and their graphs
step-by-step tutorials for beginners and so we did a whole uh episode on

00:04
relative minimum and relative maximum so
i recommend checking out that episode in this video though we’re going to uh see
how to find these uh points right here uh using a computer using the python
and so let’s get a look at that so let me get this out of the way first
all right here we go so let’s go to uh some python here
um now you can follow along and you can open up your own python notebook the
link is below in the description to open up a free notebook
it’ll save it on your google drive if you if you want to choose that route or
python notebook and and you’ll get a jupiter notebook installed
um in any case here’s what it’ll look like um let’s zoom in here
um so this is going to be the uh the setup that i’m going to use i’m
going to import all of these packages right here that makes python very easy
to use because we can use all this functionality i’m also going to turn off

00:05
the warnings so that if i divide by zero it it won’t it’ll just ignore that
if you don’t want to do that then you can just comment that
out i’ll comment that out actually for right now and and see if we need that
put that back or not so that’s a comment
symbol all right so i’m going to execute that cell by hitting shift enter
and now because i like my graphs to come
out looking nice i’m going to put arrows on them for example and
i’m going to make the axes go through the origin
if you like the default axes for python then you don’t need to to use the
i use this precalculus axis function so anyway so i’m going to hit shift
enter and execute this code right here so now all that’s in the memory
now we can look at how we’re going to find these relative extrema
so first thing i’m going to do is i’m going to make up a function called plot
function and the basic idea is we’re going to plot the function first

00:06
and i’m going to make some default values my default window is going to be
minus 10 to 10 and my default increment is going to be 0.1 so these are the
small little tiny steps that we’re going to use to plot our function
so the strategy will be to first plot the function and get a decent view of it
and so that’s what this function is for and then we’re going to have two
functions down here one called relative max and one called relative min and
we’re going to take in a function and we’re going to take in a window and
we’re going to take it in increment size now what this notation means is that
this is a default value so the x minimum by default is -10 in fact that’s the
case for all three of these functions and the default value is x maximum so if
you don’t input an x maximum value it’ll just assume you want 10. so i put some
default values here to make these functions very nice to use very easy to use
and so we’re going to execute those three functions so type that up and
we’ll get our three functions going and before i go through this step by step

00:07
and explains what it do what it does let’s look at a couple of examples and
see how to use them first all right so here’s our first example
find the relative extrema of the function defined by
f of x equals minus two x squared plus one so i’m looking for the relative
minimum and the relative maximum if there are any
and so the first thing i’m going to do is i’m going to define this function
now i’m going to have here a couple of examples so i’m just going to define my
function i’m just going to call it f1 you know it’s the function f it’s the
first example so um here’s my function here so i’m going
to define it so def definition and i’m just going to return whatever input i’m
given minus 2 times and then that’s x squared
and then plus one so there’s my function and let’s hit shift enter to define it
and now i’m going to plot it and i’m going to change the window to minus 1 1
and i’m going to change my increment to 0.01 so let’s execute that and see if we

00:08
get a good sketch there all right so it looks like we’re getting
a relative maximum so i’m going to try to use the relative
maximum function to find out it looks like it just goes through a 0 1
but you never know it could be like a little bit higher than one or a little
bit shorter than one so we’d like to be able to get some good precision there
but before we look at the relative maximum function let me just make sure
you’re okay with the plot function right so first we define a function we did
that and now i’m going to give it a window so here’s the default window so
if you hadn’t given a window this is what it would look like here
and so now it’s really hard to tell you know because it looks like it almost
goes through zero zero right there if you don’t look close enough
so this is not a great window uh to look at so i’m going to look at a better
window and uh you know playing around with a
little bit you come to realize that this
is a decent window here because it looks a little bit more accurate there but

00:09
let’s go down and find the um relative maximum now so i’m going to
input my function one [Music] that we defined and i’m going to
use minus one to one now this uh window right here i call it a window the
domain or whatever you want to call it but you need to make sure that before you
use the relative maximum function that there is actually a relative maximum
so if there’s a relative maximum and a relative minimum and maybe multiple
relative maximums right so if you’re if you give it a bad window here it can
give you unpredictable results so this is going to give us a nice result here
because from between -1 to 1 it’s very clear that there’s only a relative
maximum and nothing else is going on so i’m going to execute this cell right
here and i’m going to get out and that in fact it does go through this height of
one here so this is relative maximum and it occurs at at the x value of zero

00:10
and so that’s how we do that problem there let’s do one more before we look
into these functions and see what they actually do i won’t spend a lot of time
on that but i’ll take a peek and decide inside this function and see what it
looks like but let’s look at one more example first so now let’s find the
relative extrema oh actually let me make sure that we’re finished on
this example here first so let’s just find the relative extrema
and we found a relative maximum are there any relative minimum
so you know if i zoom out a little bit and i say go to back to the standard
window here it doesn’t look like just any relative
extrema now maybe you’re not convinced so maybe we’ll go to 100
and now it just you know keeps the same shape basically just the numbers are
changing now um this right here is what minus 20 000.
now look at these numbers over here all you’re doing is squaring and multiplying

00:11
by -2 and adding 1 to it there’s no big numbers here
so i think it’s pretty clear that if you zoom out all the way here that you
should be able to convince yourself that this graph is doing nothing else it’s
just increasing here hits this highest point and then it’s decreasing there so
i’m going to say this function right here
only has a relative maximum and doesn’t have any relative minimum
all right so you want to make sure by changing your window to convince
yourself that you found all the relative extrema
now when you take a calculus course we’ll learn techniques uh to help us
better find these relative extreme and relative maximum rather than just using
technology we could actually deduce it to a large extent on our own um maybe
not get the uh exact decimals every time
uh but we can find exact answers and and a large a number of examples all right
but that’s calculus this this is just here’s a function right here we want to
plot it and we want to find the relative extrema right here so here’s what we’re

00:12
going to do so it’s example 2 so i’m going to say f2 so i’m defining a function
and all it’s going to do is take in an input it’s going to calculate all that
up and then it’s going to return it so what is it calculating so 2 times x to
the third so that’s exponent and then minus 2 times x and then plus 1.
all right and so let’s look at that on a decent window
so let’s shift enter on the definition and then shift enter on the plot here
all right very good so now i change the window to -1 to 1 again
and i found a good relative max that i’m going to try to find in a good relative
min that i’m going to try to find but you know i always like to try to
start off on the standard one here and all right so here it looks like it may
not even have anything if you look at that window right there it’s not very
clear what’s happening we’re just increasing and then we’re just

00:13
increasing that’s kind of what it looks like right there but that’s not a really
good window it’s hard to see what’s happening in here
but what i’m trying to do is i’m trying to zoom out and see does it ever come
back down anywhere so i’m going to zoom out some more
and yeah so i’m going from 100 over here to x and it’s still going up right here
and i’m looking at these numbers right here all i’m doing is multiplying by two
by minus two and adding one those are really small numbers right so when i go
all the way out to 100 i’m still going up now if you’re not
convinced well just go out some more so it’s just keeping the same shape here
it doesn’t ever seem like it’s curving back down now again you can figure that
out when you get to calculus but but not right now so right now uh this looks
like the basic shape is just increasing and then we kind of can’t tell what’s
happening in here and then it’s just increasing forever more it seems so i

00:14
want to change back and get to a smaller window and try to find out what’s
happening in here so i’m going to look at between -1 and 1 and see if i zoom in
now and see if i can get better shape here so let’s go with -1 here
to 1 and again that’s just a guess uh but wow that turned out to be looking
pretty nice so by zooming out we figured that it’s just going to keep rising and
here it’s just going to be increasing here so this looks like a relative
maximum right here so i’m going to try to find a relative maximum so i’m going
to be looking at a relative maximum for f2 here and i’m going to be looking
between -1 and you don’t want to say -1 to 1 because you got two things here
and you really want to find an interval where that’s just going to be maximum
you really want to find something close to it so i don’t know exactly what it is
but i’ll say between -1 and 0. so definitely between -1 and zero nothing

00:15
there’s no other max’s right there so i’m going to use minus one and zero and
then i want to get a lot of accuracy in my final answer so i’m going to use a
couple more zeros here now be careful adding too many zeros here because it
may bog your computer down so let’s see here let’s execute that
and there we go so it looks like the relative maximum right here is just a
little bit above 1.75 so it looks like it’s 1.7698
right and so you maybe you want to round that to 1.77
you know but that’s a pretty good uh estimate there you can rely upon
lots of decimals there because we got lots of zeros here
all right so this is just intuitive approach here
but you know it allows us to at least figure out what’s going on here what
about here uh does it ever reach the 0.25 here well let’s see here so now
this window i’m going to use a 0 to a 1 as my window to find my relative min

00:16
so i’m going to use my relative min function i’m going to use my function f2
0 to 1 and then i use an increment here and now let’s shift enter execute that
cell and we get 0.23 and so you can kind of tell that it just barely dips below
that 0.25 0.2301 to right so there we go where’s a
relative maximum there’s a relative minimum so
we have actually found those values right there
all right so now let’s uh before we go on and look at some more let’s just take
a quick peek at these functions right here um so this is a function called plot
function we’re going to input a function into it so that’s why we’re declaring
functions first we’re defining these functions and then we’re going to have an x
minimum with a default value and an x maximum with the default value
in an increment with a default increment value which is just 0.1
all right so we’re going to define a figure

00:17
and we’re going to put some axes on it and we’re going to customize these axes
this is the customization function i used before if you don’t want to use
that then you can just comment out or just you know not include that line there
but in any case we’re going to make a bunch of x values so think about this as
making a bunch of uh x and y’s like an xy table
and the x’s is going to start at the x minimum the default values minus 10
and then we’re going to add a little bit to that we’re going to
increment it so it’s going to be minus 10 plus
0.1 that’ll be the next x value and then minus 10 plus
0.1 plus 0.1 and we’ll keep adding the on 0.1s until we get to the last one
which will be the x maximum which will be a 10. so it’s going to add uh it’s
going to put a whole bunch of tick marks or a whole bunch of inputs and we’re
going to go and calculate the outputs and that there’s right there is it takes
that x all those x’s and it plugs it into the whatever function we gave it

00:18
and it’ll calculate all those y’s up for us right there
and then we’ll make a plot and then last
case we’ll and we’ll put the axes on the plot and then we’ll show the plot right
there so that’s what this function right here does all right so um
that gave us the standard window which we want to play with just like we did
here um and then once you’ve found a good
window you can use the relative max and relative min functions to find them so
what do these do so they take in the same inputs a function
a minimum value a maximum value and an increment and i use the same default
values here so i’m just going to again make out a table a table of
numerical value decimals right here and calculate the y’s and then i’m just
going to return the maximum of those so this function just is really pretty dumb
it just you know computes the maximum value so you have to be
smart enough to know what to give it you have to give it a function that you’re

00:19
interested in but you also have to give it an x-min and an x-max and you have to
be careful and you have to make sure that the maximum it’s giving you is
actually a relative min and a relative max so that’s why i recommend plotting
the function first so you can actually see
um and then you can calculate and then the relative min is basically the same
and just going to calculate the minimum values right there
so these are handy useful functions but they’re not going to replace the
mathematics the mathematics will tell you the precise way
right so this is the mathematics here this is the actual definition and this
is the actual definition and you know this works for any function
whether or not you can plot it whether or not it’s continuous you know whether
or not it has all these nice features this is definition this works for your
function no matter how crazy your function looks all right so
let’s go back and look at another example now let’s look at [Music]

00:20
example three here we go so let’s see if we can
make that a little bigger here so find the relative extrema we have a cubic
minus 3x squared minus 9x plus 6. all right and so i’m going to say okay
this is f3 for example three so x to the third minus three times x squared
minus nine x plus six so function f3 is defined now i’m going to plot it
so let’s shift enter here and then uh let’s plot this function right here
and i played around with the windows a little bit and i chose from -5 to 6
and i got a good window here where i can see the relative maximum and the
relative minimum so again i recommend playing around with
the zoom zoom in and zoom out so that you feel comfortable that this
is the best window that shows you all the features if you zoom out you’re

00:21
going to see that this is just going to keep
increasing and again if you zoom out you’re just going to see that this is
just increasing here so this does not bend up here
and i check that by zooming out by saying you know what does it look like
between minus 100 and 100 or something like that so you definitely want to keep
that in mind and plot the function and so you’re convinced yourself that you’ve
found a relative min a maximum and a relative minimum and now we’re ready to
go find out what those values are what is this height here what is the actual
relative maximum here so let’s see so i’m going to say relative maximum and
i’m going to use the window so it’s about right here right so i’m going to
use the window from -2 to 0 and i’m just going to accept the default
uh increment here and so i’m just going to get 11.0 here
so execute that and it looks like the height here is 11.0
and then for the minimum right here let’s see what is the relative minimum

00:22
right here so the minimum is so here’s f3 again same function now i’m going to
look between two and four and now you see i don’t have to choose nice
round numbers like that right we can choose 2.1 and we could use say 4.3
so if i execute that you still get the same
same number because all you need is a interval around it there you go so
if you for example had something like this it went down and then it went down
again so you have two relative mins now on this one right here you don’t
want to make your window let’s say this is a a 2
and this is a 5 you don’t want to make your window be a 1 2 a 6
and expect them to find both of them right that’s not how the function worked
that’s why i wanted to show you these functions right here so you cannot use a

00:23
window from one to six and expect it to find this relative minimum right here so
you need to choose a window so here i would choose this is a five right here
so i would choose a window around to like maybe one point you know eight or
something like that and then like 2.1 or something like that so you want to zoom
in and make sure that you get an interval
that contains only this relative minimum
and not that relative minimum and if you choose your interval right then you’ll
get that relative minimum out of all that all right so here we go to find this
window right here i’m just going to choose a window containing this one
right here and i chose 2.1 to 4.3 so once you choose that
shift enter calculate it and it looks like it’s just minus 21 right here
all right so very good so let’s look at another example
find the relative extrema of this function and so we need to define this
function let me put this down and and let’s see if we can define this real

00:24
quick right here so definition f4 and i’m going to input an x
and i’m going to say return and we’re going to return
and we’re going to say x to the fourth and then space and then minus four
the space right here is optional but i usually like to space them out minus
four and then times x to the third all right good and then plus six i
usually like to space some of the terms out there like that all right so
i’ll execute that and now we’re going to come back here and plot this
so i’m just going to copy and paste up here i’ll copy and paste that down there
speed things up a little bit so i’m going to plot f4

00:25
and i’m going to go back and just you know use default values
all right so there’s plot of f4 now it looks like it’s just going to continue
to go up here or it’s decreasing on this interval right here we’re looking at
this we’re already at minus 14 000 so i don’t think it’s gonna i don’t think
it’s going to curve down here up here now you have to use your intuition a
little bit but i look at some numbers over here if this was x to the fourth
minus four x to the third plus 60 000 then maybe i would uh you know
zoom out even a little bit more but all the numbers here are small it’s a six
it’s a four so i think intuitively um i’m just gonna you know say that this
is just going to keep coming down and it looks like it’s just going to decrease
maybe it has a relative minimum somewhere here and then it’s just going
to start increasing again but i i can’t really tell what’s happening down here

00:26
so i’m going to move the windows to say minus 2.5 to 2.5 and see what happens
and just keep the standard increment there [Music]
ah looks like i might have a relative min and then a relative max
but it’s actually still hard to tell that maybe it’s just going to be
decreasing the whole way so now i’m going to zoom in some more
i’m going to zoom in between minus 1 and 1 and see what’s happening
okay so i still can’t tell very well if it’s just decreasing the whole way
[Music] maybe we’ll zoom in a little bit closer like let’s say 0.5
all right so now i’m pretty convinced that it’s not curvy there it’s just
going down so you know this is just pre-calculus when

00:27
you get to calculus you learn a lot more tools to uh make this be less um
less intuitive and more precise um but you know for this episode here we’re
just going to say all right that there’s no relative extrema on this function
right here um well i take that back i mean
it does start to come up over here right so it has to have a relative
minimum somewhere let’s go back out here to a one um [Music] and then a zero a
let’s go to a 2 and then a 3 5 so it is going to have a relative
minimum it looks like it’s right at 3 so i’m going to go between 2 and 4 and
find that relative minimum right there so let’s do that

00:28
so i’m going to copy this here and get a new cell here if you hit escape b
gets a new cell so let’s do a relative minimum of function 4 here
and then i’m going to be looking on the window here from 2 to 4.
right so it looks like it’s going to hit -21 right there so we got a relative
minimum so that’s excellent um do we think we have a relative maximum anywhere
so maybe we have a relative maximum somewhere in here
let’s look between zero and two so this is curve back down over here anywhere
so let’s look at say -1 so does that curve back down right here
to get a relative maximum um i don’t think it does

00:29
let’s try minus one minus point one um and a one
all right so there it starts to go down and we get our relative minimum over
here but does it start to go up so what about 0.3 0.4
so it looks like it starts to go up and it’s going down so i think we’re going
to have a relative minimum somewhere in here right um relative minimum
we’re going to be decreasing and then we’re still decreasing so
yeah i don’t think we’re going to have a relative maximum here if we’re
increasing here and then we’re decreasing then we would have a relative maximum
but it doesn’t seem like it’s doing that or if it is it’s hard to tell by

00:30
looking at these numbers here so let’s say
we’ll leave the rest of this to calculus all right so i don’t want to start
breaking into a bunch of calculus but for pre-calculus purposes
we looked at this graph and we found a relative minimum
all right let’s go on to the next one here f5 here so let’s go and
um copy this definition right here and let’s change it so f5 here
um and let’s see here we’re going to get an x squared
and i’m going to put that in parentheses and say times parentheses
and then i’m going to say x minus 2 and then to the power 3
all right there we go um so we have an x square times an x minus two

00:31
raised to the third all right there’s f5 and now let’s go ahead and plot this so
i’m going to plot this function right here f5 and let’s use the default window
minus 10 to 10. all right very good so it looks like it’s just increasing here
and then who knows what it’s doing in here and then it starts to increase again
again all the numbers here are pretty small so i’m confident that it’s just
going to keep increasing and then you know this is just increasing here so
let’s check out what’s happening say between minus five and five
all right let’s see a little better but not that much better let’s look in

00:32
between minus two and two all right still can’t tell very much um minus one
oh there we go that’s a little bit better um about minus 0.5 there we go
and now we may want to go out to a 3 just to check
all right there we go so nothing’s really happening after 2 [Music]
is that right um 2.1 maybe all right 2.3 2.5
all right there we go after that it’s just going to keep going up
and so we got a relative maximum we have a relative minimum
and this doesn’t look like either right so to have a relative maximum you’re
increasing and then you’re decreasing to have a relative minimum you’re

00:33
decreasing and then you’re increasing here it looks like we’re just increasing
all the way through we’re just increasing so there’s not
going to be either right there so what are we going to have right here so let’s
check this out so i’m going to say relative max and my function is f5
and i want to give it a window of minus .5 to 0.5 and there’s the
it’s got the e to the -32 on there so it’s pretty much going to be zero yeah
so it’s got this um exponential so there’s a lot of zeros in this

00:34
so basically it’s just zero all right so we’re going to call that a
so let’s go here and get another input cell and call this min
and then now for this right here i’m going to say it’s between 0.5 right here
0.5 and 1.0 so it’s between those two and
and there we go so we’re going to get a minus 1.10529 right there
for that relative minimum right there all right there we go so
now let’s look at example six and i thought it would take a little bit of
time to type that in so i went ahead and did that already so

00:35
here’s our function f6 so let’s just make sure we got it right x to the third
minus three x plus two all divided by x squared plus two x plus one
so let’s shift enter execute that um and now let’s plot this
and see what it looks like so i’m just going to copy that up there and
get a new input cell paste it in change it to f6
and then i’m just going to look at the defaults all right so now it’s what’s
happening is this denominator is coming up with a 0
right here somewhere and so it’s trying to divide by zero
but it does give us the sketch but it’s saying that during the sketch of this it
divided by it tried to divide by zero so what i’m going to do is
i’m going to get rid of this error right there so i just don’t like
it just i understand what’s happening i know some of the input

00:36
was trying to divide by zero so i don’t need that warning there
so let’s go here and plot it now and now that error is off
so this has an isotope basically that’s what that error was saying um
has an isotope right in between so somewhere in here there’s an isotope
right through there all right but we’re looking for a relative extrema
now what i’m noticing from this graph right here is that it looks like i’ll
exaggerate it over here looks like it’s doing this and it’s going down and then
it looks like it starts to go up again so it looks like it’s just doing this
so this looks like this right here will be a relative min
so it looks like i’m going to try to find a relative min here
but uh over here it doesn’t seem to be doing that so it’s increasing and then
it keeps increasing so i don’t think there’s anything on this side but here
on this side it’s decreasing and then it starts to increase a little bit

00:37
now what about anything else does it does it continue to do this does it go
back down or does it just keep going up and so let’s zoom out here and see
what’s happening so i’ll uh change the window to [Music] -10 to say 20.
all right and so it looks like it just kept going up
and then i’ll take it to an extreme and just check out long-term behavior
yeah so long-term behavior is there is a minimum there because it’s
decreasing but then it just keeps increasing after that
all right so let’s go back to a decent window here all right um
and so we know that this goes up so we know we’re going to have a relative
minimum somewhere in here um and what about over here what’s the long
term over here so [Music] let’s do -100 and so it looks like it’s just going to

00:38
be increasing increasing increasing and it just keeps increasing
so we’re not going to have any uh relative min or or max here but over
here we will let’s go back to say -1 here okay so actually we needed more than
that right let’s go to -2. all right so we’re trying to find the
relative minimum here and if you just look on this window right here it
actually doesn’t look like there’s going to be a relative minimum it just looks
like it keeps going down excuse me but we know because we’ve changed the
window we know it starts to go back up so we know somewhere in here is going to
be a relative minimum we just have to capture it so i’m going to say relative
min and i’m going to say 0.0.5 right here and then i’m guessing at a 10

00:39
does it already start to come back up um maybe we want to try
that window and just see what it looks like here so at 10
it already starts to look a little higher so i’m confident that there’s
going to be a relative min here and so let’s find that in fact it’s just zero
so once it hits zero right there then it starts to increase very slow increase
but it’s still increasing so it’s going down and then it hits zero right there
right through the origin and then it kind of just bounces and slowly starts
to increase right there so there’s the relative minimum right there
all right so now let’s look at our last example find the relative extrema of
this function right here so let’s see what’s happening we got the square root
we’re dividing and yeah so let’s see what this looks like so this is going to be

00:40
definition um number seven and so i’m going to say return so return x
and then divided by and then i’m going to put parentheses
and then we’re going to need um square root of x squared minus 1. so how are we
going to do square root here so let’s try square root of x
and then we’re going to square that and then minus 1.
and so let’s actually see if that actually worked let’s just plug in a number
um what happens if we plug in say a zero well we can’t right what happens if we
plug in a 1 well we can’t well what happens if we plug in a 2
we should be able to plug into 2 so f of 2 should be 2 over square root of
2 squared right so this should be two so this should be square root of two down

00:41
here right so four minus one oh a three so right if you plug in two you can get
four minus one so two over square root of three
all right so let’s see what we get here all right so it doesn’t like the
square root here as my understanding so we need to um [Music] use some type of
there we go so we’re using this np right here um package right here or this
yeah so we’re using it right here is mp right here so this allows us to
uh use a this this right here has a square root built into it
so there we go we can take the square root of something right there here’s how

00:42
we do it um all right so now if we input a 2 [Music] so
this seems to be maybe a little bit off to me because
when this is a 2 here this will be 2 and this will be square root of 3 down here
and that doesn’t seem to be that seems to be pretty much a two so
when i plug into two i’m getting out of two
but it seems like i should get out two over square root of three um
which is if i rationalize it two square roots of three over three which is um
you know not two [Music] so i’m still not convinced
all right i see what the problem is the square root here
is around all right so we’re taking the square root of
x squared and then minus one and okay and so now we’re getting uh

00:43
something that makes sense all right so my bad there um
so there it is x divided by and then we’re gonna take the square root of all
of that x squared minus one um so this parenthesis right here closes
the square root and this parenthesis right here is just for division
all right so there we go all right so now let’s plot f f7
so i’ll just take that and paste it down here and say f7
and then who knows what it looks like let’s look at the standard window there
and that’s we get when we plot that um yeah so what the heck is all that right
so let’s try to find out um you know if we start trying to look at the domain
of this we need x squared minus one to be greater than or equal to zero
in fact since it’s in the denominator we need it strictly greater than zero

00:44
so we need x squared to be greater than one um you know so [Music]
or we can try something like this x minus one x plus one
equals zero we can look at a minus one and one you know where’s the domain
so if i try zero zero doesn’t work um and it’s straight so i’m not going to
include the one so the domain is going to be over here
and the domain is going to be over here so the domain of this function right
here is minus infinity to zero but don’t include zero union
zero to positive infinity here uh sorry um don’t include the
don’t include the the ones so minus infinity to -1 union
one to positive infinity here so that’s what the domain is here

00:45
um so that’s why there’s a break in it right here and
so let’s first look on this domain over here let’s look at it say one two ten
and that looks a lot more reasonable there to look at it between those we’re not
going to run into a problem with domain issues so i’m going to look at the right
first and then i’ll look at the left and so what do you think is there a
relative is there a relative minimum right here
somewhere does it start to increase again so let’s look at something like 20.
it sure doesn’t look like it looks like it’s just decreasing um now
again later when we learn calculus we’ll learn all about limits and isotopes and

00:46
i know that there’s going to be an isotope here at y equals one
that’s an isotope and so it’s going to be decreasing and it’s just going to be
getting closer and closer to that isotope
so there’s not going to be any relative extrema there
so now let’s flip the switch and let’s go from -20 to -1
and we’re going to get the same thing we’re going to get an isotope right here
horizontal isotope going right through here at minus one and so yeah it’s just
decreasing all the way through here so there’s going to be no relative
extrema on this function at all all right and so there we go um [Music]
hope you enjoyed this video and i look forward to seeing you next time uh in
the next episode we’re going to look at approximating zeros of a function using

00:47
python also so i’ll see you next time thanks for watching
if you enjoyed this video please like and subscribe to my channel
and click the bell icon to get new video updates

David A. Smith (Dave)

Mathematics Educator

David A. Smith is the CEO and founder of Dave4Math. His background is in mathematics (B.S. & M.S. in Mathematics), computer science, and undergraduate teaching (15+ years). With extensive experience in higher education and a passion for learning, his professional and academic careers revolve around advancing knowledge for himself and others. His work helps others learn about subjects that can help them in their personal and professional lives.

Let's do some math together, today!