forked from CalculusWithJulia/CalculusWithJulia.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
inversefunctions.html
7899 lines (7578 loc) · 233 KB
/
inversefunctions.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"
rel="stylesheet">
<style>
.julia {display: block; font-family: "Source Code Pro";
color:#0033CC;
}
.hljl {font-family: "Source Code Pro";
color:#0033CC;
}
body { padding-top: 60px; }
h5:before {content:"\2746\ ";}
h6:before {content:"\2742\ ";}
pre {display: block;}
th, td {
padding: 15px;
text-align: left;
border-bottom: 1px solid #ddd;
}
tr:hover {background-color: #f5f5f5;}
.admonition-title:before {content:"\2746\ ";}
.admonition-title { color:#0033CC}
</style>
<!-- .julia:before {content: "julia> "} -->
<style></style>
<script src="https://code.jquery.com/jquery.js"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
inlineMath: [ ["\$","\$"], ["\\(","\\)"]]
},
displayAlign: "left",
displayIndent: "5%"
});
</script>
<!-- not TeX-AMS-MML_HTMLorMML-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML" async></script>
</script>
<script>
window.PlotlyConfig = {MathJaxConfig: 'local'}
</script>
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<script type="text/javascript">
$( document ).ready(function() {
$("h1").each(function(index) {
var title = $( this ).text()
$("#page_title").html("<strong>" + title + "</strong>");
document.title = title
});
$( "h2" ).each(function( index ) {
var nm = $( this ).text();
var id = $.trim(nm).replace(/ /g,'');
this.id = id
$("#page_dropdown").append("<li><a href='#" + id + "'>" + nm + "</a></li>");
});
$('[data-toggle="popover"]').popover();
});
</script>
</head>
<body data-spy="scroll" >
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li><a href="#" id="page_title"></a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
Jump to... <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu" id="page_dropdown"></ul>
</li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
<header>
</header>
<div class="title">
</div>
<div class="container-fluid">
<div class="span10 offset1">
<h1>The Inverse of a Function</h1>
<p>A (univariate) mathematical function relates or associates values of <span class="math">$x$</span> to values <span class="math">$y$</span> using the notation <span class="math">$y=f(x)$</span>. A key point is a given <span class="math">$x$</span> is associated with just one <span class="math">$y$</span> value, though a given <span class="math">$y$</span> value may be associated with several different <span class="math">$x$</span> values.</p>
<p>We may conceptualize such a relation in many ways: through an algebraic rule; through the graph of <span class="math">$f$</span>; through a description of what <span class="math">$f$</span> does; or through a table of paired values, say. For the moment, let's consider a function as rule that takes in a value of <span class="math">$x$</span> and outputs a value <span class="math">$y$</span>. If a rule is given defining the function, the computation of <span class="math">$y$</span> is straightforward. A different question is not so easy: for a given value <span class="math">$y$</span> what value–or <em>values</em>–of <span class="math">$x$</span> (if any) produce an output of <span class="math">$y$</span>? That is, what <span class="math">$x$</span> value(s) satisfy <span class="math">$f(x)=y$</span>?</p>
<p><em>If</em> for each <span class="math">$y$</span> in some set of values there is just one <span class="math">$x$</span> value, then this operation associates to each value <span class="math">$y$</span> a single value <span class="math">$x$</span>, so it too is a function. When that is the case we call this an <em>inverse</em> function.</p>
<p>Why is this useful? When available, it can help us solve equations. If we can write our equation as <span class="math">$f(x) = y$</span>, then we can "solve" for <span class="math">$x$</span> through <span class="math">$x = g(y)$</span>, where <span class="math">$g$</span> is this inverse function.</p>
<p>Let's explore when we can "solve" for an inverse function.</p>
<p>Consider the graph of the function <span class="math">$f(x) = 2^x$</span>:</p>
<pre class='hljl'>
<span class='hljl-k'>using</span><span class='hljl-t'> </span><span class='hljl-n'>CalculusWithJulia</span><span class='hljl-t'> </span><span class='hljl-cs'># to load the `Plots` package</span><span class='hljl-t'>
</span><span class='hljl-nf'>f</span><span class='hljl-p'>(</span><span class='hljl-n'>x</span><span class='hljl-p'>)</span><span class='hljl-t'> </span><span class='hljl-oB'>=</span><span class='hljl-t'> </span><span class='hljl-ni'>2</span><span class='hljl-oB'>^</span><span class='hljl-n'>x</span><span class='hljl-t'>
</span><span class='hljl-nf'>plot</span><span class='hljl-p'>(</span><span class='hljl-n'>f</span><span class='hljl-p'>,</span><span class='hljl-t'> </span><span class='hljl-ni'>0</span><span class='hljl-p'>,</span><span class='hljl-t'> </span><span class='hljl-ni'>4</span><span class='hljl-p'>)</span><span class='hljl-t'>
</span><span class='hljl-nf'>plot!</span><span class='hljl-p'>([</span><span class='hljl-ni'>2</span><span class='hljl-p'>,</span><span class='hljl-ni'>2</span><span class='hljl-p'>,</span><span class='hljl-ni'>0</span><span class='hljl-p'>],</span><span class='hljl-t'> </span><span class='hljl-p'>[</span><span class='hljl-ni'>0</span><span class='hljl-p'>,</span><span class='hljl-nf'>f</span><span class='hljl-p'>(</span><span class='hljl-ni'>2</span><span class='hljl-p'>),</span><span class='hljl-nf'>f</span><span class='hljl-p'>(</span><span class='hljl-ni'>2</span><span class='hljl-p'>)])</span>
</pre>
<div id="ba175cbe-11ea-4ebd-a77d-f81ef52c3d7c" style="width:576px;height:384px;"></div>
<script>
PLOT = document.getElementById('ba175cbe-11ea-4ebd-a77d-f81ef52c3d7c');
Plotly.plot(PLOT, [
{
"xaxis": "x1",
"colorbar": {
"title": ""
},
"yaxis": "y1",
"text": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"x": [
0.039063276079152526,
0.40025966867349133,
0.6173236452224955,
0.800848474863063,
1.0002078801322056,
1.1839996181385126,
1.3810437856259592,
1.6093387773541292,
1.8122204244440858,
1.99012934616088,
2.184097826621278,
2.3792191150112485,
2.594950650497617,
2.8002137629793737,
3.013639774045402,
3.1932990146673808,
3.3029707993064186,
3.4126425839454564,
3.515737296230145,
3.618832008514834,
3.783997732289537,
3.9491634560642397,
3.9745817280321196
],
"showlegend": true,
"mode": "lines",
"name": "y1",
"zmin": -0.1,
"legendgroup": "y1",
"zmax": 0.1,
"line": {
"color": "rgba(0, 154, 250, 1.000)",
"shape": "linear",
"dash": "solid",
"width": 1
},
"y": [
1.0274465018201824,
1.3197454285408055,
1.534026755086117,
1.742125400600867,
2.0002882038184313,
2.2720579281908835,
2.6045674262556435,
3.0511196941586896,
3.5118237089915043,
3.9727261442259727,
4.544425198204494,
5.202550684139792,
6.041683674054713,
6.965436493110616,
8.0759936373444,
9.147002305294178,
9.869457594897751,
10.648974381596837,
11.437796965615215,
12.285051568226182,
13.77516536081378,
15.446022319396926,
15.720571144533864
],
"type": "scatter",
"hoverinfo": "text"
},
{
"xaxis": "x1",
"colorbar": {
"title": ""
},
"yaxis": "y1",
"text": [
null,
null,
null
],
"x": [
2,
2,
0
],
"showlegend": true,
"mode": "lines",
"name": "y2",
"zmin": -0.1,
"legendgroup": "y2",
"zmax": 0.1,
"line": {
"color": "rgba(227, 111, 71, 1.000)",
"shape": "linear",
"dash": "solid",
"width": 1
},
"y": [
0,
4,
4
],
"type": "scatter",
"hoverinfo": "text"
}
]
, {
"showlegend": true,
"xaxis": {
"showticklabels": true,
"gridwidth": 0.5,
"tickvals": [
0.0,
1.0,
2.0,
3.0,
4.0
],
"visible": true,
"ticks": "inside",
"range": [
-0.11923745184096358,
4.093819179873083
],
"domain": [
0.03769928064547487,
0.9931649168853894
],
"tickmode": "array",
"linecolor": "rgba(0, 0, 0, 1.000)",
"showgrid": true,
"title": "",
"mirror": false,
"tickangle": 0,
"showline": true,
"gridcolor": "rgba(0, 0, 0, 0.100)",
"titlefont": {
"color": "rgba(0, 0, 0, 1.000)",
"family": "sans-serif",
"size": 15
},
"tickcolor": "rgb(0, 0, 0)",
"ticktext": [
"0",
"1",
"2",
"3",
"4"
],
"zeroline": false,
"type": "-",
"tickfont": {
"color": "rgba(0, 0, 0, 1.000)",
"family": "sans-serif",
"size": 11
},
"zerolinecolor": "rgba(0, 0, 0, 1.000)",
"anchor": "y1"
},
"paper_bgcolor": "rgba(255, 255, 255, 1.000)",
"annotations": [],
"height": 384,
"margin": {
"l": 0,
"b": 20,
"r": 0,
"t": 20
},
"plot_bgcolor": "rgba(255, 255, 255, 1.000)",
"yaxis": {
"showticklabels": true,
"gridwidth": 0.5,
"tickvals": [
0.0,
5.0,
10.0,
15.0
],
"visible": true,
"ticks": "inside",
"range": [
-0.4716171343360159,
16.192188278869878
],
"domain": [
0.0391878098571012,
0.989747375328084
],
"tickmode": "array",
"linecolor": "rgba(0, 0, 0, 1.000)",
"showgrid": true,
"title": "",
"mirror": false,
"tickangle": 0,
"showline": true,
"gridcolor": "rgba(0, 0, 0, 0.100)",
"titlefont": {
"color": "rgba(0, 0, 0, 1.000)",
"family": "sans-serif",
"size": 15
},
"tickcolor": "rgb(0, 0, 0)",
"ticktext": [
"0",
"5",
"10",
"15"
],
"zeroline": false,
"type": "-",
"tickfont": {
"color": "rgba(0, 0, 0, 1.000)",
"family": "sans-serif",
"size": 11
},
"zerolinecolor": "rgba(0, 0, 0, 1.000)",
"anchor": "x1"
},
"legend": {
"tracegroupgap": 0,
"bordercolor": "rgba(0, 0, 0, 1.000)",
"bgcolor": "rgba(255, 255, 255, 1.000)",
"font": {
"color": "rgba(0, 0, 0, 1.000)",
"family": "sans-serif",
"size": 11
},
"y": 1.0,
"x": 1.0
},
"width": 576
}
);
</script>
<p>The graph of a function is a representation of points <span class="math">$(x,f(x))$</span>, so to <em>find</em> <span class="math">$f(c)$</span> from the graph, we begin on the <span class="math">$x$</span> axis at <span class="math">$c$</span>, move vertically to the graph (the point <span class="math">$(c, f(c))$</span>), and then move horizontally to the <span class="math">$y$</span> axis, intersecting it at <span class="math">$f(c)$</span>. The figure shows this for <span class="math">$c=2$</span>, from which we can read that <span class="math">$f(c)$</span> is about <span class="math">$4$</span>. This is how an <span class="math">$x$</span> is associated to a single <span class="math">$y$</span>.</p>
<p>If we were to <em>reverse</em> the direction, starting at <span class="math">$f(c)$</span> on the <span class="math">$y$</span> axis and then moving horizontally to the graph, and then vertically to the <span class="math">$x$</span>-axis we end up at a value <span class="math">$c$</span> with the correct <span class="math">$f(c)$</span>. This operation will form a function <strong>if</strong> the initial movement horizontally is guaranteed to find <em>no more than one</em> value on the graph. That is, to have an inverse function, there can not be two <span class="math">$x$</span> values corresponding to a given <span class="math">$y$</span> value. This observation is often visualized through the "horizontal line test"–the graph of a function with an inverse function can only intersect a horizontal line at most in one place.</p>
<p>More formally, a function is called <em>one-to-one</em> <em>if</em> for any two <span class="math">$a \neq b$</span>, it must be that <span class="math">$f(a) \neq f(b)$</span>. Many functions are one-to-one, many are not. Familiar one-to-one functions are linear functions (<span class="math">$f(x)=a \cdot x + b$</span> with <span class="math">$a\neq 0$</span>), odd powers of <span class="math">$x$</span> (<span class="math">$f(x)=x^{2k+1}$</span>), and functions of the form <span class="math">$f(x)=x^{1/n}$</span> for <span class="math">$x \geq 0$</span>. In contrast, all <em>even</em> functions are <em>not</em> one-to-one, as <span class="math">$f(x) = f(-x)$</span> for any nonzero <span class="math">$x$</span> in the domain of <span class="math">$f$</span>.</p>
<p>A class of functions that are guaranteed to be one-to-one are the <em>strictly</em> increasing functions (which satisfy <span class="math">$a < b$</span> implies <span class="math">$f(a) < f(b)$</span>). Similarly, strictly decreasing functions are one-to-one. The term strictly <em>monotonic</em> is used to describe either strictly increasing or strictly decreasing. By the above observations, strictly monotonic function will have inverse functions.</p>
<p>The function <span class="math">$2^x$</span>, graphed above, is strictly increasing, so it will have an inverse function. That is we can solve for <span class="math">$x$</span> in an equation like <span class="math">$2^x = 9$</span> using the inverse function of <span class="math">$f(x) = 2^x$</span>, provided we can identify the inverse function.</p>
<h2>How to solve for an inverse function?</h2>
<p>If we know an inverse function exists, how can we find it?</p>
<p>If our function is given by a graph, the process above describes how to find the inverse function.</p>
<p>However, typically we have a rule describing our function. What is the process then? A simple example helps illustrate. The <em>linear</em> function <span class="math">$f(x) = 9/5\cdot x + 32$</span> is strictly increasing, hence has an inverse function. What should it be? Let's describe the action of <span class="math">$f$</span>: it multiplies <span class="math">$x$</span> by <span class="math">$9/5$</span> and then adds <span class="math">$32$</span>. To "invert" this we <em>first</em> invert the adding of <span class="math">$32$</span> by subtracting <span class="math">$32$</span>, then we would "invert" multiplying by <span class="math">$9/5$</span> by <em>dividing</em> by <span class="math">$9/5$</span>. Hence <span class="math">$g(x)=(x-32)/(9/5)$</span>. We would generally simplify this, but let's not for now. If we view a function as a composition of many actions, then we find the inverse by composing the inverse of these actions in <strong>reverse</strong> order. The reverse order might seem confusing, but this is how we get dressed and undressed: to dress we put on socks and then shoes. To undress we take off the shoes and then take off the socks.</p>
<p>When we solve algebraically for <span class="math">$x$</span> in <span class="math">$y=9/5 \cdot x + 32$</span> we do the same thing as we do verbally: we subtract <span class="math">$32$</span> from each side, and then divide by <span class="math">$9/5$</span> to isolate <span class="math">$x$</span>:</p>
<p class="math">\[
~
\begin{align}
y &= 9/5 \cdot x + 32\\
y - 32 &= 9/5 \cdot x\\
(y-32) / (9/5) &= x.
\end{align}
~
\]</p>
<p>From this, we have the function <span class="math">$g(y) = (y-32) / (9/5)$</span> is the inverse function of <span class="math">$f(x) = 9/5\cdot x + 32$</span>.</p>
<p><em>Usually</em> univariate functions are written with <span class="math">$x$</span> as the dummy variable, so it is typical to write <span class="math">$g(x) = (x-32) / (9/5)$</span> as the inverse function.</p>
<p><em>Usually</em> we use the name <span class="math">$f^{-1}$</span> for the inverse function of <span class="math">$f$</span>, so this would be most often <a href="http://tinyurl.com/qypbueb">seen</a> as <span class="math">$f^{-1}(x) = (x-32)/(9/5)$</span> or after simplification <span class="math">$f^{-1}(x) = (5/9) \cdot (x-32)$</span>.</p>
<div class="alert alert-info" role="alert">
<div class="markdown"><p>The use of a negative exponent on the function name is <em>easily</em> confused for the notation for a reciprocal when it is used on a mathematical <em>expression</em>. An example might be the notation $(1/x)^{-1}$. As this is an expression this would simplify to $x$ and not the inverse of the <em>function</em> $f(x)=1/x$ (which is $f^{-1}(x) = 1/x$).</p>
</div>
</div>
<h5>Example</h5>
<p>Suppose a transformation of <span class="math">$x$</span> is given by <span class="math">$y = f(x) = (ax + b)/(cx+d)$</span>. This function is invertible. Find the inverse and describe it's domain.</p>
<p>From the expression <span class="math">$y=f(x)$</span> we <em>algebraically</em> solve for <span class="math">$x$</span>:</p>
<p class="math">\[
~
\begin{align*}
y &= \frac{ax +b}{cx+d}\\
y \cdot (cx + d) &= ax + b\\
ycx - ax &= b - yd\\
(cy-a) \cdot x &= b - dy\\
x &= -\frac{dy - b}{cy-a}.
\end{align*}
~
\]</p>
<p>We see that to solve for <span class="math">$x$</span> we need to divide by <span class="math">$cy-a$</span>, so this expression can not be zero. So, using <span class="math">$x$</span> as the dummy variable, we have</p>
<p class="math">\[
~
f^{-1}(x) = -\frac{dx - b}{cx-a},\quad cx-a \neq 0.
~
\]</p>
<h5>Example</h5>
<p>The function <span class="math">$f(x) = (x-1)^5 + 2$</span> is strictly increasing and so will have an inverse function. Find it.</p>
<p>Again, we solve algebraically starting with <span class="math">$y=(x-1)^5 + 2$</span> and solving for <span class="math">$x$</span>:</p>
<p class="math">\[
~
\begin{align*}
y &= (x-1)^5 + 2\\
y - 2 &= (x-1)^5\\
(y-2)^{1/5} &= x - 1\\
(y-2)^{1/5} + 1 = x.
\end{align*}
~
\]</p>
<p>We see that <span class="math">$f^{-1}(x) = 1 + (x - 2)^{1/5}$</span>. The fact that the power <span class="math">$5$</span> is an odd power is important, as this ensures a unique (real) solution to the fifth root of a value, in the above <span class="math">$y-2$</span>.</p>
<h5>Example</h5>
<p>The function <span class="math">$f(x) = x^x, x \geq 1/e$</span> is strictly increasing. However, trying to algebraically solve for an inverse function will quickly run into problems (without using specially defined functions). The existence of an inverse does not imply there will always be luck in trying to find a mathematical rule defining the inverse.</p>
<h2>Functions which are not always invertible</h2>
<p>Consider the function <span class="math">$f(x) = x^2$</span>. The graph–a parabola–is clearly not <em>monotonic</em>. Hence no inverse function exists. Yet, we can solve equations <span class="math">$y=x^2$</span> quite easily: <span class="math">$y=\sqrt{x}$</span> <em>or</em> <span class="math">$y=-\sqrt{x}$</span>. We know the square root undoes the squaring, but we need to be a little more careful to say the square root is the inverse of the squaring function.</p>
<p>The issue is there are generally <em>two</em> possible answers. To avoid this, we might choose to only take the <em>non-negative</em> answer. To make this all work as above, we restrict the domain of <span class="math">$f(x)$</span> and now consider the related function <span class="math">$f(x)=x^2, x \geq 0$</span>. This is now a monotonic function, so will have an inverse function. This is clearly <span class="math">$f^{-1}(x) = \sqrt{x}$</span>.</p>
<p>The <a href="https://en.wikipedia.org/wiki/Inverse_function_theorem">inverse function theorem</a> basically says that if <span class="math">$f$</span> is <em>locally</em> monotonic, then an inverse function will exist <em>locally</em>. By "local" we mean in a neighborhood of <span class="math">$c$</span>.</p>
<h5>Example</h5>
<p>Consider the function <span class="math">$f(x) = (1+x^2)^{-1}$</span>. This bell-shaped function is even (symmetric about <span class="math">$0$</span>), so can not possibly be one-to-one. However, if the domain is restricted to <span class="math">$[0,\infty)$</span> it is. The restricted function is strictly decreasing and its inverse is found as follows:</p>
<p class="math">\[
~
\begin{align*}
y &= \frac{1}{1 + x^2}\\
1+x^2 &= \frac{1}{y}\\
x^2 &= \frac{1}{y} - 1\\
x &= \sqrt{(1-y)/y}, \quad 0 \leq y \leq 1.
\end{align*}
~
\]</p>
<p>Then <span class="math">$f^{-1}(x) = \sqrt{(1-x)/x}$</span> where <span class="math">$0 < x \leq 1$</span>. The somewhat complicated restriction for the the domain coincides with the range of <span class="math">$f(x)$</span>. We shall see next that this is no coincidence.</p>
<h2>Formal properties of the inverse function</h2>
<p>Consider again the graph of a monotonic function, in this case <span class="math">$f(x) = x^2 + 2, x \geq 0$</span>:</p>
<pre class='hljl'>
<span class='hljl-nf'>f</span><span class='hljl-p'>(</span><span class='hljl-n'>x</span><span class='hljl-p'>)</span><span class='hljl-t'> </span><span class='hljl-oB'>=</span><span class='hljl-t'> </span><span class='hljl-n'>x</span><span class='hljl-oB'>^</span><span class='hljl-ni'>2</span><span class='hljl-t'> </span><span class='hljl-oB'>+</span><span class='hljl-t'> </span><span class='hljl-ni'>2</span><span class='hljl-t'>
</span><span class='hljl-nf'>plot</span><span class='hljl-p'>(</span><span class='hljl-n'>f</span><span class='hljl-p'>,</span><span class='hljl-t'> </span><span class='hljl-ni'>0</span><span class='hljl-p'>,</span><span class='hljl-t'> </span><span class='hljl-ni'>4</span><span class='hljl-p'>)</span><span class='hljl-t'>
</span><span class='hljl-nf'>plot!</span><span class='hljl-p'>([</span><span class='hljl-ni'>2</span><span class='hljl-p'>,</span><span class='hljl-ni'>2</span><span class='hljl-p'>,</span><span class='hljl-ni'>0</span><span class='hljl-p'>],</span><span class='hljl-t'> </span><span class='hljl-p'>[</span><span class='hljl-ni'>0</span><span class='hljl-p'>,</span><span class='hljl-nf'>f</span><span class='hljl-p'>(</span><span class='hljl-ni'>2</span><span class='hljl-p'>),</span><span class='hljl-nf'>f</span><span class='hljl-p'>(</span><span class='hljl-ni'>2</span><span class='hljl-p'>)])</span>
</pre>
<div id="7ea2c446-8641-40df-a4fd-286536a962c1" style="width:576px;height:384px;"></div>
<script>
PLOT = document.getElementById('7ea2c446-8641-40df-a4fd-286536a962c1');
Plotly.plot(PLOT, [
{
"xaxis": "x1",
"colorbar": {
"title": ""
},
"yaxis": "y1",
"text": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"x": [
0.039063276079152526,
0.40025966867349133,
0.6173236452224955,
0.800848474863063,
1.0002078801322056,
1.1839996181385126,
1.3810437856259592,
1.6093387773541292,
1.8122204244440858,
1.99012934616088,
2.184097826621278,
2.3792191150112485,
2.594950650497617,
2.8002137629793737,
3.013639774045402,
3.1932990146673808,
3.4126425839454564,
3.618832008514834,
3.9491634560642397
],
"showlegend": true,
"mode": "lines",
"name": "y1",
"zmin": -0.1,
"legendgroup": "y1",
"zmax": 0.1,
"line": {
"color": "rgba(0, 154, 250, 1.000)",
"shape": "linear",
"dash": "solid",
"width": 1
},
"y": [
2.0015259395380363,
2.160207802366613,
2.3810884829507897,
2.641358279690494,
3.0004158034785604,
3.4018550957521434,
3.90728193781608,
4.589971300295684,
5.284142866772303,
5.960614814450732,
6.77028331625179,
7.660683597234908,
8.733768878518006,
9.841197118379103,
11.08202468770842,
12.197158597075665,
13.646129405757922,
15.095945105851508,
17.59589200271325
],
"type": "scatter",
"hoverinfo": "text"
},
{
"xaxis": "x1",
"colorbar": {
"title": ""
},
"yaxis": "y1",
"text": [
null,
null,
null
],
"x": [
2,
2,
0
],
"showlegend": true,
"mode": "lines",
"name": "y2",
"zmin": -0.1,
"legendgroup": "y2",
"zmax": 0.1,
"line": {
"color": "rgba(227, 111, 71, 1.000)",
"shape": "linear",
"dash": "solid",
"width": 1
},
"y": [
0,
6,
6
],
"type": "scatter",
"hoverinfo": "text"
}
]
, {
"showlegend": true,
"xaxis": {
"showticklabels": true,
"gridwidth": 0.5,
"tickvals": [
0.0,
1.0,
2.0,
3.0,
4.0
],
"visible": true,
"ticks": "inside",
"range": [
-0.11847490368192719,
4.067638359746167
],
"domain": [
0.03769928064547487,
0.9931649168853894
],
"tickmode": "array",
"linecolor": "rgba(0, 0, 0, 1.000)",
"showgrid": true,
"title": "",
"mirror": false,
"tickangle": 0,
"showline": true,
"gridcolor": "rgba(0, 0, 0, 0.100)",
"titlefont": {
"color": "rgba(0, 0, 0, 1.000)",
"family": "sans-serif",
"size": 15
},
"tickcolor": "rgb(0, 0, 0)",
"ticktext": [
"0",
"1",
"2",
"3",
"4"
],
"zeroline": false,
"type": "-",
"tickfont": {
"color": "rgba(0, 0, 0, 1.000)",
"family": "sans-serif",
"size": 11
},
"zerolinecolor": "rgba(0, 0, 0, 1.000)",
"anchor": "y1"
},
"paper_bgcolor": "rgba(255, 255, 255, 1.000)",
"annotations": [],
"height": 384,
"margin": {
"l": 0,
"b": 20,
"r": 0,
"t": 20
},
"plot_bgcolor": "rgba(255, 255, 255, 1.000)",
"yaxis": {
"showticklabels": true,
"gridwidth": 0.5,
"tickvals": [
0.0,
5.0,
10.0,
15.0
],
"visible": true,
"ticks": "inside",
"range": [
-0.5278767600813975,
18.123768762794647
],
"domain": [
0.0391878098571012,
0.989747375328084
],
"tickmode": "array",
"linecolor": "rgba(0, 0, 0, 1.000)",
"showgrid": true,
"title": "",
"mirror": false,
"tickangle": 0,
"showline": true,
"gridcolor": "rgba(0, 0, 0, 0.100)",
"titlefont": {
"color": "rgba(0, 0, 0, 1.000)",
"family": "sans-serif",
"size": 15
},
"tickcolor": "rgb(0, 0, 0)",
"ticktext": [
"0",
"5",
"10",
"15"
],
"zeroline": false,
"type": "-",
"tickfont": {
"color": "rgba(0, 0, 0, 1.000)",
"family": "sans-serif",
"size": 11
},
"zerolinecolor": "rgba(0, 0, 0, 1.000)",
"anchor": "x1"
},
"legend": {
"tracegroupgap": 0,
"bordercolor": "rgba(0, 0, 0, 1.000)",
"bgcolor": "rgba(255, 255, 255, 1.000)",
"font": {
"color": "rgba(0, 0, 0, 1.000)",
"family": "sans-serif",
"size": 11
},
"y": 1.0,
"x": 1.0
},
"width": 576
}
);
</script>
<p>The graph is shown over the interval <span class="math">$(0,4)$</span>, but the <em>domain</em> of <span class="math">$f(x)$</span> is all <span class="math">$x \geq 0$</span>. The <em>range</em> of <span class="math">$f(x)$</span> is clearly <span class="math">$2 \leq x \leq \infty$</span>.</p>
<p>The lines layered on the plot show how to associate an <span class="math">$x$</span> value to a <span class="math">$y$</span> value or vice versa (as <span class="math">$f(x)$</span> is one-to-one). The domain then of the inverse function is all the <span class="math">$y$</span> values for which an corresponding <span class="math">$x$</span> value exists: this is clearly all values bigger or equal to <span class="math">$2$</span>. The <em>range</em> of the inverse function can be seen to be all the images for the values of <span class="math">$y$</span>, which would be all <span class="math">$x \geq 0$</span>. This gives the relationship:</p>
<blockquote>
<p>the <em>range</em> of <span class="math">$f(x)$</span> is the <em>domain</em> of <span class="math">$f^{-1}(x)$</span> and furthermore the <em>domain</em> of <span class="math">$f(x)$</span> is the <em>range</em> for <span class="math">$f^{-1}(x)$</span>;</p>
</blockquote>
<p>Further, from this we can see if we start at <span class="math">$x$</span>, apply <span class="math">$f$</span> we get <span class="math">$y$</span>, if we then apply <span class="math">$f^{-1}$</span> we will get back to <span class="math">$x$</span> so we have:</p>
<blockquote>
<p>For all <span class="math">$x$</span> in the domain of <span class="math">$f$</span>: <span class="math">$f^{-1}(f(x)) = x$</span>.</p>
</blockquote>
<p>Similarly, were we to start on the <span class="math">$y$</span> axis, we would see:</p>
<blockquote>
<p>For all <span class="math">$x$</span> in the domain of <span class="math">$f^{-1}$</span>: <span class="math">$f(f^{-1}(x)) = x$</span>.</p>
</blockquote>
<p>In short <span class="math">$f^{-1} \circ f$</span> and <span class="math">$f \circ f^{-1}$</span> are both identity functions, though on possibly different domains.</p>
<h2>The graph of the inverse function</h2>
<p>The graph of <span class="math">$f(x)$</span> is a representation of all values <span class="math">$(x,y)$</span> where <span class="math">$y=f(x)$</span>. As the inverse flips around the role of <span class="math">$x$</span> and <span class="math">$y$</span> we have:</p>
<blockquote>
<p>If <span class="math">$(x,y)$</span> is a point on the graph of <span class="math">$f(x)$</span>, then <span class="math">$(y,x)$</span> will be a point on the graph of <span class="math">$f^{-1}(x)$</span>.</p>
</blockquote>
<p>Let's see this in action. Take the function <span class="math">$2^x$</span>. We can plot it by generating points to plot as follows:</p>
<pre class='hljl'>
<span class='hljl-nf'>f</span><span class='hljl-p'>(</span><span class='hljl-n'>x</span><span class='hljl-p'>)</span><span class='hljl-t'> </span><span class='hljl-oB'>=</span><span class='hljl-t'> </span><span class='hljl-ni'>2</span><span class='hljl-oB'>^</span><span class='hljl-n'>x</span><span class='hljl-t'>
</span><span class='hljl-n'>xs</span><span class='hljl-t'> </span><span class='hljl-oB'>=</span><span class='hljl-t'> </span><span class='hljl-nf'>range</span><span class='hljl-p'>(</span><span class='hljl-ni'>0</span><span class='hljl-p'>,</span><span class='hljl-t'> </span><span class='hljl-ni'>2</span><span class='hljl-p'>,</span><span class='hljl-t'> </span><span class='hljl-n'>length</span><span class='hljl-oB'>=</span><span class='hljl-ni'>50</span><span class='hljl-p'>)</span><span class='hljl-t'>
</span><span class='hljl-n'>ys</span><span class='hljl-t'> </span><span class='hljl-oB'>=</span><span class='hljl-t'> </span><span class='hljl-n'>f</span><span class='hljl-oB'>.</span><span class='hljl-p'>(</span><span class='hljl-n'>xs</span><span class='hljl-p'>)</span><span class='hljl-t'>
</span><span class='hljl-nf'>plot</span><span class='hljl-p'>(</span><span class='hljl-n'>xs</span><span class='hljl-p'>,</span><span class='hljl-t'> </span><span class='hljl-n'>ys</span><span class='hljl-p'>,</span><span class='hljl-t'> </span><span class='hljl-n'>color</span><span class='hljl-oB'>=:</span><span class='hljl-n'>blue</span><span class='hljl-p'>)</span><span class='hljl-t'>
</span><span class='hljl-nf'>plot!</span><span class='hljl-p'>(</span><span class='hljl-n'>ys</span><span class='hljl-p'>,</span><span class='hljl-t'> </span><span class='hljl-n'>xs</span><span class='hljl-p'>,</span><span class='hljl-t'> </span><span class='hljl-n'>color</span><span class='hljl-oB'>=:</span><span class='hljl-n'>red</span><span class='hljl-p'>)</span><span class='hljl-t'> </span><span class='hljl-cs'># the inverse</span>
</pre>
<div id="52ba9388-0e11-48f1-8dfe-044a29a63fc1" style="width:576px;height:384px;"></div>
<script>
PLOT = document.getElementById('52ba9388-0e11-48f1-8dfe-044a29a63fc1');
Plotly.plot(PLOT, [
{
"xaxis": "x1",
"colorbar": {
"title": ""
},
"yaxis": "y1",
"text": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"x": [
0.0,
0.04081632653061224,
0.08163265306122448,
0.12244897959183673,
0.16326530612244897,
0.20408163265306123,
0.24489795918367346,
0.2857142857142857,
0.32653061224489793,
0.3673469387755102,
0.40816326530612246,
0.4489795918367347,
0.4897959183673469,
0.5306122448979592,
0.5714285714285714,
0.6122448979591837,
0.6530612244897959,
0.6938775510204082,
0.7346938775510204,
0.7755102040816326,
0.8163265306122449,
0.8571428571428571,
0.8979591836734694,
0.9387755102040817,
0.9795918367346939,
1.0204081632653061,
1.0612244897959184,
1.1020408163265305,
1.1428571428571428,
1.183673469387755,
1.2244897959183674,
1.2653061224489797,
1.3061224489795917,
1.346938775510204,
1.3877551020408163,
1.4285714285714286,
1.469387755102041,
1.510204081632653,
1.5510204081632653,
1.5918367346938775,
1.6326530612244898,
1.6734693877551021,
1.7142857142857142,
1.7551020408163265,
1.7959183673469388,
1.836734693877551,
1.8775510204081634,
1.9183673469387754,
1.9591836734693877,
2.0
],
"showlegend": true,
"mode": "lines",
"name": "y1",
"zmin": -0.1,
"legendgroup": "y1",
"zmax": 0.1,
"line": {
"color": "rgba(0, 0, 255, 1.000)",
"shape": "linear",
"dash": "solid",
"width": 1
},
"y": [
1.0,
1.0286957334762774,
1.0582149120722961,
1.088581165149745,
1.1198188001321776,
1.1519528219624953,
1.1850089531187766,
1.2190136542044754,
1.25399414512947,
1.2899784268989174,
1.3269953040273563,
1.365074407595997,
1.404246218971659,
1.4445420942063398,
1.4859942891369484,
1.5286359852052924,
1.5725013160189902,
1.6176253946745665,
1.6640443418646058,
1.7117953147914597,
1.7609165369106559,
1.8114473285278132,
1.863428138273562,
1.916900575481656,
1.9719074434962,
2.0284927739346545,
2.086701861934038,
2.1465813024085487,
2.2081790273476245,
2.2715443441842975,
2.336727975264555,
2.4037820984493083,
2.472760388881456,
2.5437180619514943,
2.616711917496047,
2.6918003852647123,
2.769043571691609,
2.8485033080090703,
2.930243199741993,
3.0143286776224634,
3.1008270499654174,
3.1898075565472563,
3.2813414240305514,
3.3755019229792005,
3.4723644265096736,
3.572006470625302,
3.6745078162819036,
3.7799505132344264,
3.8884189657157195,
4.0
],
"type": "scatter",
"hoverinfo": "text"
},
{
"xaxis": "x1",
"colorbar": {
"title": ""
},
"yaxis": "y1",
"text": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,