# Cuboid: Volume, Surface Area, Diagonals and Fitting Things In Source: https://nunada.my.id/articles/cuboid/ Updated: 2026-11-01 ## Quick answer **A cuboid, or rectangular box, has six rectangular faces in three equal pairs, twelve edges in three groups of four, and eight corners; with length $l$, width $w$ and height $h$ its volume is $lwh$, its surface area is $2(lw+lh+wh)$ and its space diagonal is $\sqrt{l^2+w^2+h^2}$.** A cube is the special case with three equal edges, and it holds the most volume for a given surface area. A rod fits inside a box exactly when it is no longer than the space diagonal. ### Key takeaways - A cuboid has $6$ faces, $12$ edges and $8$ corners, like the cube, but its edges come in three lengths: $4$ of length $l$, $4$ of width $w$ and $4$ of height $h$. Opposite faces are equal, and every cube is a cuboid but not the other way round. - Volume $V=lwh$, the base area times the height. Surface area $S=2(lw+lh+wh)$, three pairs of faces. Lateral area, the four walls without top and bottom, $2h(l+w)$. - The face diagonals are $\sqrt{l^2+w^2}$, $\sqrt{l^2+h^2}$ and $\sqrt{w^2+h^2}$, and the space diagonal is $d=\sqrt{l^2+w^2+h^2}$. It makes angles with the edges whose cosines are $\frac ld$, $\frac wd$, $\frac hd$, and the squares of those three cosines add up to $1$. - For a given surface area the cube holds the most: $V\le\left(\frac S6\right)^{3/2}$, with equality only when $l=w=h$. For a given volume the cube has the least surface, $S\ge6V^{2/3}$. Both follow from the inequality of arithmetic and geometric means. - A straight rod fits inside a box exactly when its length is at most $d$. Small boxes laid all the same way fit $\left\lfloor\frac{L}{a}\right\rfloor\left\lfloor\frac{W}{b}\right\rfloor\left\lfloor\frac{H}{c}\right\rfloor$ times, and the best of the six ways to turn them is the count. - Some boxes have a whole-number space diagonal, such as $2\times3\times6$ with $d=7$ (a Pythagorean quadruple). Some have all three face diagonals whole, the smallest being $44\times117\times240$ (an Euler brick). A box with all four whole, a perfect cuboid, is not known to exist. ## What is a cuboid, and how is it different from a cube? **A cuboid, also called a rectangular box or a rectangular prism, is a solid bounded by six rectangles that meet at right angles; its opposite faces are equal and parallel.** Every corner is a right-angled corner, with three faces and three edges meeting there. The $12$ edges come in three groups of four equal parallel edges, called the length $l$, the width $w$ and the height $h$, and the whole solid is fixed by those three numbers. | Part | How many | What they are | |---|---|---| | faces (sisi) | $6$ | three pairs of equal rectangles: $l\times w$, $l\times h$, $w\times h$ | | edges (rusuk) | $12$ | $4$ of length $l$, $4$ of length $w$, $4$ of length $h$ | | vertices (titik sudut) | $8$ | the corners, where three edges meet | The count obeys Euler’s formula, $V-E+F=8-12+6=2$, exactly as for the cube. The difference between the two is only in the edges: **a cube is a cuboid whose three edges are equal**, so every cube is a cuboid, and a cuboid is a cube only when $l=w=h$. In Indonesian the box is balok and the cube kubus, and schools write its edges as panjang $p$, lebar $l$ and tinggi $t$. Place a corner at the origin and the opposite corner is $(l,w,h)$: the eight corners are all the points whose coordinates are $0$ or the full edge, which is why the [cube](https://nunada.my.id/articles/cube/#what-is-a-cube) and the box share their counts. A brick, a book, a shoe box, a room and a shipping container are all cuboids. ## How do you find the volume, the surface area and the lateral area of a cuboid? **The volume of a cuboid is $V=l\times w\times h$, the surface area is $S=2(lw+lh+wh)$, and the lateral area is $2h(l+w)$.** The volume counts unit cubes: a floor of $l\times w$ of them, piled $h$ layers high, so $V$ is the base area times the height. For a box $5\times3\times2$: $V=30$, and $S=2(15+10+6)=62$. The surface formula comes from the net, the six rectangles laid flat. They come in three equal pairs, $lw$, $lh$ and $wh$, so the surface is twice their sum; for $4\times3\times2$ the pairs are $12$, $8$ and $6$, and $2(12+8+6)=52$. The lateral area leaves out the top and the bottom and keeps the four walls: they make one long rectangle as wide as the perimeter of the base, $2(l+w)$, and $h$ high, so the area is $2h(l+w)$. For a box $5\times3\times2$ that is $2\cdot2\cdot8=32$, and the surface is the walls plus top and bottom: $32+2\cdot15=62$. Everyday uses. To paint the walls of a room $6$ m long, $4$ m wide and $3$ m high you need the lateral area $2\cdot3\cdot(6+4)=60$ m² (minus doors and windows); with the ceiling and the floor the whole surface is $108$ m². An aquarium $80$ cm by $35$ cm by $40$ cm holds $80\cdot35\cdot40=112\,000$ cm³ $=112$ litres, since $1000$ cm³ is one litre. Scaling: multiplying every edge by $k$ multiplies the surface by $k^2$ and the volume by $k^3$; multiplying only one edge by $k$ multiplies the volume by $k$. Slide the three edges below to see every measure at once. *The net of a box $4\times3\times2$ is six rectangles in three equal pairs: two of $4\times3$ (area $12$), two of $4\times2$ (area $8$) and two of $3\times2$ (area $6$). They add up to $2(12+8+6)=52$, which is $2(lw+lh+wh)$.* ## What are the diagonals of a cuboid, and what angles do they make? **A cuboid has face diagonals of three lengths, $\sqrt{l^2+w^2}$, $\sqrt{l^2+h^2}$ and $\sqrt{w^2+h^2}$, and four space diagonals, all of the length $d=\sqrt{l^2+w^2+h^2}$.** The face diagonal is the hypotenuse in the face; the space diagonal is the hypotenuse of a second right triangle on a face diagonal and an edge, so $d^2=(l^2+w^2)+h^2$ (this is [the Pythagorean theorem in space](https://nunada.my.id/articles/pythagorean-theorem/#distance-and-diagonals)). For the box $6\times3\times2$ the three face diagonals are $\sqrt{45}\approx6.71$, $\sqrt{40}\approx6.32$ and $\sqrt{13}\approx3.61$, and the space diagonal is $\sqrt{36+9+4}=7$ exactly. The angles with the edges. The diagonal runs from $(0,0,0)$ to $(l,w,h)$, so its projection on the edge along $l$ is $l$ and $\cos\alpha=\frac ld$; likewise $\cos\beta=\frac wd$ and $\cos\gamma=\frac hd$. For $6\times3\times2$ the cosines are $\frac67,\frac37,\frac27$ and the angles $31.0^\circ$, $64.6^\circ$ and $73.4^\circ$. Their squares add up to $\frac{36+9+4}{49}=1$ for every box: $\cos^2\alpha+\cos^2\beta+\cos^2\gamma=1$. In a cube all three angles are $\arccos\frac1{\sqrt3}\approx54.74^\circ$. Two space diagonals. The diagonals $(l,w,h)$ and $(-l,w,h)$ have dot product $-l^2+w^2+h^2$, so they cross at the acute angle with cosine $\frac{|{-l^2}+w^2+h^2|}{d^2}$; the other two kinds of pair give $\frac{|l^2-w^2+h^2|}{d^2}$ and $\frac{|l^2+w^2-h^2|}{d^2}$. For $6\times3\times2$ these are $\frac{23}{49},\frac{31}{49},\frac{41}{49}$, that is $62.0^\circ$, $50.8^\circ$ and $33.2^\circ$. In a cube every pair gives $\frac13$, the $70.53^\circ$ of the [cube](https://nunada.my.id/articles/cube/#diagonals). *Turn the box $6\times3\times2$. The diagonal of the base is $f=\sqrt{6^2+3^2}=\sqrt{45}$, and the space diagonal is the hypotenuse over $f$ and the height: $d=\sqrt{45+4}=\sqrt{49}=7$. A rod of length $7$ just fits corner to corner.* ## Which boxes have whole-number diagonals: Pythagorean quadruples, Euler bricks and the perfect cuboid? **A box with whole-number edges has a whole-number space diagonal when $a^2+b^2+c^2=d^2$, a Pythagorean quadruple, such as $2\times3\times6$ with $d=7$ or $3\times4\times12$ with $d=13$.** Most boxes do not: the box $5\times3\times2$ has $d=\sqrt{38}$. The quadruples with $d\le15$ that cannot be shrunk to a smaller one are: | $a$ | $b$ | $c$ | $d$ | Check | |---|---|---|---|---| | $1$ | $2$ | $2$ | $3$ | $1+4+4=9$ | | $2$ | $3$ | $6$ | $7$ | $4+9+36=49$ | | $1$ | $4$ | $8$ | $9$ | $1+16+64=81$ | | $4$ | $4$ | $7$ | $9$ | $16+16+49=81$ | | $2$ | $6$ | $9$ | $11$ | $4+36+81=121$ | | $6$ | $6$ | $7$ | $11$ | $36+36+49=121$ | | $3$ | $4$ | $12$ | $13$ | $9+16+144=169$ | | $2$ | $5$ | $14$ | $15$ | $4+25+196=225$ | | $2$ | $10$ | $11$ | $15$ | $4+100+121=225$ | Multiplying a quadruple by a whole number gives another, such as $2\times4\times4$ with $d=6$. There is a formula that makes them from any four whole numbers $m,n,p,q$: take $a=m^2+n^2-p^2-q^2$, $b=2(mq+np)$, $c=2(nq-mp)$ and $d=m^2+n^2+p^2+q^2$, and $a^2+b^2+c^2=d^2$. With $(m,n,p,q)=(2,1,1,1)$ it gives $(3,6,-2)$ and $d=7$, the box $2\times3\times6$. A harder wish is that the three face diagonals should be whole numbers. Such a box is an **Euler brick**, and the smallest is $44\times117\times240$, whose face diagonals are $\sqrt{44^2+117^2}=125$, $\sqrt{44^2+240^2}=244$ and $\sqrt{117^2+240^2}=267$. Its space diagonal, though, is $\sqrt{73\,225}\approx270.6$, not whole. A **perfect cuboid** would have all three face diagonals and the space diagonal whole. Nobody has found one, nobody has proved that none exists, and computer searches through very large boxes have found none: a search through all edges up to $1500$ finds eight Euler bricks and no perfect cuboid. Type edges in the widget to see which diagonals are whole. ## Which cuboid has the largest volume for a given surface area? **For a given surface area $S$ the cube holds the most: every cuboid satisfies $V\le\left(\frac S6\right)^{3/2}$, with equality only when $l=w=h$.** The reason is the inequality of arithmetic and geometric means: for three positive numbers the geometric mean is at most the arithmetic mean. Apply it to the three face areas $lw$, $lh$ and $wh$. Their product is $(lw)(lh)(wh)=(lwh)^2=V^2$ and their sum is $\frac S2$, so $$V^{2/3}=\sqrt[3]{(lw)(lh)(wh)}\le\frac{lw+lh+wh}{3}=\frac S6,$$ and $V\le\left(\frac S6\right)^{3/2}$, with equality only if $lw=lh=wh$, which means $l=w=h$. For $S=96$ the bound is $16^{3/2}=64$, reached by the cube of edge $4$. Other boxes with the same surface: | Box | $S$ | $V$ | |---|---|---| | $4\times4\times4$ | $96$ | $64$ | | $6\times4\times2.4$ | $96$ | $57.6$ | | $10\times2\times2\frac13$ | $96$ | $46\frac23$ | | $8\times4\times1\frac13$ | $96$ | $42\frac23$ | | $12\times3\times0.8$ | $96$ | $28.8$ | The same fact the other way round: for a given volume the cube has the smallest surface, $S\ge6V^{2/3}$. For $V=64$ that is $96$ for the cube, against $112$ for $8\times4\times2$, $136$ for $16\times2\times2$ and $160$ for $8\times8\times1$. And for a wire frame, where the twelve edges together are fixed, $4(l+w+h)=48$ gives $l+w+h=12$ and $V\le\left(\frac{12}{3}\right)^3=64$: again the cube. The same box problems with calculus, an open-top box cut from a sheet, are in [applied optimization](https://nunada.my.id/articles/applied-optimization/#geometry). Move the base of a box below and watch how far it falls short of the cube. ## How do you know whether a rod, a plank or a pile of smaller boxes fits inside a box? **A thin straight rod fits inside a box exactly when its length is at most the space diagonal $d=\sqrt{l^2+w^2+h^2}$, the longest straight segment the box contains; it just fits, corner to corner, when it is equal to $d$.** A $1$ m pole against a box $60\times40\times40$ cm: $d=\sqrt{3600+1600+1600}=\sqrt{6800}\approx82.5$ cm, so it does not fit, however it is tilted. In a box $80\times50\times40$ cm, $d=\sqrt{10\,500}\approx102.5$ cm, so it does, leaning from a bottom corner towards the opposite top corner. A rod longer than every face diagonal must lie across the inside, never along a face. A flat sheet is different: a rectangle fits in a box if it fits through some cross-section of it, and the largest is the diagonal rectangle through two opposite edges, $l\times\sqrt{w^2+h^2}$, of area $l\sqrt{w^2+h^2}$; for the box $6\times3\times2$ that is $6\times\sqrt{13}$. Smaller boxes. To know how many boxes $a\times b\times c$ fit in a big box $L\times W\times H$ when they are all laid the same way, count how many fit along each side: $\left\lfloor\frac{L}{a}\right\rfloor\cdot\left\lfloor\frac{W}{b}\right\rfloor\cdot\left\lfloor\frac{H}{c}\right\rfloor$, and try the six ways to turn the small box, taking the best. Bricks $3\times2\times1$ in a box $10\times6\times4$ fit $5\cdot2\cdot4=40$ times, using each of the $240$ units of volume ($40\cdot6=240$); cartons $30\times20\times10$ cm fill a space $120\times80\times60$ cm with $4\cdot4\cdot6=96$ cartons. The volume bound is always an upper limit: $\frac{V_{\text{big}}}{V_{\text{small}}}$, and when the edges do not divide evenly, the leftover space is wasted. Turning some of the boxes the other way can sometimes fit more than any single arrangement, which is why packing is a hard problem. ## How do you work with a cuboid in a program? **A program computes the measures of a box from three numbers, and finds whole-number diagonals by searching: loop over $a\le b\le c$, take the integer square root of $a^2+b^2+c^2$, and keep the boxes for which squaring it gives the sum back.** Use whole numbers and an exact integer square root (`isqrt` in Python), not a floating-point `sqrt` rounded and compared, because a rounded square root of a large integer can be off by one. The programs below print the measures of $5\times3\times2$, the quadruples with $d\le9$, whether $44\times117\times240$ and $2\times3\times6$ are Euler bricks, and whether the first has a whole space diagonal. ```python from math import isqrt, sqrt def box(l, w, h): return { 'volume': l * w * h, 'surface': 2 * (l * w + l * h + w * h), 'lateral': 2 * h * (l + w), 'space diagonal': round(sqrt(l * l + w * w + h * h), 3), } def is_square(n): return isqrt(n) ** 2 == n def quadruples(max_d): """The boxes a <= b <= c whose space diagonal d <= max_d is a whole number: a² + b² + c² = d².""" found = [] for a in range(1, max_d): for b in range(a, max_d): for c in range(b, max_d): s = a * a + b * b + c * c if s <= max_d ** 2 and is_square(s): found.append((a, b, c, isqrt(s))) return sorted(found, key=lambda q: (q[3], q[:3])) def euler_brick(a, b, c): """All three face diagonals are whole numbers.""" return all(is_square(x * x + y * y) for x, y in ((a, b), (a, c), (b, c))) print(box(5, 3, 2)) # {'volume': 30, 'surface': 62, 'lateral': 32, 'space diagonal': 6.164} print(quadruples(9)) # [(1, 2, 2, 3), (2, 4, 4, 6), (2, 3, 6, 7), (1, 4, 8, 9), (3, 6, 6, 9), (4, 4, 7, 9)] print(euler_brick(44, 117, 240), euler_brick(2, 3, 6)) # True False print(is_square(44 ** 2 + 117 ** 2 + 240 ** 2)) # False: no perfect cuboid here ``` ```javascript const box = (l, w, h) => ({ volume: l * w * h, surface: 2 * (l * w + l * h + w * h), lateral: 2 * h * (l + w), spaceDiagonal: +Math.sqrt(l * l + w * w + h * h).toFixed(3) }) const isSquare = (n) => Number.isInteger(Math.sqrt(n)) // the boxes a <= b <= c whose space diagonal d <= maxD is a whole number: a² + b² + c² = d² function quadruples(maxD) { const found = [] for (let a = 1; a < maxD; a++) for (let b = a; b < maxD; b++) for (let c = b; c < maxD; c++) { const s = a * a + b * b + c * c if (s <= maxD * maxD && isSquare(s)) found.push([a, b, c, Math.sqrt(s)]) } return found.sort((p, q) => p[3] - q[3] || p[0] - q[0] || p[1] - q[1]) } // all three face diagonals are whole numbers const eulerBrick = (a, b, c) => [[a, b], [a, c], [b, c]].every(([x, y]) => isSquare(x * x + y * y)) box(5, 3, 2) // { volume: 30, surface: 62, lateral: 32, spaceDiagonal: 6.164 } quadruples(9) // [[1,2,2,3], [2,4,4,6], [2,3,6,7], [1,4,8,9], [3,6,6,9], [4,4,7,9]] ;[eulerBrick(44, 117, 240), eulerBrick(2, 3, 6)] // [true, false] isSquare(44 ** 2 + 117 ** 2 + 240 ** 2) // false ``` ```cpp #include #include #include using namespace std; // 1 when n is a perfect square int isSquare(int n) { int r = (int)(sqrt((double)n) + 0.5); return r * r == n ? 1 : 0; } // 1 when all three face diagonals are whole numbers int eulerBrick(int a, int b, int c) { return isSquare(a * a + b * b) && isSquare(a * a + c * c) && isSquare(b * b + c * c) ? 1 : 0; } int main() { int l = 5; int w = 3; int h = 2; printf("volume %d; surface %d; lateral %d\n", l * w * h, 2 * (l * w + l * h + w * h), 2 * h * (l + w)); printf("space diagonal %.3f\n", sqrt((double)(l * l + w * w + h * h))); // a <= b <= c with a * a + b * b + c * c = d * d, d up to 9 for (int d = 2; d <= 9; d++) { for (int a = 1; a < d; a++) { for (int b = a; b < d; b++) { for (int c = b; c < d; c++) { if (a * a + b * b + c * c == d * d) printf("%d %d %d %d\n", a, b, c, d); } } } } printf("%d %d\n", eulerBrick(44, 117, 240), eulerBrick(2, 3, 6)); printf("%d\n", isSquare(44 * 44 + 117 * 117 + 240 * 240)); return 0; } /* output: volume 30; surface 62; lateral 32 space diagonal 6.164 1 2 2 3 2 4 4 6 2 3 6 7 1 4 8 9 3 6 6 9 4 4 7 9 1 0 0 */ ``` ## Where does the study of boxes and their diagonals come from? **People have measured boxes for as long as there has been building, storing and trading, and the questions about their diagonals turned into number theory.** - **About 300 BCE.** Euclid’s Elements, Book XI, studies solids bounded by parallelograms and proves that two such solids of the same height are in the ratio of their bases (XI.32): the root of volume equals base times height. - **1719.** Paul Halcke finds the box $44\times117\times240$ whose three face diagonals are whole numbers, the smallest of the bricks that bear Euler’s name; Euler later studied them and found families of others. - **The 18th and 19th centuries.** The Pythagorean quadruples, the boxes with a whole space diagonal, are described and their formulas found, including the one that makes them from four whole numbers. - **The perfect cuboid.** Whether a box can have all three face diagonals and the space diagonal whole at once is still open: not one is known, and searches by computer through very large boxes have found none. - **Today.** The same formulas run inside every shipping calculator, 3D engine and storage layout: the bounding box of a shape in a game is a cuboid, and its diagonal is the quickest measure of its size. ## What are the common mistakes with the cuboid? **The most common mistakes with the cuboid are the nine below, each with the correct statement.** | Mistake | Correct | |---|---| | ❌ Surface area $=lwh$ | That is the volume. The surface is $2(lw+lh+wh)$. | | ❌ Surface area $=lw+lh+wh$ | Each kind of face appears twice: $2(lw+lh+wh)$. | | ❌ Lateral area includes the top and the bottom | The lateral area is the four walls only: $2h(l+w)$. | | ❌ The space diagonal is $\sqrt{l^2+w^2}$ or $l+w+h$ | $\sqrt{l^2+w^2}$ is a face diagonal; the space diagonal is $\sqrt{l^2+w^2+h^2}$. | | ❌ Edges in cm, volume in litres, no conversion | $1000$ cm³ is one litre: convert units before multiplying. | | ❌ Doubling every edge doubles the volume | The volume is $8$ times as large, the surface $4$ times. | | ❌ A rod longer than every face diagonal cannot fit | It fits if it is at most the space diagonal, leaning across the box. | | ❌ A cube and a box of the same volume have the same surface | The cube has the least: for $V=64$, $96$ against $112$ for $8\times4\times2$. | | ❌ Whole-number edges give a whole-number diagonal | $5\times3\times2$ has $d=\sqrt{38}$; only quadruples like $(2,3,6,7)$ do. | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: the cuboid at a glance - **Parts:** $6$ faces in three equal pairs, $12$ edges in three groups of four, $8$ corners; a cube is the cuboid with $l=w=h$. - **Measures:** $V=lwh$, $S=2(lw+lh+wh)$, lateral area $2h(l+w)$, edges together $4(l+w+h)$; scaling by $k$ gives $k^2$ and $k^3$. - **Diagonals:** faces $\sqrt{l^2+w^2}$, $\sqrt{l^2+h^2}$, $\sqrt{w^2+h^2}$; space $d=\sqrt{l^2+w^2+h^2}$; $\cos\alpha=\frac ld$ and the three squared cosines add to $1$. - **Whole diagonals:** quadruples $a^2+b^2+c^2=d^2$ such as $(2,3,6,7)$; Euler bricks such as $44\times117\times240$; no perfect cuboid known. - **Extremes:** for a given surface $V\le\left(\frac S6\right)^{3/2}$, for a given volume $S\ge6V^{2/3}$, equality only for the cube (AM–GM). - **Fitting:** a rod fits if it is at most $d$; small boxes laid alike fit $\lfloor L/a\rfloor\lfloor W/b\rfloor\lfloor H/c\rfloor$, best of six turns. ## Glossary: key terms - **Cuboid**: A solid with six rectangular faces meeting at right angles, in three pairs of equal faces; the box. - **Length, width, height**: The three edge lengths of a cuboid, written l, w and h, which fix the whole box. - **Volume**: The space inside the box: length times width times height, in cubic units. - **Surface area**: The total area of the six faces: twice the sum of l w, l h and w h. - **Lateral area**: The area of the four walls without the top and the bottom: 2 h times l plus w. - **Space diagonal**: The segment between opposite corners through the inside; its length is the square root of l squared plus w squared plus h squared. - **Pythagorean quadruple**: Four whole numbers a, b, c, d with a squared plus b squared plus c squared equal to d squared: a box with a whole space diagonal. - **Euler brick**: A box whose edges and three face diagonals are all whole numbers, such as 44 by 117 by 240. - **Perfect cuboid**: A box whose edges, face diagonals and space diagonal are all whole numbers; none is known. - **AM–GM inequality**: The geometric mean of positive numbers is at most their arithmetic mean, with equality only when they are all equal. ## Frequently asked questions ### What is a cuboid? A cuboid, or rectangular box, is a solid with six rectangular faces meeting at right angles, twelve edges and eight corners. Opposite faces are equal, and the three edge lengths, length, width and height, determine the whole box. ### How do you find the volume of a cuboid? Multiply the length, the width and the height: V equals l times w times h, in cubic units. It is the base area times the height. A box 8 by 5 by 3 has volume 120. ### What is the formula for the surface area of a cuboid? The surface area is 2 times the sum of l w, l h and w h, since the six faces make three equal pairs. A box 4 by 3 by 2 has faces of 12, 8 and 6 in pairs, so its surface is 52. ### How do you find the lateral surface area of a cuboid? Add the four walls and leave out the top and bottom: 2 times h times l plus w. It is the perimeter of the base times the height. For a room 6 m by 4 m and 3 m high it is 60 square metres. ### What is the difference between a cube and a cuboid? A cube has six identical square faces and three equal edges. A cuboid has rectangular faces and edges of up to three different lengths. Every cube is a cuboid, but a cuboid is a cube only when length, width and height are equal. ### Which cuboid has the largest volume for a given surface area? The cube. For surface area S every box has volume at most S over 6 to the power three halves, by the AM–GM inequality, with equality only when length, width and height are equal. For S equal to 96 the cube of edge 4 has volume 64. ### What is an Euler brick? An Euler brick is a box whose three edges and three face diagonals are all whole numbers. The smallest is 44 by 117 by 240, with face diagonals 125, 244 and 267. Whether one also has a whole space diagonal, a perfect cuboid, is unknown. ### How do you know whether a rod fits inside a box? Compute the space diagonal, the square root of l squared plus w squared plus h squared, and compare. The rod fits if it is not longer than that, tilted from one corner towards the opposite one. A 1 m pole does not fit in a box 60 by 40 by 40 cm, whose diagonal is 82.5 cm. --- # Balok: Volume, Luas Permukaan, Diagonal, dan Cara Memuat Benda Source: https://nunada.my.id/artikel/balok/ Updated: 2026-11-01 ## Jawaban singkat **Balok memiliki enam sisi persegi panjang dalam tiga pasang yang sama, dua belas rusuk dalam tiga kelompok empat, dan delapan titik sudut; dengan panjang $p$, lebar $l$, dan tinggi $t$ volumenya $plt$, luas permukaannya $2(pl+pt+lt)$, dan diagonal ruangnya $\sqrt{p^2+l^2+t^2}$.** Kubus adalah kasus khusus dengan tiga rusuk sama, dan ia memuat volume terbanyak untuk luas permukaan tertentu. Sebuah batang muat di dalam balok tepat bila ia tidak lebih panjang daripada diagonal ruang. ### Poin penting - Balok memiliki $6$ sisi, $12$ rusuk, dan $8$ titik sudut, seperti kubus, tetapi rusuknya ada dalam tiga panjang: $4$ sepanjang $p$, $4$ selebar $l$, dan $4$ setinggi $t$. Sisi yang berhadapan sama, dan setiap kubus adalah balok tetapi tidak sebaliknya. - Volume $V=plt$, luas alas kali tinggi. Luas permukaan $L=2(pl+pt+lt)$, tiga pasang sisi. Luas selimut, keempat dinding tanpa atap dan lantai, $2t(p+l)$. - Diagonal sisinya $\sqrt{p^2+l^2}$, $\sqrt{p^2+t^2}$, dan $\sqrt{l^2+t^2}$, dan diagonal ruangnya $d=\sqrt{p^2+l^2+t^2}$. Ia membentuk sudut dengan rusuk yang kosinusnya $\frac pd$, $\frac ld$, $\frac td$, dan kuadrat ketiga kosinus itu berjumlah $1$. - Untuk luas permukaan tertentu kubus memuat paling banyak: $V\le\left(\frac S6\right)^{3/2}$, dengan kesamaan hanya bila $p=l=t$. Untuk volume tertentu kubus memiliki luas permukaan paling kecil, $L\ge6V^{2/3}$. Keduanya mengikuti ketaksamaan rata-rata aritmetika dan geometri. - Sebuah batang lurus muat di dalam balok tepat bila panjangnya paling besar $d$. Balok-balok kecil yang diletakkan semuanya dengan cara yang sama muat sebanyak $\left\lfloor\frac{P}{a}\right\rfloor\left\lfloor\frac{L}{b}\right\rfloor\left\lfloor\frac{T}{c}\right\rfloor$, dan yang terbaik dari enam cara memutarnya adalah banyaknya. - Beberapa balok memiliki diagonal ruang bilangan bulat, seperti $2\times3\times6$ dengan $d=7$ (kuadrupel Pythagoras). Beberapa memiliki ketiga diagonal sisi bulat, yang terkecil $44\times117\times240$ (bata Euler). Balok dengan keempatnya bulat, balok sempurna, belum diketahui ada. ## Apa itu balok, dan apa bedanya dengan kubus? **Balok, disebut juga prisma persegi panjang, adalah bangun ruang yang dibatasi enam persegi panjang yang bertemu pada sudut siku-siku; sisi-sisi yang berhadapan sama dan sejajar.** Setiap titik sudut adalah sudut siku-siku, dengan tiga sisi dan tiga rusuk bertemu di sana. Kedua belas rusuknya terbagi dalam tiga kelompok yang masing-masing empat rusuk sejajar sama panjang, disebut panjang $p$, lebar $l$, dan tinggi $t$, dan seluruh bangun itu ditentukan oleh tiga bilangan tersebut. | Bagian | Banyaknya | Apa mereka | |---|---|---| | sisi (face) | $6$ | tiga pasang persegi panjang yang sama: $p\times l$, $p\times t$, $l\times t$ | | rusuk (edge) | $12$ | $4$ sepanjang $p$, $4$ sepanjang $l$, $4$ sepanjang $t$ | | titik sudut (vertex) | $8$ | sudut-sudutnya, tempat tiga rusuk bertemu | Banyaknya itu memenuhi rumus Euler, $V-E+F=8-12+6=2$, tepat seperti pada kubus. Perbedaan keduanya hanya pada rusuknya: **kubus adalah balok yang ketiga rusuknya sama**, jadi setiap kubus adalah balok, dan balok adalah kubus hanya bila $p=l=t$. Letakkan satu titik sudut di titik asal dan titik sudut yang berhadapan adalah $(p,l,t)$: kedelapan titik sudutnya adalah semua titik yang koordinatnya $0$ atau rusuk penuh, itulah sebabnya [kubus](https://nunada.my.id/artikel/kubus/#what-is-a-cube) dan balok berbagi banyaknya. Batu bata, buku, kotak sepatu, ruangan, dan peti kemas semuanya balok. ## Bagaimana mencari volume, luas permukaan, dan luas selimut balok? **Volume balok adalah $V=p\times l\times t$, luas permukaannya $L=2(pl+pt+lt)$, dan luas selimutnya $2t(p+l)$.** Volume menghitung kubus satuan: lantai $p\times l$ kubus, ditumpuk $t$ lapis, jadi $V$ adalah luas alas kali tinggi. Untuk balok $5\times3\times2$: $V=30$, dan $L=2(15+10+6)=62$. Rumus luas permukaan berasal dari jaring-jaring, keenam persegi panjang yang dibentangkan. Mereka ada dalam tiga pasang yang sama, $pl$, $pt$, dan $lt$, jadi luas permukaannya dua kali jumlahnya; untuk $4\times3\times2$ pasangannya $12$, $8$, dan $6$, dan $2(12+8+6)=52$. Luas selimut meniadakan atas dan bawah dan menyisakan keempat dinding: mereka membentuk satu persegi panjang panjang selebar keliling alas, $2(p+l)$, dan setinggi $t$, sehingga luasnya $2t(p+l)$. Untuk balok $5\times3\times2$ itu $2\cdot2\cdot8=32$, dan luas permukaannya adalah dinding ditambah atas dan bawah: $32+2\cdot15=62$. Pemakaian sehari-hari. Untuk mengecat dinding ruangan sepanjang $6$ m, selebar $4$ m, dan setinggi $3$ m kamu memerlukan luas selimut $2\cdot3\cdot(6+4)=60$ m² (dikurangi pintu dan jendela); dengan langit-langit dan lantai seluruh permukaannya $108$ m². Akuarium $80$ cm kali $35$ cm kali $40$ cm memuat $80\cdot35\cdot40=112.000$ cm³ $=112$ liter, karena $1000$ cm³ adalah satu liter. Perubahan skala: mengalikan setiap rusuk dengan $k$ mengalikan luas permukaan dengan $k^2$ dan volume dengan $k^3$; mengalikan hanya satu rusuk dengan $k$ mengalikan volume dengan $k$. Geser ketiga rusuk di bawah untuk melihat semua ukuran sekaligus. *Jaring-jaring balok $4\times3\times2$ adalah enam persegi panjang dalam tiga pasang yang sama: dua $4\times3$ (luas $12$), dua $4\times2$ (luas $8$), dan dua $3\times2$ (luas $6$). Jumlahnya $2(12+8+6)=52$, yaitu $2(lw+lh+wh)$.* ## Apa saja diagonal balok, dan sudut apa yang dibentuknya? **Balok memiliki diagonal sisi dalam tiga panjang, $\sqrt{p^2+l^2}$, $\sqrt{p^2+t^2}$, dan $\sqrt{l^2+t^2}$, dan empat diagonal ruang, semuanya sepanjang $d=\sqrt{p^2+l^2+t^2}$.** Diagonal sisi adalah sisi miring dalam sisi itu; diagonal ruang adalah sisi miring segitiga siku-siku kedua pada sebuah diagonal sisi dan sebuah rusuk, sehingga $d^2=(p^2+l^2)+t^2$ (ini [teorema Pythagoras dalam ruang](https://nunada.my.id/artikel/teorema-pythagoras/#distance-and-diagonals)). Untuk balok $6\times3\times2$ ketiga diagonal sisinya $\sqrt{45}\approx6{,}71$, $\sqrt{40}\approx6{,}32$, dan $\sqrt{13}\approx3{,}61$, dan diagonal ruangnya $\sqrt{36+9+4}=7$ tepat. Sudut dengan rusuk. Diagonal berjalan dari $(0,0,0)$ ke $(p,l,t)$, sehingga proyeksinya pada rusuk sepanjang $p$ adalah $p$ dan $\cos\alpha=\frac pd$; demikian pula $\cos\beta=\frac ld$ dan $\cos\gamma=\frac td$. Untuk $6\times3\times2$ kosinusnya $\frac67,\frac37,\frac27$ dan sudutnya $31{,}0^\circ$, $64{,}6^\circ$, dan $73{,}4^\circ$. Kuadratnya berjumlah $\frac{36+9+4}{49}=1$ untuk setiap balok: $\cos^2\alpha+\cos^2\beta+\cos^2\gamma=1$. Pada kubus ketiga sudutnya $\arccos\frac1{\sqrt3}\approx54{,}74^\circ$. Dua diagonal ruang. Diagonal $(p,l,t)$ dan $(-p,l,t)$ memiliki hasil kali titik $-p^2+l^2+t^2$, sehingga keduanya berpotongan pada sudut lancip dengan kosinus $\frac{|{-p^2}+l^2+t^2|}{d^2}$; dua jenis pasangan lainnya memberi $\frac{|p^2-l^2+t^2|}{d^2}$ dan $\frac{|p^2+l^2-t^2|}{d^2}$. Untuk $6\times3\times2$ nilainya $\frac{23}{49},\frac{31}{49},\frac{41}{49}$, yaitu $62{,}0^\circ$, $50{,}8^\circ$, dan $33{,}2^\circ$. Pada kubus setiap pasangan memberi $\frac13$, yaitu $70{,}53^\circ$ pada [kubus](https://nunada.my.id/artikel/kubus/#diagonals). *Putar balok $6\times3\times2$. Diagonal alasnya $f=\sqrt{6^2+3^2}=\sqrt{45}$, dan diagonal ruang adalah sisi miring di atas $f$ dan tingginya: $d=\sqrt{45+4}=\sqrt{49}=7$. Batang sepanjang $7$ tepat muat dari sudut ke sudut.* ## Balok mana yang diagonalnya bilangan bulat: kuadrupel Pythagoras, bata Euler, dan balok sempurna? **Balok dengan rusuk bilangan bulat memiliki diagonal ruang bilangan bulat bila $a^2+b^2+c^2=d^2$, sebuah kuadrupel Pythagoras, seperti $2\times3\times6$ dengan $d=7$ atau $3\times4\times12$ dengan $d=13$.** Kebanyakan balok tidak: balok $5\times3\times2$ memiliki $d=\sqrt{38}$. Kuadrupel dengan $d\le15$ yang tak dapat diperkecil menjadi yang lebih kecil adalah: | $a$ | $b$ | $c$ | $d$ | Pemeriksaan | |---|---|---|---|---| | $1$ | $2$ | $2$ | $3$ | $1+4+4=9$ | | $2$ | $3$ | $6$ | $7$ | $4+9+36=49$ | | $1$ | $4$ | $8$ | $9$ | $1+16+64=81$ | | $4$ | $4$ | $7$ | $9$ | $16+16+49=81$ | | $2$ | $6$ | $9$ | $11$ | $4+36+81=121$ | | $6$ | $6$ | $7$ | $11$ | $36+36+49=121$ | | $3$ | $4$ | $12$ | $13$ | $9+16+144=169$ | | $2$ | $5$ | $14$ | $15$ | $4+25+196=225$ | | $2$ | $10$ | $11$ | $15$ | $4+100+121=225$ | Mengalikan sebuah kuadrupel dengan bilangan bulat memberi yang lain, seperti $2\times4\times4$ dengan $d=6$. Ada rumus yang membuatnya dari empat bilangan bulat mana pun $m,n,p,q$: ambil $a=m^2+n^2-p^2-q^2$, $b=2(mq+np)$, $c=2(nq-mp)$, dan $d=m^2+n^2+p^2+q^2$, maka $a^2+b^2+c^2=d^2$. Dengan $(m,n,p,q)=(2,1,1,1)$ ia memberi $(3,6,-2)$ dan $d=7$, balok $2\times3\times6$. Keinginan yang lebih sulit adalah agar ketiga diagonal sisi bilangan bulat. Balok seperti itu adalah **bata Euler**, dan yang terkecil $44\times117\times240$, yang diagonal sisinya $\sqrt{44^2+117^2}=125$, $\sqrt{44^2+240^2}=244$, dan $\sqrt{117^2+240^2}=267$. Diagonal ruangnya, meski begitu, $\sqrt{73.225}\approx270{,}6$, tidak bulat. **Balok sempurna** akan memiliki ketiga diagonal sisi dan diagonal ruang bulat. Belum ada yang menemukannya, belum ada yang membuktikan bahwa ia tak ada, dan pencarian komputer pada balok yang sangat besar tidak menemukan satu pun: pencarian pada semua rusuk sampai $1500$ menemukan delapan bata Euler dan tak ada balok sempurna. Ketik rusuk di widget untuk melihat diagonal mana yang bulat. ## Balok mana yang volumenya terbesar untuk luas permukaan tertentu? **Untuk luas permukaan $L$ tertentu kubus memuat paling banyak: setiap balok memenuhi $V\le\left(\frac L6\right)^{3/2}$, dengan kesamaan hanya bila $p=l=t$.** Alasannya adalah ketaksamaan rata-rata aritmetika dan geometri: untuk tiga bilangan positif rata-rata geometri paling besar sama dengan rata-rata aritmetika. Terapkan pada ketiga luas sisi $pl$, $pt$, dan $lt$. Hasil kalinya $(pl)(pt)(lt)=(plt)^2=V^2$ dan jumlahnya $\frac L2$, sehingga $$V^{2/3}=\sqrt[3]{(pl)(pt)(lt)}\le\frac{pl+pt+lt}{3}=\frac L6,$$ dan $V\le\left(\frac L6\right)^{3/2}$, dengan kesamaan hanya bila $pl=pt=lt$, yang berarti $p=l=t$. Untuk $L=96$ batasnya $16^{3/2}=64$, dicapai kubus berusuk $4$. Balok lain dengan luas permukaan yang sama: | Balok | $L$ | $V$ | |---|---|---| | $4\times4\times4$ | $96$ | $64$ | | $6\times4\times2{,}4$ | $96$ | $57{,}6$ | | $10\times2\times2\frac13$ | $96$ | $46\frac23$ | | $8\times4\times1\frac13$ | $96$ | $42\frac23$ | | $12\times3\times0{,}8$ | $96$ | $28{,}8$ | Fakta yang sama dari arah sebaliknya: untuk volume tertentu kubus memiliki luas permukaan terkecil, $L\ge6V^{2/3}$. Untuk $V=64$ itu $96$ untuk kubus, dibanding $112$ untuk $8\times4\times2$, $136$ untuk $16\times2\times2$, dan $160$ untuk $8\times8\times1$. Dan untuk kerangka kawat, tempat kedua belas rusuk bersama-sama tetap, $4(p+l+t)=48$ memberi $p+l+t=12$ dan $V\le\left(\frac{12}{3}\right)^3=64$: lagi-lagi kubus. Soal balok yang sama dengan kalkulus, kotak tanpa tutup dari selembar bahan, ada di [optimisasi terapan](https://nunada.my.id/artikel/optimisasi-terapan/#geometry). Geser alas sebuah balok di bawah dan lihat seberapa jauh ia kalah dari kubus. ## Bagaimana mengetahui apakah batang, papan, atau tumpukan balok yang lebih kecil muat di dalam balok? **Batang lurus yang tipis muat di dalam balok tepat bila panjangnya paling besar sama dengan diagonal ruang $d=\sqrt{p^2+l^2+t^2}$, ruas lurus terpanjang yang termuat dalam balok; ia tepat muat, dari sudut ke sudut, bila sama dengan $d$.** Tiang $1$ m pada kotak $60\times40\times40$ cm: $d=\sqrt{3600+1600+1600}=\sqrt{6800}\approx82{,}5$ cm, sehingga ia tidak muat, semiring apa pun. Pada kotak $80\times50\times40$ cm, $d=\sqrt{10.500}\approx102{,}5$ cm, sehingga ia muat, bersandar dari sudut bawah ke sudut atas yang berhadapan. Batang yang lebih panjang daripada setiap diagonal sisi harus terletak melintasi bagian dalam, tak pernah menurut sebuah sisi. Lembaran datar berbeda: sebuah persegi panjang muat dalam balok bila muat melalui suatu irisannya, dan yang terbesar adalah persegi panjang diagonal melalui dua rusuk yang berhadapan, $p\times\sqrt{l^2+t^2}$, dengan luas $p\sqrt{l^2+t^2}$; untuk balok $6\times3\times2$ itu $6\times\sqrt{13}$. Balok yang lebih kecil. Untuk mengetahui berapa balok $a\times b\times c$ yang muat dalam balok besar $P\times L\times T$ bila semuanya diletakkan dengan cara yang sama, hitung berapa yang muat sepanjang tiap sisi: $\left\lfloor\frac{P}{a}\right\rfloor\cdot\left\lfloor\frac{L}{b}\right\rfloor\cdot\left\lfloor\frac{T}{c}\right\rfloor$, dan coba keenam cara memutar balok kecil itu, ambil yang terbaik. Batu bata $3\times2\times1$ dalam kotak $10\times6\times4$ muat $5\cdot2\cdot4=40$, memakai setiap dari $240$ satuan volume ($40\cdot6=240$); karton $30\times20\times10$ cm memenuhi ruang $120\times80\times60$ cm dengan $4\cdot4\cdot6=96$ karton. Batas volume selalu batas atas: $\frac{V_{\text{besar}}}{V_{\text{kecil}}}$, dan bila rusuknya tak habis dibagi, ruang yang tersisa terbuang. Memutar sebagian balok ke arah lain terkadang dapat memuat lebih banyak daripada satu susunan tunggal mana pun, itulah sebabnya pengepakan adalah masalah yang sulit. ## Bagaimana bekerja dengan balok dalam program? **Program menghitung ukuran balok dari tiga bilangan, dan menemukan diagonal bilangan bulat dengan mencari: lakukan perulangan pada $a\le b\le c$, ambil akar kuadrat bilangan bulat dari $a^2+b^2+c^2$, dan simpan balok yang kuadratnya mengembalikan jumlahnya.** Pakai bilangan bulat dan akar kuadrat bilangan bulat yang eksak (`isqrt` di Python), bukan `sqrt` floating-point yang dibulatkan dan dibandingkan, karena akar kuadrat yang dibulatkan dari bilangan bulat besar dapat meleset satu. Program di bawah mencetak ukuran $5\times3\times2$, kuadrupel dengan $d\le9$, apakah $44\times117\times240$ dan $2\times3\times6$ adalah bata Euler, dan apakah yang pertama memiliki diagonal ruang bulat. ```python from math import isqrt, sqrt def box(l, w, h): return { 'volume': l * w * h, 'surface': 2 * (l * w + l * h + w * h), 'lateral': 2 * h * (l + w), 'space diagonal': round(sqrt(l * l + w * w + h * h), 3), } def is_square(n): return isqrt(n) ** 2 == n def quadruples(max_d): """The boxes a <= b <= c whose space diagonal d <= max_d is a whole number: a² + b² + c² = d².""" found = [] for a in range(1, max_d): for b in range(a, max_d): for c in range(b, max_d): s = a * a + b * b + c * c if s <= max_d ** 2 and is_square(s): found.append((a, b, c, isqrt(s))) return sorted(found, key=lambda q: (q[3], q[:3])) def euler_brick(a, b, c): """All three face diagonals are whole numbers.""" return all(is_square(x * x + y * y) for x, y in ((a, b), (a, c), (b, c))) print(box(5, 3, 2)) # {'volume': 30, 'surface': 62, 'lateral': 32, 'space diagonal': 6.164} print(quadruples(9)) # [(1, 2, 2, 3), (2, 4, 4, 6), (2, 3, 6, 7), (1, 4, 8, 9), (3, 6, 6, 9), (4, 4, 7, 9)] print(euler_brick(44, 117, 240), euler_brick(2, 3, 6)) # True False print(is_square(44 ** 2 + 117 ** 2 + 240 ** 2)) # False: no perfect cuboid here ``` ```javascript const box = (l, w, h) => ({ volume: l * w * h, surface: 2 * (l * w + l * h + w * h), lateral: 2 * h * (l + w), spaceDiagonal: +Math.sqrt(l * l + w * w + h * h).toFixed(3) }) const isSquare = (n) => Number.isInteger(Math.sqrt(n)) // the boxes a <= b <= c whose space diagonal d <= maxD is a whole number: a² + b² + c² = d² function quadruples(maxD) { const found = [] for (let a = 1; a < maxD; a++) for (let b = a; b < maxD; b++) for (let c = b; c < maxD; c++) { const s = a * a + b * b + c * c if (s <= maxD * maxD && isSquare(s)) found.push([a, b, c, Math.sqrt(s)]) } return found.sort((p, q) => p[3] - q[3] || p[0] - q[0] || p[1] - q[1]) } // all three face diagonals are whole numbers const eulerBrick = (a, b, c) => [[a, b], [a, c], [b, c]].every(([x, y]) => isSquare(x * x + y * y)) box(5, 3, 2) // { volume: 30, surface: 62, lateral: 32, spaceDiagonal: 6.164 } quadruples(9) // [[1,2,2,3], [2,4,4,6], [2,3,6,7], [1,4,8,9], [3,6,6,9], [4,4,7,9]] ;[eulerBrick(44, 117, 240), eulerBrick(2, 3, 6)] // [true, false] isSquare(44 ** 2 + 117 ** 2 + 240 ** 2) // false ``` ```cpp #include #include #include using namespace std; // 1 when n is a perfect square int isSquare(int n) { int r = (int)(sqrt((double)n) + 0.5); return r * r == n ? 1 : 0; } // 1 when all three face diagonals are whole numbers int eulerBrick(int a, int b, int c) { return isSquare(a * a + b * b) && isSquare(a * a + c * c) && isSquare(b * b + c * c) ? 1 : 0; } int main() { int l = 5; int w = 3; int h = 2; printf("volume %d; surface %d; lateral %d\n", l * w * h, 2 * (l * w + l * h + w * h), 2 * h * (l + w)); printf("space diagonal %.3f\n", sqrt((double)(l * l + w * w + h * h))); // a <= b <= c with a * a + b * b + c * c = d * d, d up to 9 for (int d = 2; d <= 9; d++) { for (int a = 1; a < d; a++) { for (int b = a; b < d; b++) { for (int c = b; c < d; c++) { if (a * a + b * b + c * c == d * d) printf("%d %d %d %d\n", a, b, c, d); } } } } printf("%d %d\n", eulerBrick(44, 117, 240), eulerBrick(2, 3, 6)); printf("%d\n", isSquare(44 * 44 + 117 * 117 + 240 * 240)); return 0; } /* output: volume 30; surface 62; lateral 32 space diagonal 6.164 1 2 2 3 2 4 4 6 2 3 6 7 1 4 8 9 3 6 6 9 4 4 7 9 1 0 0 */ ``` ## Dari mana asal kajian tentang balok dan diagonalnya? **Orang mengukur balok selama ada bangunan, penyimpanan, dan perdagangan, dan pertanyaan tentang diagonalnya berubah menjadi teori bilangan.** - **Sekitar 300 SM.** Elements Euclid, Buku XI, mempelajari bangun ruang yang dibatasi jajar genjang dan membuktikan bahwa dua bangun seperti itu yang sama tingginya berbanding seperti alasnya (XI.32): akar dari volume sama dengan alas kali tinggi. - **1719.** Paul Halcke menemukan balok $44\times117\times240$ yang ketiga diagonal sisinya bilangan bulat, bata terkecil yang memakai nama Euler; Euler kemudian mempelajarinya dan menemukan keluarga yang lain. - **Abad ke-18 dan ke-19.** Kuadrupel Pythagoras, balok dengan diagonal ruang bulat, diuraikan dan rumusnya ditemukan, termasuk yang membuatnya dari empat bilangan bulat. - **Balok sempurna.** Apakah sebuah balok dapat memiliki ketiga diagonal sisi dan diagonal ruang yang bulat sekaligus masih terbuka: belum ada yang diketahui, dan pencarian komputer pada balok yang sangat besar tidak menemukan satu pun. - **Sekarang.** Rumus yang sama berjalan di dalam setiap kalkulator pengiriman, mesin 3D, dan tata letak gudang: kotak pembatas sebuah bentuk dalam game adalah balok, dan diagonalnya ukuran tercepat untuk besarnya. ## Apa kesalahan umum pada balok? **Kesalahan paling umum pada balok adalah sembilan hal berikut, masing-masing dengan pernyataan yang benar.** | Kesalahan | Yang benar | |---|---| | ❌ Luas permukaan $=plt$ | Itu volume. Luas permukaannya $2(pl+pt+lt)$. | | ❌ Luas permukaan $=pl+pt+lt$ | Tiap jenis sisi muncul dua kali: $2(pl+pt+lt)$. | | ❌ Luas selimut memuat atas dan bawah | Luas selimut hanya keempat dinding: $2t(p+l)$. | | ❌ Diagonal ruang adalah $\sqrt{p^2+l^2}$ atau $p+l+t$ | $\sqrt{p^2+l^2}$ adalah diagonal sisi; diagonal ruang adalah $\sqrt{p^2+l^2+t^2}$. | | ❌ Rusuk dalam cm, volume dalam liter, tanpa konversi | $1000$ cm³ adalah satu liter: ubah satuan sebelum mengalikan. | | ❌ Menggandakan setiap rusuk menggandakan volume | Volumenya $8$ kali lipat, luas permukaannya $4$ kali. | | ❌ Batang yang lebih panjang daripada setiap diagonal sisi tak dapat muat | Ia muat bila paling besar sama dengan diagonal ruang, miring melintasi balok. | | ❌ Kubus dan balok dengan volume sama memiliki luas permukaan sama | Kubus memiliki yang terkecil: untuk $V=64$, $96$ dibanding $112$ untuk $8\times4\times2$. | | ❌ Rusuk bilangan bulat memberi diagonal bilangan bulat | $5\times3\times2$ memiliki $d=\sqrt{38}$; hanya kuadrupel seperti $(2,3,6,7)$ yang demikian. | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: balok sekilas - **Bagian:** $6$ sisi dalam tiga pasang yang sama, $12$ rusuk dalam tiga kelompok empat, $8$ titik sudut; kubus adalah balok dengan $p=l=t$. - **Ukuran:** $V=plt$, $L=2(pl+pt+lt)$, luas selimut $2t(p+l)$, semua rusuk $4(p+l+t)$; perubahan skala $k$ memberi $k^2$ dan $k^3$. - **Diagonal:** sisi $\sqrt{p^2+l^2}$, $\sqrt{p^2+t^2}$, $\sqrt{l^2+t^2}$; ruang $d=\sqrt{p^2+l^2+t^2}$; $\cos\alpha=\frac pd$ dan ketiga kosinus kuadrat berjumlah $1$. - **Diagonal bulat:** kuadrupel $a^2+b^2+c^2=d^2$ seperti $(2,3,6,7)$; bata Euler seperti $44\times117\times240$; belum ada balok sempurna. - **Ekstrem:** untuk luas permukaan tertentu $V\le\left(\frac L6\right)^{3/2}$, untuk volume tertentu $L\ge6V^{2/3}$, kesamaan hanya untuk kubus (AM–GM). - **Memuat:** batang muat bila paling besar $d$; balok kecil yang diletakkan sama muat $\lfloor P/a\rfloor\lfloor L/b\rfloor\lfloor T/c\rfloor$, terbaik dari enam putaran. ## Glosarium: istilah penting - **Balok**: Bangun ruang dengan enam sisi persegi panjang yang bertemu pada sudut siku-siku, dalam tiga pasang sisi yang sama; kotak. - **Panjang, lebar, tinggi**: Tiga panjang rusuk balok, ditulis p, l, dan t, yang menentukan seluruh balok. - **Volume**: Ruang di dalam balok: panjang kali lebar kali tinggi, dalam satuan kubik. - **Luas permukaan**: Jumlah luas keenam sisi: dua kali jumlah p l, p t, dan l t. - **Luas selimut**: Luas keempat dinding tanpa atap dan lantai: 2 t kali p ditambah l. - **Diagonal ruang**: Ruas di antara titik sudut berhadapan melalui bagian dalam; panjangnya akar dari p kuadrat ditambah l kuadrat ditambah t kuadrat. - **Kuadrupel Pythagoras**: Empat bilangan bulat a, b, c, d dengan a kuadrat ditambah b kuadrat ditambah c kuadrat sama dengan d kuadrat: balok dengan diagonal ruang bulat. - **Bata Euler**: Balok yang rusuk dan ketiga diagonal sisinya semuanya bilangan bulat, seperti 44 kali 117 kali 240. - **Balok sempurna**: Balok yang rusuk, diagonal sisi, dan diagonal ruangnya semuanya bilangan bulat; belum ada yang diketahui. - **Ketaksamaan AM–GM**: Rata-rata geometri bilangan positif paling besar sama dengan rata-rata aritmetikanya, dengan kesamaan hanya bila semuanya sama. ## Pertanyaan yang sering diajukan ### Apa itu balok? Balok, atau kotak persegi panjang, adalah bangun ruang dengan enam sisi persegi panjang yang bertemu pada sudut siku-siku, dua belas rusuk, dan delapan titik sudut. Sisi yang berhadapan sama, dan ketiga panjang rusuk, panjang, lebar, dan tinggi, menentukan seluruh balok. ### Bagaimana mencari volume balok? Kalikan panjang, lebar, dan tinggi: V sama dengan p kali l kali t, dalam satuan kubik. Itu adalah luas alas kali tinggi. Balok 8 kali 5 kali 3 memiliki volume 120. ### Apa rumus luas permukaan balok? Luas permukaan adalah 2 kali jumlah p l, p t, dan l t, karena keenam sisi membentuk tiga pasang yang sama. Balok 4 kali 3 kali 2 memiliki sisi 12, 8, dan 6 berpasangan, jadi luas permukaannya 52. ### Bagaimana mencari luas selimut balok? Jumlahkan keempat dinding dan abaikan atas dan bawah: 2 kali t kali p ditambah l. Itu adalah keliling alas kali tinggi. Untuk ruangan 6 m kali 4 m dengan tinggi 3 m, luasnya 60 meter persegi. ### Apa beda kubus dan balok? Kubus memiliki enam sisi persegi yang kongruen dan tiga rusuk sama. Balok memiliki sisi persegi panjang dan rusuk dengan sampai tiga panjang berbeda. Setiap kubus adalah balok, tetapi balok adalah kubus hanya bila panjang, lebar, dan tinggi sama. ### Balok mana yang volumenya terbesar untuk luas permukaan tertentu? Kubus. Untuk luas permukaan S setiap balok bervolume paling besar S per 6 pangkat tiga perdua, menurut ketaksamaan AM–GM, dengan kesamaan hanya bila panjang, lebar, dan tinggi sama. Untuk S sama dengan 96 kubus berusuk 4 bervolume 64. ### Apa itu bata Euler? Bata Euler adalah balok yang ketiga rusuk dan ketiga diagonal sisinya semuanya bilangan bulat. Yang terkecil 44 kali 117 kali 240, dengan diagonal sisi 125, 244, dan 267. Apakah ada yang diagonal ruangnya juga bulat, balok sempurna, belum diketahui. ### Bagaimana mengetahui apakah batang muat di dalam kotak? Hitung diagonal ruang, akar dari p kuadrat ditambah l kuadrat ditambah t kuadrat, dan bandingkan. Batang muat bila tidak lebih panjang daripada itu, dimiringkan dari satu sudut ke arah sudut yang berhadapan. Tiang 1 m tidak muat dalam kotak 60 kali 40 kali 40 cm, yang diagonalnya 82,5 cm. --- # Cube: Faces, Nets, Volume, Diagonals and Cross-Sections Source: https://nunada.my.id/articles/cube/ Updated: 2026-11-01 ## Quick answer **A cube is a solid with six identical square faces, twelve equal edges and eight corners; with edge $a$ its surface area is $6a^2$, its volume is $a^3$, and its space diagonal is $a\sqrt3$.** Six squares fold into a cube in exactly 11 ways (its nets). A plane can cut it in a triangle, a square, a pentagon or a regular hexagon, and doubling its volume needs an edge $\sqrt[3]{2}$ times longer, which a compass and straightedge cannot construct. ### Key takeaways - A cube has $6$ faces, $12$ edges and $8$ corners, three squares meeting at every corner, and $8-12+6=2$, Euler’s number for every solid without holes. Its eight corners are the eight triples of $0$s and $1$s, and an edge joins two corners that differ in one coordinate. - Surface area $6a^2$ and volume $a^3$. Multiply every edge by $k$ and the area is multiplied by $k^2$ and the volume by $k^3$: doubling the edge makes the surface $4$ times and the volume $8$ times as large. - Pythagoras twice: a face has diagonal $a\sqrt2$, the cube has space diagonal $a\sqrt3$. Two space diagonals meet at an angle of about $70.53^\circ$, and a space diagonal makes about $35.26^\circ$ with a face. - Of the $35$ ways to join six squares edge to edge, exactly $11$ fold into a cube. A net must have no $2\times2$ block, no row of five, and no two squares landing on the same face; rolling a cube over the squares checks all of it. - A plane cuts a cube in a triangle, a quadrilateral, a pentagon or a hexagon: never more than six sides, since it meets at most six faces. Through the centre, perpendicular to a space diagonal, the cut is a regular hexagon of area $\frac{3\sqrt3}{4}a^2$. - To double the volume you need the edge multiplied by $\sqrt[3]{2}\approx1.2599$. A compass and straightedge cannot draw that length (Wantzel, 1837), but Newton’s method finds it to any number of digits in a few steps. ## What is a cube, and how many faces, edges and corners does it have? **A cube is a solid bounded by six identical squares, with $12$ edges all of the same length $a$ and $8$ corners, and three squares meeting at each corner.** It is the regular hexahedron, and one of the five Platonic solids: the only one whose faces are squares. A cube is the special case of a [cuboid](https://nunada.my.id/articles/cuboid/#what-is-a-cuboid), the box whose three edges may all differ. Opposite faces are parallel, every angle between two edges that meet is a right angle, and the length of the edge fixes everything else. | Part | English | Indonesian | How many | |---|---|---|---| | a square of the surface | face | sisi | $6$ | | where two faces meet | edge | rusuk | $12$ | | where three edges meet | vertex (corner) | titik sudut | $8$ | The counts obey Euler’s formula: $V-E+F=8-12+6=2$, the same for every solid without holes, whether a cube, a pyramid or a soccer ball. Put the cube in coordinates with one corner at the origin and the opposite corner at $(1,1,1)$, and the eight corners are exactly the eight triples of $0$s and $1$s. An edge joins two corners that differ in one coordinate, so each corner has $3$ edges, and $\frac{8\cdot3}{2}=12$. That small fact, that a cube is the three-bit binary numbers drawn in space, is used again in the code below ([binary numbers](https://nunada.my.id/articles/binary-numbers/#what-is-binary) explains bits). ## How many nets does a cube have, and which arrangements of squares fold into a cube? **A net of the cube is an arrangement of six squares joined edge to edge that folds into a cube with every face covered once; there are exactly 11 different nets.** Turned and flipped copies count as the same net. Shapes made of six squares are called hexominoes, and there are $35$ of them; only $11$ are nets. They come in four families, named by the number of squares in each row: $1\text{-}4\text{-}1$ (a row of four with one square above and one below, in $6$ ways), $2\text{-}3\text{-}1$ ($3$ ways), $2\text{-}2\text{-}2$ (a staircase, $1$ way) and $3\text{-}3$ ($1$ way). Why are the other $24$ not nets? $12$ are ruled out at once: $8$ contain a $2\times2$ block, which cannot lie flat on a cube (going once round a corner brings you back on a different face), and $4$ have a row of five or six. The remaining $12$ fail by overlap: two squares would land on the same face, leaving one face bare. A straight row shows how: folded round the cube, the squares four apart land on the same face. A way to test any arrangement is to roll a cube over it: put the cube on the first square, roll it from square to square, and note which face touches each one; it is a net exactly when the six squares meet six different faces. On a net, squares with exactly one square between them in a row are opposite faces. So if you number the squares like a die, opposite faces adding to $7$, the pairs fall in place. Build your own below, or load the 11 nets and the three common wrong answers. *The cross is one of the 11 nets. Numbered as on a die, the squares that end up opposite are $6$ and $1$ (the top and bottom of the cross), $4$ and $3$, and $5$ and $2$: in a row, the squares with exactly one between them are opposite, and each pair adds up to $7$.* *A row of six is not a net. Folding the row round the cube, square $5$ comes back to the face that square $1$ started on, and square $6$ to the face of square $2$: two faces covered twice and two not at all. In a straight row, squares four apart always land on the same face.* ## How do you find the surface area and the volume of a cube? **The surface area of a cube with edge $a$ is $6a^2$, six squares of area $a^2$, and its volume is $a^3$, the number of unit cubes in a stack $a$ long, $a$ wide and $a$ high.** For $a=3$ cm: one face is $9$ cm², the surface is $6\cdot9=54$ cm², and the volume is $3^3=27$ cm³, since $3$ layers of $3\times3$ unit cubes make $27$. A cube is also a box with all three sides equal, so $V=a\cdot a\cdot a$ is length times width times height. Scaling. If every edge is multiplied by $k$, a length is multiplied by $k$, an area by $k^2$ and a volume by $k^3$. Doubling the edge ($k=2$) multiplies the surface by $4$ and the volume by $8$; tripling it ($k=3$) gives $9$ and $27$. A cube of edge $2$ has volume $8$ and surface $24$, while the unit cube has $1$ and $6$. This is why a large animal needs thick legs: its weight grows with the cube of its size and the strength of a leg with only the square. Units. Volume uses cubic units, and one cubic decimetre is exactly one litre, so a cube-shaped water tank with an edge of $40$ cm $=4$ dm holds $4^3=64$ litres. A cube of edge $1$ m is $1000$ dm³: $1000$ litres. Going backwards. Given the volume, take the cube root: a cube of volume $216$ cm³ has edge $\sqrt[3]{216}=6$ cm. Slide the edge below and read every measure, including what doubling does. ## How do you find the space diagonal of a cube, and what angles do the diagonals make? **The diagonal of a face of a cube with edge $a$ is $a\sqrt2$ and the space diagonal, joining opposite corners through the inside, is $a\sqrt3$: the [Pythagorean theorem](https://nunada.my.id/articles/pythagorean-theorem/#distance-and-diagonals) used twice.** A face is a square, so its diagonal is the hypotenuse of a right triangle with both legs $a$: $f^2=a^2+a^2=2a^2$. The space diagonal $d$ is the hypotenuse of a second right triangle whose legs are that face diagonal $f$ and the edge $a$ standing up from its end: $d^2=f^2+a^2=3a^2$. So $d=a\sqrt3\approx1.732a$; for $a=5$ it is $5\sqrt3\approx8.66$. The longest straight rod that fits inside a cube-shaped room of edge $4$ m is $4\sqrt3\approx6.93$ m, along the space diagonal. A cube has $4$ space diagonals, all of the same length, and they all pass through the centre, where each is cut in half. Take the corners of the unit cube: the diagonals have directions $(1,1,1)$, $(-1,1,1)$, $(1,-1,1)$ and $(1,1,-1)$. Two of them meet at an angle with $\cos\theta=\frac{|(1,1,1)\cdot(-1,1,1)|}{3}=\frac13$, so $\theta=\arccos\frac13\approx70.53^\circ$. A space diagonal and the face it starts from make the angle $\arctan\frac{1}{\sqrt2}\approx35.26^\circ$, since the diagonal rises $a$ over a horizontal run $a\sqrt2$. From any corner, the other seven corners are at three distances: $3$ at $a$ (along the edges), $3$ at $a\sqrt2$ (across the faces), and $1$ at $a\sqrt3$ (the opposite corner). Those counts $3,3,1$ are the coefficients of $(1+x)^3$. *Turn the cube. The diagonal of a face, $f=AC$, is the hypotenuse of a right triangle with both legs $a$, so $f=a\sqrt2$. The diagonal of the cube, $d=AG$, is the hypotenuse of a right triangle with legs $f$ and $a$, so $d^2=2a^2+a^2=3a^2$ and $d=a\sqrt3$.* ## What shapes do you get when a plane cuts a cube? **A plane cuts a cube in a triangle, a quadrilateral, a pentagon or a hexagon, never in a polygon with more than six sides, because each side of the cut lies in one face and a cube has only six.** The cut can also be a square, a rectangle, a rhombus, a trapezoid or a parallelogram, and the special positions give the nicest shapes: - a plane parallel to a face cuts a **square** of area $a^2$; - a plane parallel to an edge, such as $x+y=t$, cuts a **rectangle** that is $a$ high and $t\sqrt2$ wide (a square when $t=\frac{a}{\sqrt2}$), and through two opposite edges ($x+y=a$) it is the rectangle $a\times a\sqrt2$ of area $a^2\sqrt2$; - a plane that cuts off a corner, such as $x+y+z=t$ for $t\le a$, cuts an **equilateral triangle**, and the corner it removes is a small pyramid of volume $\frac{t^3}{6}$ (for $t=a$ a sixth of the cube, with the triangle of side $a\sqrt2$ and area $\frac{\sqrt3}{2}a^2$); - the same plane moved to the middle, $x+y+z=\frac{3a}{2}$, perpendicular to a space diagonal and through the centre, cuts a **regular hexagon**. Its corners are the midpoints of six edges, its side is $\frac{a\sqrt2}{2}$, and its area is $6\cdot\frac{\sqrt3}{4}\cdot\left(\frac{a\sqrt2}{2}\right)^2=\frac{3\sqrt3}{4}a^2\approx1.299a^2$. A plane such as $x+2y+3z=t$ shows the whole sequence as it moves: a triangle, then a four-sided cut, then a pentagon, then (through the centre) a parallelogram, and back down the other way. Move the plane in the widget: the shape on the right is the cut laid flat, with its true side lengths. Not every polygon appears: no seven-sided cut exists, and a regular hexagon appears only when the plane passes through the centre perpendicular to a space diagonal. *The plane $x+y+z=3$ through the centre of a cube of edge $2$, perpendicular to a space diagonal, cuts the six edges at their midpoints. The cut is a regular hexagon of side $\sqrt2$, and its area is $\frac{3\sqrt3}{4}a^2\approx1.299a^2$ for edge $a$.* ## How large is the sphere inside a cube, and the sphere around it? **The largest sphere inside a cube touches the six faces, has radius $\frac a2$, and fills $\frac\pi6\approx52.4\%$ of the cube; the sphere through all eight corners has radius $\frac{a\sqrt3}{2}$ and a volume of $\frac{\pi\sqrt3}{2}a^3\approx2.72a^3$.** The inner sphere has diameter $a$, the edge, so its volume is $\frac43\pi\left(\frac a2\right)^3=\frac\pi6a^3$ against the cube’s $a^3$. The outer sphere has the space diagonal $a\sqrt3$ for a diameter, so its radius is $\frac{a\sqrt3}{2}$ and its volume is $\frac43\pi\left(\frac{a\sqrt3}{2}\right)^3=\frac{\pi\sqrt3}{2}a^3$, a little over $2.7$ cubes. A third sphere, with radius $\frac{a}{\sqrt2}$, just touches the twelve edges, between the two. So the three radii are in the ratio $\frac12:\frac{1}{\sqrt2}:\frac{\sqrt3}{2}$, about $0.5:0.707:0.866$ times the edge. ## What are cube numbers, and what is the cube of a sum? **A cube number is $n^3$, the volume of a cube with whole-number edge $n$: $1,8,27,64,125,\ldots$, and the cube of a sum $(a+b)^3$ breaks a cube of edge $a+b$ into eight pieces.** Cut such a cube by planes at distance $a$ from the corners: the pieces are one cube $a^3$, three slabs $a^2b$, three rods $ab^2$ and one small cube $b^3$, so $$(a+b)^3=a^3+3a^2b+3ab^2+b^3.$$ For $a=2$ and $b=1$: $27=8+12+6+1$. The coefficients $1,3,3,1$ count the pieces, and they come back as the row of Pascal’s triangle (see [expanding brackets](https://nunada.my.id/articles/algebraic-expressions/#expand)). Two more facts about cube numbers. The sum of the first $n$ cubes is a perfect square, the square of the sum of the first $n$ numbers (Nicomachus’s theorem): $1^3+2^3+\cdots+n^3=\left(\frac{n(n+1)}{2}\right)^2$, so for $n=10$ it is $55^2=3025$. And to find a cube root that is not a whole number, such as the edge of a cube of volume $30$, use Newton’s iteration $x_{k+1}=\frac{2x_k+v/x_k^2}{3}$ (see [Newton’s method](https://nunada.my.id/articles/newtons-method/#idea)): for $\sqrt[3]{30}$ start at $3$ and it settles at $3.1072$ within a few steps. ## Why can you not double the cube with a compass and a ruler? **To double the volume of a cube you must multiply its edge by $\sqrt[3]{2}\approx1.259921$, and a compass and straightedge cannot construct that length from a unit length; this was proved by Pierre Wantzel in 1837.** The volume doubles when $k^3=2$, so $k=\sqrt[3]{2}$. A compass and straightedge can only produce lengths that come from whole numbers by adding, subtracting, multiplying, dividing and taking square roots, and each such step at most doubles the degree of the equation the number satisfies, so the degree is always a power of $2$. But $\sqrt[3]{2}$ is a root of $x^3-2=0$, an equation of degree $3$ that cannot be broken into smaller ones, and $3$ is not a power of $2$. So the length cannot be constructed, however clever the drawing. The legend says the people of Delos were told by an oracle to double the altar of Apollo, a cube, to stop a plague; the problem is called the Delian problem. Greek geometers solved it with other tools (curves, a marked ruler), and a number can be found as accurately as you wish by arithmetic: Newton’s iteration from $1$ gives $1$, $\frac43=1.3333$, $\frac{91}{72}=1.2639$, $1.259933$, $1.2599210500$: after four steps the cube of the answer is $2$ to nine digits. ## How do you work with a cube in a program? **A program treats a cube as the numbers $0$ to $7$ read as three bits: the bits are the coordinates of a corner, an edge joins two numbers that differ in one bit, and the distances between corners are counted by the bits that differ.** For $0/1$ coordinates the number of differing bits is exactly the squared distance, so from a corner there are $3$ corners at squared distance $1$, $3$ at $2$ and $1$ at $3$. Walking along edges through all eight corners is the Gray code $i\oplus(i\gg1)$, where consecutive numbers differ in one bit: $0,1,3,2,6,7,5,4$. The programs below print, for a cube of edge $3$, the surface area and volume and the two diagonals, then the counts $8$ corners, $12$ edges and $V-E+F=2$, the distance counts, and the walk. ```python from collections import Counter from itertools import product from math import sqrt def measures(a): return { 'surface': 6 * a * a, 'volume': a ** 3, 'face diagonal': round(a * sqrt(2), 3), 'space diagonal': round(a * sqrt(3), 3), } corners = list(product((0, 1), repeat=3)) # the eight corners: every triple of 0s and 1s differ = lambda p, q: sum(x != y for x, y in zip(p, q)) # for 0/1 coordinates this is also the squared distance edges = [(p, q) for i, p in enumerate(corners) for q in corners[i + 1:] if differ(p, q) == 1] print(measures(3)) # {'surface': 54, 'volume': 27, 'face diagonal': 4.243, 'space diagonal': 5.196} print(len(corners), len(edges), len(corners) - len(edges) + 6) # 8 12 2 print(sorted(Counter(differ(corners[0], q) for q in corners[1:]).items())) # [(1, 3), (2, 3), (3, 1)] print([i ^ (i >> 1) for i in range(8)]) # [0, 1, 3, 2, 6, 7, 5, 4]: a walk along edges through all corners ``` ```javascript const measures = (a) => ({ surface: 6 * a * a, volume: a ** 3, faceDiagonal: +(a * Math.sqrt(2)).toFixed(3), spaceDiagonal: +(a * Math.sqrt(3)).toFixed(3) }) const corners = Array.from({ length: 8 }, (_, i) => i) // the bits of i are x, y and z const differ = (p, q) => [0, 1, 2].filter((b) => ((p >> b) & 1) !== ((q >> b) & 1)).length const edges = corners.flatMap((p) => corners.filter((q) => q > p && differ(p, q) === 1).map((q) => [p, q])) measures(3) // { surface: 54, volume: 27, faceDiagonal: 4.243, spaceDiagonal: 5.196 } ;[corners.length, edges.length, corners.length - edges.length + 6] // [8, 12, 2] const at = {} for (const q of corners.slice(1)) at[differ(0, q)] = (at[differ(0, q)] ?? 0) + 1 at // { '1': 3, '2': 3, '3': 1 } corners.map((i) => i ^ (i >> 1)) // [0, 1, 3, 2, 6, 7, 5, 4] ``` ```cpp #include #include #include using namespace std; // how many bits differ: for corners numbered 0 to 7 this is the squared distance int differ(int p, int q) { int d = 0; for (int bit = 0; bit < 3; bit++) { if (((p >> bit) & 1) != ((q >> bit) & 1)) d++; } return d; } int main() { double a = 3; printf("surface %.0f; volume %.0f\n", 6 * a * a, a * a * a); printf("face diagonal %.3f; space diagonal %.3f\n", a * sqrt(2.0), a * sqrt(3.0)); int edges = 0; for (int p = 0; p < 8; p++) { for (int q = p + 1; q < 8; q++) { if (differ(p, q) == 1) edges++; } } printf("%d %d %d\n", 8, edges, 8 - edges + 6); int at1 = 0; int at2 = 0; int at3 = 0; for (int q = 1; q < 8; q++) { int d = differ(0, q); if (d == 1) at1++; if (d == 2) at2++; if (d == 3) at3++; } printf("%d %d %d\n", at1, at2, at3); for (int i = 0; i < 8; i++) printf("%d ", i ^ (i >> 1)); printf("\n"); return 0; } /* output: surface 54; volume 27 face diagonal 4.243; space diagonal 5.196 8 12 2 3 3 1 0 1 3 2 6 7 5 4 */ ``` ## How many different dice are there, and how many positions has a Rubik’s cube? **There are $30$ different dice if the faces carry $1$ to $6$ once each and turning a die does not make a new one, and only $2$ of them have opposite faces adding to $7$, which are mirror images of each other.** Without turning there are $6!=720$ ways to write the numbers on six faces, and a cube can be turned in $24$ ways (the $6$ faces that can lie on the table times $4$ quarter turns), so $\frac{720}{24}=30$. Fix the pairs of opposite faces as $(1,6)$, $(2,5)$, $(3,4)$ and only the left or right handed arrangement remains: place $1$ on top and $2$ in front, and $3$ goes either on the right or on the left. Dice for games use one of the two, the other being their reflection. Dice are very old: cubes marked this way are about $5000$ years old. A $3\times3\times3$ puzzle cube has $8$ corner pieces, $12$ edge pieces and $6$ centres. The corners can be arranged in $8!$ ways and each can be twisted in $3$ ways (the last twist is forced), the edges in $12!$ ways and each flipped in $2$ ways (the last flip is forced), and half of these combinations cannot be reached by turning the faces, giving $$\frac{8!\cdot3^7\cdot12!\cdot2^{11}}{2}=43\,252\,003\,274\,489\,856\,000\approx4.3\times10^{19}$$ positions. Of the $27$ little cubes of a $3\times3\times3$ block, $26$ show a face and the middle one is hidden, which is also $3^3-1^3$. ## Where does the cube come from in mathematics? **The cube is among the oldest shapes in mathematics: it is one of the five regular solids the Greeks described, and a problem about it stood open for more than two thousand years.** - **About 3000 BCE.** Dice shaped like cubes, with the faces marked by dots, are found in the ancient Near East; the oldest known are about $5000$ years old. - **About 360 BCE.** Plato’s Timaeus associates the five regular solids with the elements, and gives the cube to earth, the most stable. - **About 300 BCE.** Euclid’s Elements ends with Book XIII, which constructs the five regular solids; Proposition 15 constructs the cube and encloses it in a sphere. - **About 430 BCE onward.** The Delian problem, doubling a cube, is posed. Hippocrates of Chios reduces it to finding two mean proportionals, and Archytas finds a construction in three dimensions. - **1750.** Euler states the formula $V-E+F=2$ for solids such as the cube, in a letter to Goldbach. - **1837.** Pierre Wantzel proves that doubling the cube, and trisecting an angle, cannot be done with a compass and straightedge. - **1974.** Ernő Rubik, a Hungarian architect, invents the puzzle cube; it is sold around the world from 1980. ## What are the common mistakes with the cube? **The most common mistakes with the cube are the nine below, each with the correct statement.** | Mistake | Correct | |---|---| | ❌ Surface area $=a^3$, or volume $=6a^2$ | Area is $6a^2$ (square units), volume is $a^3$ (cubic units). | | ❌ Surface area $=a^2$ | That is one face: the surface is six faces, $6a^2$. | | ❌ Doubling the edge doubles the volume | The volume becomes $2^3=8$ times as large, the surface $2^2=4$ times. | | ❌ The space diagonal is $a\sqrt2$ | $a\sqrt2$ is a face diagonal; the space diagonal is $a\sqrt3$. | | ❌ A cube has $8$ edges and $12$ corners | $12$ edges and $8$ corners, and $6$ faces: $8-12+6=2$. | | ❌ Any six squares joined together make a net | Only $11$ of the $35$ do: no $2\times2$ block, no row of five, no overlap. | | ❌ The cut of a cube is always a square | It can be a triangle, a rectangle, a pentagon or a hexagon too. | | ❌ The inscribed sphere has radius $a$ | Its diameter is $a$, so its radius is $\frac a2$. | | ❌ Mixing units: edge in cm, volume in litres | $1$ dm³ $=1$ litre, $1000$ cm³ $=1$ litre: convert the edge first. | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: the cube at a glance - **Parts:** $6$ faces, $12$ edges, $8$ corners; $8-12+6=2$. The corners are the triples of $0$s and $1$s. - **Area and volume:** surface $6a^2$, volume $a^3$; scaling by $k$ gives $k^2$ and $k^3$; $1$ dm³ is $1$ litre. - **Diagonals:** face $a\sqrt2$, space $a\sqrt3$; two space diagonals meet at $\arccos\frac13\approx70.53^\circ$. - **Nets:** $11$ of the $35$ hexominoes fold; check by rolling a cube; opposite faces are one square apart in a row. - **Cuts:** triangle, quadrilateral, pentagon, hexagon, never more than six sides; the central cut perpendicular to a space diagonal is a regular hexagon of area $\frac{3\sqrt3}{4}a^2$. - **Spheres:** inside, radius $\frac a2$, fills $\frac\pi6$ of the cube; around, radius $\frac{a\sqrt3}{2}$. - **Cube numbers:** $(a+b)^3=a^3+3a^2b+3ab^2+b^3$; $1^3+\cdots+n^3=\left(\frac{n(n+1)}{2}\right)^2$; doubling needs $\sqrt[3]{2}$, not constructible. ## Glossary: key terms - **Cube**: A solid with six identical square faces, twelve equal edges and eight corners, three faces meeting at each corner. - **Face, edge, vertex**: A flat square of the surface, where two faces meet, and where three edges meet. - **Net**: A flat arrangement of squares joined edge to edge that folds into the cube with no overlap; the cube has 11. - **Surface area**: The total area of the faces; for a cube with edge a it is 6 a squared. - **Volume**: The space inside a solid, measured in cubic units; for a cube with edge a it is a cubed. - **Space diagonal**: The segment joining two opposite corners through the inside of the cube; its length is a times the square root of 3. - **Face diagonal**: The diagonal of one square face; its length is a times the square root of 2. - **Cross-section**: The shape in which a plane cuts a solid; for a cube it has between three and six sides. - **Cube root**: The number whose cube is a given number; the edge of a cube whose volume is given. - **Euler’s formula**: V minus E plus F equals 2 for a solid without holes, with V vertices, E edges and F faces. ## Frequently asked questions ### What is a cube in geometry? A cube is a solid with six identical square faces, twelve edges of equal length and eight corners, where three faces meet at each corner. It is also called a regular hexahedron and is one of the five Platonic solids. ### How do you find the volume of a cube? Cube the edge: the volume is a times a times a, a cubed, in cubic units. A cube with edge 3 cm has volume 27 cm³. To find the edge from the volume, take the cube root. ### What is the formula for the surface area of a cube? The surface area is 6 times a squared, where a is the edge. A cube has six faces and each is a square of area a squared. For an edge of 5 the surface area is 150. ### How do you find the space diagonal of a cube? Multiply the edge by the square root of 3. Pythagoras on a face gives the face diagonal a times root 2, and Pythagoras again with the edge gives d squared equal to 3 a squared. For an edge of 5 the diagonal is about 8.66. ### How many nets does a cube have? A cube has exactly 11 different nets. Of the 35 ways to join six squares edge to edge, 24 fail because of a 2 by 2 block, a row of five, or two squares landing on the same face. ### What happens to the volume of a cube when the edge doubles? The volume becomes eight times as large, since 2 cubed is 8, while the surface area becomes four times as large, since 2 squared is 4. In general, scaling the edge by k scales the volume by k cubed. ### What shapes can you get by slicing a cube? A plane can cut a cube in a triangle, a quadrilateral such as a square or rectangle, a pentagon or a hexagon, never more than six sides. A plane through the centre, perpendicular to a space diagonal, gives a regular hexagon. ### Can you double a cube with a compass and straightedge? No. Doubling the volume needs the edge multiplied by the cube root of 2, and Pierre Wantzel proved in 1837 that this length cannot be constructed with a compass and straightedge, since it is a root of an irreducible cubic. --- # Kubus: Sisi, Jaring-Jaring, Volume, Diagonal, dan Irisan Source: https://nunada.my.id/artikel/kubus/ Updated: 2026-11-01 ## Jawaban singkat **Kubus adalah bangun ruang dengan enam sisi persegi yang kongruen, dua belas rusuk sama panjang, dan delapan titik sudut; dengan rusuk $a$ luas permukaannya $6a^2$, volumenya $a^3$, dan diagonal ruangnya $a\sqrt3$.** Enam persegi yang bersambung sisi ke sisi terlipat menjadi kubus dengan tepat 11 cara berbeda (jaring-jaringnya). Sebuah bidang dapat mengiris kubus menjadi segitiga, persegi, segilima, atau segienam beraturan, dan menggandakan volume kubus memerlukan rusuk $\sqrt[3]{2}$ kali lebih panjang, panjang yang tak dapat dikonstruksi dengan jangka dan penggaris. ### Poin penting - Kubus memiliki $6$ sisi, $12$ rusuk, dan $8$ titik sudut, tiga persegi bertemu di setiap titik sudut, dan $8-12+6=2$, bilangan Euler untuk setiap bangun ruang tanpa lubang. Kedelapan titik sudutnya adalah delapan tripel $0$ dan $1$, dan sebuah rusuk menghubungkan dua titik sudut yang berbeda dalam satu koordinat. - Luas permukaan $6a^2$ dan volume $a^3$. Kalikan setiap rusuk dengan $k$ dan luasnya dikalikan $k^2$ serta volumenya $k^3$: menggandakan rusuk membuat luas permukaan $4$ kali dan volume $8$ kali lipat. - Pythagoras dua kali: sebuah sisi memiliki diagonal $a\sqrt2$, kubus memiliki diagonal ruang $a\sqrt3$. Dua diagonal ruang bertemu dengan sudut sekitar $70{,}53^\circ$, dan sebuah diagonal ruang membentuk sekitar $35{,}26^\circ$ dengan sebuah sisi. - Dari $35$ cara menyambung enam persegi sisi ke sisi, tepat $11$ yang terlipat menjadi kubus. Jaring-jaring tak boleh memuat blok $2\times2$, baris berisi lima, atau dua persegi yang mendarat di sisi yang sama; menggelindingkan kubus di atas persegi-persegi itu memeriksa semuanya. - Sebuah bidang mengiris kubus menjadi segitiga, segiempat, segilima, atau segienam: tak pernah lebih dari enam sisi, karena ia memotong paling banyak enam sisi kubus. Melalui pusat, tegak lurus pada diagonal ruang, irisannya segienam beraturan dengan luas $\frac{3\sqrt3}{4}a^2$. - Untuk menggandakan volume kamu memerlukan rusuk yang dikalikan $\sqrt[3]{2}\approx1{,}2599$. Jangka dan penggaris tak dapat menggambar panjang itu (Wantzel, 1837), tetapi metode Newton menemukannya sampai berapa pun digit dalam beberapa langkah. ## Apa itu kubus, dan berapa banyak sisi, rusuk, dan titik sudutnya? **Kubus adalah bangun ruang yang dibatasi enam persegi yang kongruen, dengan $12$ rusuk yang semuanya sama panjang $a$ dan $8$ titik sudut, dan tiga persegi bertemu di setiap titik sudut.** Ia adalah heksahedron beraturan, dan satu dari lima bangun ruang Platonik: satu-satunya yang sisinya persegi. Kubus adalah kasus khusus [balok](https://nunada.my.id/artikel/balok/#what-is-a-cuboid), kotak yang ketiga rusuknya boleh berbeda semua. Sisi yang berhadapan sejajar, setiap sudut antara dua rusuk yang bertemu adalah sudut siku-siku, dan panjang rusuk menentukan segala hal lainnya. | Bagian | Bahasa Inggris | Bahasa Indonesia | Banyaknya | |---|---|---|---| | sebuah persegi pada permukaan | face | sisi | $6$ | | tempat dua sisi bertemu | edge | rusuk | $12$ | | tempat tiga rusuk bertemu | vertex (corner) | titik sudut | $8$ | Banyaknya itu memenuhi rumus Euler: $V-E+F=8-12+6=2$, sama untuk setiap bangun ruang tanpa lubang, baik kubus, limas, maupun bola sepak. Letakkan kubus dalam koordinat dengan satu titik sudut di titik asal dan titik sudut yang berhadapan di $(1,1,1)$, dan kedelapan titik sudutnya tepat delapan tripel $0$ dan $1$. Sebuah rusuk menghubungkan dua titik sudut yang berbeda dalam satu koordinat, sehingga tiap titik sudut memiliki $3$ rusuk, dan $\frac{8\cdot3}{2}=12$. Fakta kecil itu, bahwa kubus adalah bilangan biner tiga bit yang digambar dalam ruang, dipakai lagi pada kode di bawah ([bilangan biner](https://nunada.my.id/artikel/bilangan-biner/#what-is-binary) menjelaskan bit). ## Ada berapa jaring-jaring kubus, dan susunan persegi mana yang terlipat menjadi kubus? **Jaring-jaring kubus adalah susunan enam persegi yang bersambung sisi ke sisi dan terlipat menjadi kubus dengan setiap sisi tertutup sekali; ada tepat 11 jaring-jaring yang berbeda.** Salinan yang diputar dan dibalik dihitung sebagai jaring-jaring yang sama. Bentuk yang terbuat dari enam persegi disebut heksomino, dan ada $35$ di antaranya; hanya $11$ yang menjadi jaring-jaring. Mereka terbagi dalam empat keluarga, dinamai menurut banyak persegi pada tiap baris: $1\text{-}4\text{-}1$ (satu baris empat dengan satu persegi di atas dan satu di bawah, dengan $6$ cara), $2\text{-}3\text{-}1$ ($3$ cara), $2\text{-}2\text{-}2$ (tangga, $1$ cara), dan $3\text{-}3$ ($1$ cara). Mengapa $24$ yang lain bukan jaring-jaring? $12$ langsung tersingkir: $8$ memuat blok $2\times2$, yang tak dapat terletak datar pada kubus (sekali mengelilingi sebuah sudut membawamu kembali ke sisi yang berbeda), dan $4$ memiliki baris berisi lima atau enam. Dua belas sisanya gagal karena bertumpuk: dua persegi akan mendarat di sisi yang sama, menyisakan satu sisi kosong. Satu baris lurus memperlihatkan caranya: bila dilipat mengelilingi kubus, persegi yang berjarak empat mendarat di sisi yang sama. Cara menguji susunan mana pun adalah menggelindingkan kubus di atasnya: letakkan kubus di persegi pertama, gelindingkan dari persegi ke persegi, dan catat sisi mana yang menyentuh masing-masing; susunan itu jaring-jaring tepat bila keenam persegi menyentuh enam sisi yang berbeda. Pada jaring-jaring, persegi yang di antaranya tepat satu persegi dalam satu baris adalah sisi yang berhadapan. Jadi bila kamu menomori persegi seperti dadu, sisi berhadapan berjumlah $7$, pasangannya jatuh pada tempatnya. Susun sendiri di bawah, atau muat ke-11 jaring-jaring dan tiga jawaban salah yang umum. *Salib adalah satu dari 11 jaring-jaring. Dinomori seperti dadu, persegi yang berhadapan setelah dilipat adalah $6$ dan $1$ (atas dan bawah salib), $4$ dan $3$, serta $5$ dan $2$: dalam satu baris, persegi yang di antaranya tepat satu persegi saling berhadapan, dan tiap pasangan berjumlah $7$.* *Satu baris enam bukan jaring-jaring. Bila baris itu dilipat mengelilingi kubus, persegi $5$ kembali ke sisi tempat persegi $1$ mulai, dan persegi $6$ ke sisi persegi $2$: dua sisi tertutup dua kali dan dua sisi tak tertutup. Dalam baris lurus, persegi yang berjarak empat selalu mendarat di sisi yang sama.* ## Bagaimana mencari luas permukaan dan volume kubus? **Luas permukaan kubus dengan rusuk $a$ adalah $6a^2$, enam persegi dengan luas $a^2$, dan volumenya $a^3$, banyaknya kubus satuan dalam tumpukan sepanjang $a$, selebar $a$, dan setinggi $a$.** Untuk $a=3$ cm: satu sisi $9$ cm², permukaannya $6\cdot9=54$ cm², dan volumenya $3^3=27$ cm³, karena $3$ lapis kubus satuan $3\times3$ membentuk $27$. Kubus juga adalah balok dengan ketiga sisinya sama, jadi $V=a\cdot a\cdot a$ adalah panjang kali lebar kali tinggi. Perubahan skala. Bila setiap rusuk dikalikan $k$, panjang dikalikan $k$, luas dikalikan $k^2$, dan volume dikalikan $k^3$. Menggandakan rusuk ($k=2$) mengalikan luas permukaan dengan $4$ dan volume dengan $8$; melipattigakannya ($k=3$) memberi $9$ dan $27$. Kubus berusuk $2$ memiliki volume $8$ dan luas permukaan $24$, sedangkan kubus satuan memiliki $1$ dan $6$. Inilah sebabnya hewan besar memerlukan kaki yang tebal: beratnya tumbuh menurut pangkat tiga ukurannya dan kekuatan sebuah kaki hanya menurut kuadratnya. Satuan. Volume memakai satuan kubik, dan satu desimeter kubik tepat satu liter, jadi bak air berbentuk kubus dengan rusuk $40$ cm $=4$ dm memuat $4^3=64$ liter. Kubus berusuk $1$ m adalah $1000$ dm³: $1000$ liter. Mundur. Bila volume diketahui, ambil akar pangkat tiga: kubus bervolume $216$ cm³ memiliki rusuk $\sqrt[3]{216}=6$ cm. Geser rusuk di bawah dan baca setiap ukuran, termasuk apa yang dilakukan penggandaan. ## Bagaimana mencari diagonal ruang kubus, dan sudut apa yang dibentuk diagonal-diagonalnya? **Diagonal sisi kubus berusuk $a$ adalah $a\sqrt2$ dan diagonal ruang, yang menghubungkan titik sudut berhadapan melalui bagian dalam, adalah $a\sqrt3$: [teorema Pythagoras](https://nunada.my.id/artikel/teorema-pythagoras/#distance-and-diagonals) yang dipakai dua kali.** Sebuah sisi adalah persegi, sehingga diagonalnya sisi miring segitiga siku-siku dengan kedua sisi tegak $a$: $f^2=a^2+a^2=2a^2$. Diagonal ruang $d$ adalah sisi miring segitiga siku-siku kedua yang sisi tegaknya diagonal sisi $f$ itu dan rusuk $a$ yang berdiri dari ujungnya: $d^2=f^2+a^2=3a^2$. Jadi $d=a\sqrt3\approx1{,}732a$; untuk $a=5$ ia $5\sqrt3\approx8{,}66$. Batang lurus terpanjang yang muat dalam ruangan berbentuk kubus berusuk $4$ m adalah $4\sqrt3\approx6{,}93$ m, menurut diagonal ruang. Kubus memiliki $4$ diagonal ruang, semuanya sama panjang, dan semuanya melalui pusat, tempat masing-masing terbagi dua. Ambil titik sudut kubus satuan: arah diagonalnya $(1,1,1)$, $(-1,1,1)$, $(1,-1,1)$, dan $(1,1,-1)$. Dua di antaranya bertemu dengan sudut yang $\cos\theta=\frac{|(1,1,1)\cdot(-1,1,1)|}{3}=\frac13$, sehingga $\theta=\arccos\frac13\approx70{,}53^\circ$. Sebuah diagonal ruang dan sisi tempat ia mulai membentuk sudut $\arctan\frac{1}{\sqrt2}\approx35{,}26^\circ$, karena diagonal naik $a$ pada jarak mendatar $a\sqrt2$. Dari titik sudut mana pun, tujuh titik sudut lainnya berada pada tiga jarak: $3$ pada $a$ (menurut rusuk), $3$ pada $a\sqrt2$ (melintasi sisi), dan $1$ pada $a\sqrt3$ (titik sudut yang berhadapan). Banyak $3,3,1$ itu adalah koefisien $(1+x)^3$. *Putar kubusnya. Diagonal sebuah sisi, $f=AC$, adalah sisi miring segitiga siku-siku dengan kedua sisi tegak $a$, sehingga $f=a\sqrt2$. Diagonal ruang, $d=AG$, adalah sisi miring segitiga siku-siku dengan sisi tegak $f$ dan $a$, sehingga $d^2=2a^2+a^2=3a^2$ dan $d=a\sqrt3$.* ## Bentuk apa yang diperoleh ketika sebuah bidang mengiris kubus? **Sebuah bidang mengiris kubus menjadi segitiga, segiempat, segilima, atau segienam, tak pernah menjadi segi banyak dengan lebih dari enam sisi, karena tiap sisi irisan terletak pada satu sisi kubus dan kubus hanya punya enam.** Irisan juga dapat berupa persegi, persegi panjang, belah ketupat, trapesium, atau jajar genjang, dan posisi khusus memberi bentuk yang paling indah: - bidang yang sejajar sebuah sisi mengiris **persegi** dengan luas $a^2$; - bidang yang sejajar sebuah rusuk, seperti $x+y=t$, mengiris **persegi panjang** yang tingginya $a$ dan lebarnya $t\sqrt2$ (persegi bila $t=\frac{a}{\sqrt2}$), dan melalui dua rusuk yang berhadapan ($x+y=a$) ia persegi panjang $a\times a\sqrt2$ dengan luas $a^2\sqrt2$; - bidang yang memotong sebuah sudut, seperti $x+y+z=t$ untuk $t\le a$, mengiris **segitiga sama sisi**, dan sudut yang dipotongnya adalah limas kecil dengan volume $\frac{t^3}{6}$ (untuk $t=a$ seperenam kubus, dengan segitiga bersisi $a\sqrt2$ dan luas $\frac{\sqrt3}{2}a^2$); - bidang yang sama yang digeser ke tengah, $x+y+z=\frac{3a}{2}$, tegak lurus pada diagonal ruang dan melalui pusat, mengiris **segienam beraturan**. Titik sudutnya adalah titik tengah enam rusuk, sisinya $\frac{a\sqrt2}{2}$, dan luasnya $6\cdot\frac{\sqrt3}{4}\cdot\left(\frac{a\sqrt2}{2}\right)^2=\frac{3\sqrt3}{4}a^2\approx1{,}299a^2$. Bidang seperti $x+2y+3z=t$ memperlihatkan seluruh urutan saat ia bergerak: segitiga, lalu irisan bersisi empat, lalu segilima, lalu (melalui pusat) jajar genjang, dan turun kembali ke arah sebaliknya. Gerakkan bidang pada widget: bentuk di kanan adalah irisan yang dibentangkan, dengan panjang sisi sebenarnya. Tidak setiap segi banyak muncul: tak ada irisan bersisi tujuh, dan segienam beraturan hanya muncul bila bidang melalui pusat tegak lurus pada diagonal ruang. *Bidang $x+y+z=3$ melalui pusat kubus berusuk $2$, tegak lurus pada sebuah diagonal ruang, memotong keenam rusuk di titik tengahnya. Irisannya adalah segienam beraturan bersisi $\sqrt2$, dan luasnya $\frac{3\sqrt3}{4}a^2\approx1{,}299a^2$ untuk rusuk $a$.* ## Seberapa besar bola di dalam kubus, dan bola yang mengelilinginya? **Bola terbesar di dalam kubus menyentuh keenam sisi, berjari-jari $\frac a2$, dan mengisi $\frac\pi6\approx52{,}4\%$ kubus; bola yang melalui kedelapan titik sudut berjari-jari $\frac{a\sqrt3}{2}$ dan bervolume $\frac{\pi\sqrt3}{2}a^3\approx2{,}72a^3$.** Bola dalam berdiameter $a$, sama dengan rusuk, sehingga volumenya $\frac43\pi\left(\frac a2\right)^3=\frac\pi6a^3$ terhadap $a^3$ milik kubus. Bola luar berdiameter diagonal ruang $a\sqrt3$, sehingga jari-jarinya $\frac{a\sqrt3}{2}$ dan volumenya $\frac43\pi\left(\frac{a\sqrt3}{2}\right)^3=\frac{\pi\sqrt3}{2}a^3$, sedikit lebih dari $2{,}7$ kubus. Bola ketiga, berjari-jari $\frac{a}{\sqrt2}$, tepat menyentuh kedua belas rusuk, di antara keduanya. Jadi ketiga jari-jari berbanding $\frac12:\frac{1}{\sqrt2}:\frac{\sqrt3}{2}$, sekitar $0{,}5:0{,}707:0{,}866$ kali rusuk. ## Apa itu bilangan kubik, dan apa pangkat tiga suatu jumlah? **Bilangan kubik adalah $n^3$, volume kubus dengan rusuk bilangan bulat $n$: $1,8,27,64,125,\ldots$, dan pangkat tiga suatu jumlah $(a+b)^3$ memecah kubus berusuk $a+b$ menjadi delapan bagian.** Potong kubus seperti itu dengan bidang pada jarak $a$ dari sudut-sudutnya: bagiannya satu kubus $a^3$, tiga lempeng $a^2b$, tiga batang $ab^2$, dan satu kubus kecil $b^3$, sehingga $$(a+b)^3=a^3+3a^2b+3ab^2+b^3.$$ Untuk $a=2$ dan $b=1$: $27=8+12+6+1$. Koefisien $1,3,3,1$ menghitung bagian-bagiannya, dan kembali sebagai baris segitiga Pascal (lihat [menjabarkan kurung](https://nunada.my.id/artikel/bentuk-aljabar/#expand)). Dua fakta lagi tentang bilangan kubik. Jumlah $n$ kubik pertama adalah kuadrat sempurna, kuadrat jumlah $n$ bilangan pertama (teorema Nicomachus): $1^3+2^3+\cdots+n^3=\left(\frac{n(n+1)}{2}\right)^2$, sehingga untuk $n=10$ ia $55^2=3025$. Dan untuk mencari akar pangkat tiga yang bukan bilangan bulat, seperti rusuk kubus bervolume $30$, pakai iterasi Newton $x_{k+1}=\frac{2x_k+v/x_k^2}{3}$ (lihat [metode Newton](https://nunada.my.id/artikel/metode-newton/#idea)): untuk $\sqrt[3]{30}$ mulai dari $3$ dan ia menetap di $3{,}1072$ dalam beberapa langkah. ## Mengapa kubus tak dapat digandakan dengan jangka dan penggaris? **Untuk menggandakan volume kubus kamu harus mengalikan rusuknya dengan $\sqrt[3]{2}\approx1{,}259921$, dan jangka serta penggaris tak dapat mengonstruksi panjang itu dari panjang satuan; ini dibuktikan oleh Pierre Wantzel pada 1837.** Volume menjadi dua kali ketika $k^3=2$, jadi $k=\sqrt[3]{2}$. Jangka dan penggaris hanya dapat menghasilkan panjang yang berasal dari bilangan bulat dengan menjumlah, mengurang, mengali, membagi, dan menarik akar kuadrat, dan tiap langkah demikian paling banyak menggandakan derajat persamaan yang dipenuhi bilangan itu, sehingga derajatnya selalu pangkat dari $2$. Tetapi $\sqrt[3]{2}$ adalah akar $x^3-2=0$, persamaan berderajat $3$ yang tak dapat dipecah menjadi yang lebih kecil, dan $3$ bukan pangkat dari $2$. Jadi panjang itu tak dapat dikonstruksi, sepandai apa pun gambarnya. Legenda mengatakan penduduk Delos diberi tahu oleh ramalan untuk menggandakan altar Apollo, sebuah kubus, agar wabah berhenti; masalahnya disebut masalah Delos. Ahli geometri Yunani menyelesaikannya dengan alat lain (kurva, penggaris bertanda), dan bilangannya dapat ditemukan seteliti yang kamu mau dengan aritmetika: iterasi Newton dari $1$ memberi $1$, $\frac43=1{,}3333$, $\frac{91}{72}=1{,}2639$, $1{,}259933$, $1{,}2599210500$: setelah empat langkah pangkat tiga jawabannya $2$ sampai sembilan digit. ## Bagaimana bekerja dengan kubus dalam program? **Program memperlakukan kubus sebagai bilangan $0$ sampai $7$ yang dibaca sebagai tiga bit: bit-bit itu adalah koordinat sebuah titik sudut, sebuah rusuk menghubungkan dua bilangan yang berbeda satu bit, dan jarak antar titik sudut dihitung dari bit yang berbeda.** Untuk koordinat $0/1$ banyaknya bit yang berbeda tepat sama dengan jarak kuadrat, sehingga dari satu titik sudut ada $3$ titik sudut pada jarak kuadrat $1$, $3$ pada $2$, dan $1$ pada $3$. Berjalan menyusuri rusuk melalui kedelapan titik sudut adalah kode Gray $i\oplus(i\gg1)$, tempat bilangan berurutan berbeda satu bit: $0,1,3,2,6,7,5,4$. Program di bawah mencetak, untuk kubus berusuk $3$, luas permukaan, volume, dan kedua diagonal, lalu banyak $8$ titik sudut, $12$ rusuk, dan $V-E+F=2$, banyak jarak, dan jalannya. ```python from collections import Counter from itertools import product from math import sqrt def measures(a): return { 'surface': 6 * a * a, 'volume': a ** 3, 'face diagonal': round(a * sqrt(2), 3), 'space diagonal': round(a * sqrt(3), 3), } corners = list(product((0, 1), repeat=3)) # the eight corners: every triple of 0s and 1s differ = lambda p, q: sum(x != y for x, y in zip(p, q)) # for 0/1 coordinates this is also the squared distance edges = [(p, q) for i, p in enumerate(corners) for q in corners[i + 1:] if differ(p, q) == 1] print(measures(3)) # {'surface': 54, 'volume': 27, 'face diagonal': 4.243, 'space diagonal': 5.196} print(len(corners), len(edges), len(corners) - len(edges) + 6) # 8 12 2 print(sorted(Counter(differ(corners[0], q) for q in corners[1:]).items())) # [(1, 3), (2, 3), (3, 1)] print([i ^ (i >> 1) for i in range(8)]) # [0, 1, 3, 2, 6, 7, 5, 4]: a walk along edges through all corners ``` ```javascript const measures = (a) => ({ surface: 6 * a * a, volume: a ** 3, faceDiagonal: +(a * Math.sqrt(2)).toFixed(3), spaceDiagonal: +(a * Math.sqrt(3)).toFixed(3) }) const corners = Array.from({ length: 8 }, (_, i) => i) // the bits of i are x, y and z const differ = (p, q) => [0, 1, 2].filter((b) => ((p >> b) & 1) !== ((q >> b) & 1)).length const edges = corners.flatMap((p) => corners.filter((q) => q > p && differ(p, q) === 1).map((q) => [p, q])) measures(3) // { surface: 54, volume: 27, faceDiagonal: 4.243, spaceDiagonal: 5.196 } ;[corners.length, edges.length, corners.length - edges.length + 6] // [8, 12, 2] const at = {} for (const q of corners.slice(1)) at[differ(0, q)] = (at[differ(0, q)] ?? 0) + 1 at // { '1': 3, '2': 3, '3': 1 } corners.map((i) => i ^ (i >> 1)) // [0, 1, 3, 2, 6, 7, 5, 4] ``` ```cpp #include #include #include using namespace std; // how many bits differ: for corners numbered 0 to 7 this is the squared distance int differ(int p, int q) { int d = 0; for (int bit = 0; bit < 3; bit++) { if (((p >> bit) & 1) != ((q >> bit) & 1)) d++; } return d; } int main() { double a = 3; printf("surface %.0f; volume %.0f\n", 6 * a * a, a * a * a); printf("face diagonal %.3f; space diagonal %.3f\n", a * sqrt(2.0), a * sqrt(3.0)); int edges = 0; for (int p = 0; p < 8; p++) { for (int q = p + 1; q < 8; q++) { if (differ(p, q) == 1) edges++; } } printf("%d %d %d\n", 8, edges, 8 - edges + 6); int at1 = 0; int at2 = 0; int at3 = 0; for (int q = 1; q < 8; q++) { int d = differ(0, q); if (d == 1) at1++; if (d == 2) at2++; if (d == 3) at3++; } printf("%d %d %d\n", at1, at2, at3); for (int i = 0; i < 8; i++) printf("%d ", i ^ (i >> 1)); printf("\n"); return 0; } /* output: surface 54; volume 27 face diagonal 4.243; space diagonal 5.196 8 12 2 3 3 1 0 1 3 2 6 7 5 4 */ ``` ## Ada berapa dadu yang berbeda, dan berapa banyak posisi kubus Rubik? **Ada $30$ dadu yang berbeda bila sisinya memuat $1$ sampai $6$ masing-masing sekali dan memutar dadu tak membuat dadu baru, dan hanya $2$ di antaranya yang sisi berhadapannya berjumlah $7$, yang saling merupakan bayangan cermin.** Tanpa memutar ada $6!=720$ cara menuliskan bilangan pada enam sisi, dan kubus dapat diputar dalam $24$ cara ($6$ sisi yang dapat berada di meja kali $4$ putaran seperempat), jadi $\frac{720}{24}=30$. Tetapkan pasangan sisi berhadapan sebagai $(1,6)$, $(2,5)$, $(3,4)$ dan hanya tersisa susunan kidal atau kanan: letakkan $1$ di atas dan $2$ di depan, dan $3$ berada di kanan atau di kiri. Dadu untuk permainan memakai salah satu dari keduanya, yang lain adalah bayangannya. Dadu sangat tua: kubus yang ditandai seperti ini berumur sekitar $5000$ tahun. Kubus teka-teki $3\times3\times3$ memiliki $8$ keping sudut, $12$ keping rusuk, dan $6$ pusat. Sudutnya dapat disusun dalam $8!$ cara dan masing-masing dapat diputar dalam $3$ cara (putaran terakhir ditentukan), rusuknya dalam $12!$ cara dan masing-masing dibalik dalam $2$ cara (pembalikan terakhir ditentukan), dan separuh kombinasi itu tak dapat dicapai dengan memutar sisi-sisinya, sehingga diperoleh $$\frac{8!\cdot3^7\cdot12!\cdot2^{11}}{2}=43.252.003.274.489.856.000\approx4{,}3\times10^{19}$$ posisi. Dari $27$ kubus kecil pada balok $3\times3\times3$, $26$ memperlihatkan sebuah sisi dan yang di tengah tersembunyi, yang juga $3^3-1^3$. ## Dari mana asal kubus dalam matematika? **Kubus termasuk bentuk tertua dalam matematika: ia satu dari lima bangun beraturan yang diuraikan orang Yunani, dan sebuah masalah tentangnya terbuka lebih dari dua ribu tahun.** - **Sekitar 3000 SM.** Dadu berbentuk kubus, dengan sisi bertanda titik, ditemukan di Timur Dekat kuno; yang tertua dikenal berumur sekitar $5000$ tahun. - **Sekitar 360 SM.** Timaeus karya Plato mengaitkan lima bangun beraturan dengan unsur, dan memberikan kubus kepada tanah, yang paling mantap. - **Sekitar 300 SM.** Elements Euclid berakhir dengan Buku XIII, yang mengonstruksi lima bangun beraturan; Proposisi 15 mengonstruksi kubus dan melingkupinya dalam bola. - **Sekitar 430 SM dan sesudahnya.** Masalah Delos, menggandakan kubus, diajukan. Hippocrates dari Chios menyederhanakannya menjadi mencari dua rata-rata geometrik, dan Archytas menemukan konstruksi dalam tiga dimensi. - **1750.** Euler menyatakan rumus $V-E+F=2$ untuk bangun seperti kubus, dalam surat kepada Goldbach. - **1837.** Pierre Wantzel membuktikan bahwa menggandakan kubus, dan membagi tiga sebuah sudut, tak dapat dilakukan dengan jangka dan penggaris. - **1974.** Ernő Rubik, seorang arsitek Hungaria, menciptakan kubus teka-teki; ia dijual ke seluruh dunia sejak 1980. ## Apa kesalahan umum pada kubus? **Kesalahan paling umum pada kubus adalah sembilan hal berikut, masing-masing dengan pernyataan yang benar.** | Kesalahan | Yang benar | |---|---| | ❌ Luas permukaan $=a^3$, atau volume $=6a^2$ | Luasnya $6a^2$ (satuan persegi), volumenya $a^3$ (satuan kubik). | | ❌ Luas permukaan $=a^2$ | Itu satu sisi: permukaannya enam sisi, $6a^2$. | | ❌ Menggandakan rusuk menggandakan volume | Volumenya menjadi $2^3=8$ kali lipat, luas permukaannya $2^2=4$ kali. | | ❌ Diagonal ruang adalah $a\sqrt2$ | $a\sqrt2$ adalah diagonal sisi; diagonal ruang adalah $a\sqrt3$. | | ❌ Kubus memiliki $8$ rusuk dan $12$ titik sudut | $12$ rusuk dan $8$ titik sudut, dan $6$ sisi: $8-12+6=2$. | | ❌ Enam persegi yang disambung mana pun membentuk jaring-jaring | Hanya $11$ dari $35$: tanpa blok $2\times2$, tanpa baris lima, tanpa tumpang tindih. | | ❌ Irisan kubus selalu persegi | Ia bisa juga segitiga, persegi panjang, segilima, atau segienam. | | ❌ Bola dalam berjari-jari $a$ | Diameternya $a$, sehingga jari-jarinya $\frac a2$. | | ❌ Mencampur satuan: rusuk dalam cm, volume dalam liter | $1$ dm³ $=1$ liter, $1000$ cm³ $=1$ liter: ubah rusuknya dulu. | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: kubus sekilas - **Bagian:** $6$ sisi, $12$ rusuk, $8$ titik sudut; $8-12+6=2$. Titik sudutnya adalah tripel $0$ dan $1$. - **Luas dan volume:** permukaan $6a^2$, volume $a^3$; perubahan skala $k$ memberi $k^2$ dan $k^3$; $1$ dm³ adalah $1$ liter. - **Diagonal:** sisi $a\sqrt2$, ruang $a\sqrt3$; dua diagonal ruang bertemu pada $\arccos\frac13\approx70{,}53^\circ$. - **Jaring-jaring:** $11$ dari $35$ heksomino terlipat; periksa dengan menggelindingkan kubus; sisi berhadapan berjarak satu persegi dalam satu baris. - **Irisan:** segitiga, segiempat, segilima, segienam, tak pernah lebih dari enam sisi; irisan tengah yang tegak lurus pada diagonal ruang adalah segienam beraturan dengan luas $\frac{3\sqrt3}{4}a^2$. - **Bola:** di dalam, berjari-jari $\frac a2$, mengisi $\frac\pi6$ kubus; di sekeliling, berjari-jari $\frac{a\sqrt3}{2}$. - **Bilangan kubik:** $(a+b)^3=a^3+3a^2b+3ab^2+b^3$; $1^3+\cdots+n^3=\left(\frac{n(n+1)}{2}\right)^2$; penggandaan memerlukan $\sqrt[3]{2}$, tak dapat dikonstruksi. ## Glosarium: istilah penting - **Kubus**: Bangun ruang dengan enam sisi persegi yang kongruen, dua belas rusuk sama panjang, dan delapan titik sudut, tiga sisi bertemu di setiap titik sudut. - **Sisi, rusuk, titik sudut**: Persegi datar pada permukaan, tempat dua sisi bertemu, dan tempat tiga rusuk bertemu. - **Jaring-jaring**: Susunan datar persegi yang bersambung sisi ke sisi dan terlipat menjadi kubus tanpa tumpang tindih; kubus memiliki 11. - **Luas permukaan**: Jumlah luas semua sisi; untuk kubus dengan rusuk a ia 6 a kuadrat. - **Volume**: Ruang di dalam bangun ruang, diukur dalam satuan kubik; untuk kubus dengan rusuk a ia a pangkat tiga. - **Diagonal ruang**: Ruas yang menghubungkan dua titik sudut berhadapan melalui bagian dalam kubus; panjangnya a kali akar 3. - **Diagonal sisi**: Diagonal sebuah sisi persegi; panjangnya a kali akar 2. - **Irisan**: Bentuk tempat sebuah bidang mengiris bangun ruang; untuk kubus ia memiliki tiga sampai enam sisi. - **Akar pangkat tiga**: Bilangan yang pangkat tiganya adalah bilangan yang diberikan; rusuk kubus yang volumenya diberikan. - **Rumus Euler**: V dikurangi E ditambah F sama dengan 2 untuk bangun ruang tanpa lubang, dengan V titik sudut, E rusuk, dan F sisi. ## Pertanyaan yang sering diajukan ### Apa itu kubus dalam geometri? Kubus adalah bangun ruang dengan enam sisi persegi yang kongruen, dua belas rusuk sama panjang, dan delapan titik sudut, tempat tiga sisi bertemu di setiap titik sudut. Ia juga disebut heksahedron beraturan dan satu dari lima bangun ruang Platonik. ### Bagaimana mencari volume kubus? Pangkatkan tiga rusuknya: volumenya a kali a kali a, a pangkat tiga, dalam satuan kubik. Kubus dengan rusuk 3 cm memiliki volume 27 cm³. Untuk mencari rusuk dari volume, ambil akar pangkat tiga. ### Apa rumus luas permukaan kubus? Luas permukaan adalah 6 kali a kuadrat, dengan a rusuknya. Kubus memiliki enam sisi dan masing-masing adalah persegi dengan luas a kuadrat. Untuk rusuk 5 luas permukaannya 150. ### Bagaimana mencari diagonal ruang kubus? Kalikan rusuk dengan akar 3. Pythagoras pada sebuah sisi memberi diagonal sisi a kali akar 2, dan Pythagoras lagi dengan rusuk memberi d kuadrat sama dengan 3 a kuadrat. Untuk rusuk 5 diagonalnya sekitar 8,66. ### Ada berapa jaring-jaring kubus? Kubus memiliki tepat 11 jaring-jaring yang berbeda. Dari 35 cara menyambung enam persegi sisi ke sisi, 24 gagal karena blok 2 kali 2, baris lima, atau dua persegi yang mendarat di sisi yang sama. ### Apa yang terjadi pada volume kubus bila rusuk digandakan? Volume menjadi delapan kali lipat, karena 2 pangkat tiga adalah 8, sedangkan luas permukaan menjadi empat kali lipat, karena 2 kuadrat adalah 4. Secara umum, mengubah skala rusuk dengan k mengubah skala volume dengan k pangkat tiga. ### Bentuk apa yang bisa diperoleh dengan mengiris kubus? Sebuah bidang dapat mengiris kubus menjadi segitiga, segiempat seperti persegi atau persegi panjang, segilima, atau segienam, tak pernah lebih dari enam sisi. Bidang melalui pusat, tegak lurus pada diagonal ruang, memberi segienam beraturan. ### Bisakah kubus digandakan dengan jangka dan penggaris? Tidak. Menggandakan volume memerlukan rusuk dikalikan akar pangkat tiga dari 2, dan Pierre Wantzel membuktikan pada 1837 bahwa panjang itu tak dapat dikonstruksi dengan jangka dan penggaris, karena ia akar suatu persamaan kubik yang tak dapat difaktorkan. --- # Systems of Linear Equations in Two Variables: Methods and Graphs Source: https://nunada.my.id/articles/linear-systems-two-variables/ Updated: 2026-10-30 ## Quick answer **A system of two linear equations in two variables asks for the one pair $(x,y)$ that satisfies both equations, which on a graph is the point where two lines cross.** Solve it by substitution (solve one equation for a variable and put that in the other) or by elimination (add or subtract multiples of the equations so a variable cancels). The lines can cross, never meet, or coincide, giving one, no, or infinitely many solutions, and $D=a_1b_2-a_2b_1$ tells which. ### Key takeaways - A system is two conditions at once: $a_1x+b_1y=c_1$ and $a_2x+b_2y=c_2$. Each equation alone has infinitely many solutions (the points of a line); the system asks for the pair that is on both lines. - There are exactly three outcomes: the lines cross (one solution, $D\ne0$), are parallel (none, $D=0$ and the right-hand sides do not fit), or are the same line (infinitely many, $D=0$ and they fit). - Substitution is easiest when some variable has coefficient $1$ or $-1$; elimination works for every system and keeps the numbers whole: multiply so one variable has opposite coefficients, then add (or subtract when they are equal). - Elimination that ends in $0=0$ means infinitely many solutions, and one that ends in $0=5$ (any false statement) means none. Always check the answer in both original equations. - Cramer’s rule gives the answer at once when $D\ne0$: $x=\frac{c_1b_2-c_2b_1}{D}$ and $y=\frac{a_1c_2-a_2c_1}{D}$. $|D|$ is the area of the parallelogram on the coefficient vectors, so $D=0$ means the lines have the same direction. - Lines that are almost parallel make the answer extremely sensitive: for $x+y=2$ and $x+(1+\varepsilon)y=2+\delta$ the answer moves by $\delta/\varepsilon$. In double precision, $1+\varepsilon$ is exactly $1$ below about $10^{-16}$ and the solver sees $D=0$; exact fractions do not. ## What is a system of linear equations in two variables? **A system of two linear equations in two variables is a pair of equations, $a_1x+b_1y=c_1$ and $a_2x+b_2y=c_2$, that must be true at the same time; its solution is a pair of numbers $(x,y)$ that makes both true.** "Linear" means each unknown appears only to the first power and is only multiplied by a number, so each equation is a straight line. In Indonesian schools the topic is called SPLDV, short for sistem persamaan linear dua variabel. Take $x+y=10$. It has infinitely many solutions: $(0,10)$, $(4,6)$, $(5,5)$, $(6,4)$, $(10,0)$ and every other pair that adds to $10$. The equation $x-y=2$ also has infinitely many: $(2,0)$, $(3,1)$, $(6,4)$, $(8,6)$. Only one pair is on both lists, $(6,4)$, and that is the solution of the system $$\begin{cases} x+y=10 \\ x-y=2 \end{cases}$$ Check it in both equations: $6+4=10$ and $6-4=2$. Each equation on its own leaves one degree of freedom; the second one removes it, which is why two equations can pin down two unknowns. Writing a problem in words as such a pair is the skill of [turning words into algebra](https://nunada.my.id/articles/algebraic-expressions/#words-to-algebra). ## What does the graph of a system show, and how many solutions can it have? **Each equation is a line, and the solution of the system is where the two lines meet, so a system has exactly one solution, none, or infinitely many.** When $b\ne0$ the equation $ax+by=c$ is the line $y=\frac{c-ax}{b}$ with slope $-\frac ab$; when $b=0$ it is the vertical line $x=\frac ca$. Two lines in a plane can be in only three positions: | The lines | Solutions | $D=a_1b_2-a_2b_1$ | Example | |---|---|---|---| | cross at one point | exactly one | $D\ne0$ | $x+y=10$ and $x-y=2$ | | are parallel | none | $D=0$, right-hand sides do not fit | $2x+3y=6$ and $4x+6y=18$ | | are the same line | infinitely many | $D=0$, right-hand sides fit | $x+2y=4$ and $3x+6y=12$ | The number $D$ decides because two lines are parallel exactly when their slopes are equal: $-\frac{a_1}{b_1}=-\frac{a_2}{b_2}$, which after cross-multiplying is $a_1b_2=a_2b_1$, that is $D=0$. When $D=0$ the lines are either on top of each other or apart, and the right-hand sides tell which: if $c_2$ is the same multiple of $c_1$ that the other numbers are, the second equation is the first one in disguise. A school shortcut compares ratios: one solution if $\frac{a_1}{a_2}\ne\frac{b_1}{b_2}$, none if $\frac{a_1}{a_2}=\frac{b_1}{b_2}\ne\frac{c_1}{c_2}$, infinitely many if all three ratios are equal. It breaks when a coefficient is $0$ (you cannot divide by it), and $D$ never does. Type any two equations below and watch the lines. *The two equations $x+y=10$ and $x-y=2$ are two lines. They cross at one point, $(6,4)$, and that point is the only pair that lies on both lines: $6+4=10$ and $6-4=2$.* *The lines $2x+3y=6$ and $4x+6y=18$ have the same slope, $-\frac23$, and different heights where they cross the $y$-axis ($2$ and $3$). They are parallel, so no point lies on both and the system has no solution.* *The equations $x+2y=4$ and $3x+6y=12$ are the same equation, the second being the first multiplied by $3$. Their lines lie on top of each other (one is drawn dashed), so every point on the line, such as $(4,0)$, $(2,1)$ or $(0,2)$, is a solution: infinitely many.* ## How do you solve a system by substitution? **To solve by substitution, solve one equation for one variable, put that expression in the other equation, solve the resulting one-variable equation, and go back for the other variable.** Take $$\begin{cases} 2x-y=1 \\ 3x+2y=12 \end{cases}$$ 1. Solve the first equation for $y$, which has coefficient $-1$: $y=2x-1$. 2. Put that in for $y$ in the other equation: $3x+2(2x-1)=12$. 3. Expand and combine like terms ([see the rules](https://nunada.my.id/articles/algebraic-expressions/#like-terms)): $3x+4x-2=12$, so $7x=14$ and $x=2$. 4. Go back: $y=2\cdot2-1=3$. The solution is $(2,3)$. Check both equations: $2\cdot2-3=1$ and $3\cdot2+2\cdot3=12$. Two things go wrong most often. Substituting into the same equation you took the expression from only gives $0=0$ or $x=x$, since it is the same fact twice. And a missing bracket around the substituted expression changes the sum: it is $2(2x-1)$, not $2\cdot2x-1$. Substitution is at its best when a variable has coefficient $1$ or $-1$, as here. If every coefficient is bigger, isolating a variable creates fractions: in $2x+3y=12$ and $3x-2y=5$, solving the first for $x$ gives $x=6-\frac32y$, and the work is easier by elimination, next. ## How do you solve a system by elimination? **To solve by elimination, multiply the equations so one variable has coefficients of the same size, then add the equations if the coefficients have opposite signs (or subtract them if the signs are equal), so that variable cancels.** You may add equations because adding equal things to both sides of a true statement keeps it true. The easy case first, $x+y=10$ and $x-y=2$: the $y$-coefficients are already opposite, so adding gives $2x=12$, $x=6$, and the first equation gives $y=4$. When no variable cancels at once, scale the equations. For $$\begin{cases} 2x+3y=12 \\ 3x-2y=5 \end{cases}$$ make the $y$-coefficients $6$ and $-6$: multiply the first equation by $2$ and the second by $3$. $$\begin{cases} 4x+6y=24 \\ 9x-6y=15 \end{cases}$$ Adding cancels $y$: $13x=39$, so $x=3$. Put $x=3$ in the first original equation: $6+3y=12$, so $y=2$. Check the second: $3\cdot3-2\cdot2=5$. The multipliers come from the least common multiple of the two coefficients, here $6$ ([see the LCM](https://nunada.my.id/articles/integers/#gcd-lcm)); use the smallest ones, so the numbers stay small. Eliminating $x$ instead works just as well: multiply by $3$ and $2$ and subtract. Two cautions. Multiply every term of an equation, both sides included. And when you subtract an equation, change the sign of every term in it, not only the first. Try your own system, with the steps written out, below: any of the three methods, exact fractions throughout. ## What happens when a system has no solution or infinitely many? **When elimination makes every variable disappear, what is left is a statement with no unknowns: if it is true ($0=0$) the system has infinitely many solutions, and if it is false ($0=-4$) it has none.** Nothing has gone wrong; the algebra is reporting the geometry. No solution. For $2x+4y=10$ and $x+2y=7$, multiply the second by $2$ to get $2x+4y=14$ and subtract it from the first: $0=-4$. That is false for every $x$ and $y$, so no pair satisfies both: the lines are parallel. The left sides match (one is twice the other) but the right sides do not. Infinitely many solutions. For $x+2y=4$ and $3x+6y=12$, multiply the first by $3$ to get $3x+6y=12$ and subtract the second: $0=0$. That is always true, so the second equation told us nothing new: it is the first one in disguise, and every point of the line $x+2y=4$ is a solution. They can be listed by choosing $y=t$ freely: $x=4-2t$, $y=t$, giving $(4,0)$ for $t=0$, $(2,1)$ for $t=1$, $(0,2)$ for $t=2$, and so on. Do not mix the two up: $0=0$ is true, so there are many solutions; $0=5$ is false, so there are none. The same happens with substitution, where the one-variable equation turns into $0=0$ or $0=5$ instead of $7x=14$. Both of these systems are in the widget above; type them to see the working. ## What is Cramer’s rule for two equations, and why does the determinant decide? **Cramer’s rule says that when $D=a_1b_2-a_2b_1\ne0$, the solution is $x=\frac{D_x}{D}$ and $y=\frac{D_y}{D}$, with $D_x=c_1b_2-c_2b_1$ and $D_y=a_1c_2-a_2c_1$.** It is elimination done once for every system. To eliminate $y$ from $a_1x+b_1y=c_1$ and $a_2x+b_2y=c_2$, multiply the first by $b_2$ and the second by $b_1$ and subtract: $$(a_1b_2-a_2b_1)\,x=c_1b_2-c_2b_1.$$ To eliminate $x$, multiply by $a_2$ and $a_1$ and subtract the other way: $$(a_1b_2-a_2b_1)\,y=a_1c_2-a_2c_1.$$ Both equations have the same coefficient $D$ in front, so if $D\ne0$ you divide and are done; if $D=0$ you cannot divide, and that is exactly the parallel or coincident case. For $2x+3y=12$ and $3x-2y=5$: $D=2\cdot(-2)-3\cdot3=-13$, $D_x=12\cdot(-2)-5\cdot3=-39$, $D_y=2\cdot5-3\cdot12=-26$. So $x=\frac{-39}{-13}=3$ and $y=\frac{-26}{-13}=2$, as before. There is a picture behind $D$. Take the coefficients of each equation as a vector, $n_1=(a_1,b_1)$ and $n_2=(a_2,b_2)$ (each is perpendicular to its line). Then $|D|$ is the area of the parallelogram they span. If the two lines have the same direction, $n_1$ and $n_2$ are parallel, the parallelogram is flat, and $D=0$. *For $2x+3y=12$ and $3x-2y=5$, the coefficients make the vectors $n_1=(2,3)$ and $n_2=(3,-2)$. The parallelogram on them has area $|2\cdot(-2)-3\cdot3|=13$, which is $|D|$. If the two vectors pointed the same way the parallelogram would be flat, the area $0$, and the lines would have the same direction.* ## How do you solve a word problem with two unknowns? **Solve a word problem with two unknowns in five steps: name the two unknowns with their units, write one equation for each fact, solve the system, check the answer against the words of the problem, and answer in a sentence.** The equations are the hard part; the solving is the same as above. Tickets. Two adult tickets and three child tickets cost $60 in all, and one adult ticket and two child tickets cost $35. Let $x$ be the price of an adult ticket and $y$ that of a child ticket, in dollars: $$\begin{cases} 2x+3y=60 \\ x+2y=35 \end{cases}$$ Multiply the second by $2$ to get $2x+4y=70$, subtract the first: $y=10$. Then $x=35-2\cdot10=15$. An adult ticket costs $15 and a child ticket $10. Check in words: $2\cdot15+3\cdot10=60$ and $15+2\cdot10=35$. Ages. A father and his son are $40$ years old together, and the father is three times as old as the son. With $x$ the father’s age and $y$ the son’s: $x+y=40$ and $x=3y$. This is made for substitution: $3y+y=40$, so $y=10$ and $x=30$. A boat on a river. A boat goes $18$ km/h with the current and $12$ km/h against it. If $x$ is the speed of the boat in still water and $y$ the speed of the current, then $x+y=18$ and $x-y=12$. Adding gives $2x=30$, so the boat does $15$ km/h and the current is $3$ km/h. The most common slip is writing both equations about the same fact. Each equation should use a different piece of information; if the second could be got from the first, you will meet $0=0$. And always check against the story: an age of $-3$ or a price of $0.5$ people may be a clue that an equation was set up wrongly. ## Which method should you choose for a system of equations? **Use substitution when a variable has coefficient $1$ or $-1$, elimination when the coefficients are larger, Cramer’s rule when you want a formula or a program, and the graph to see the three outcomes.** All four give the same answer. | Method | Best when | Watch out | |---|---|---| | Graph | you want to see how many solutions there are | reading $(\frac{31}{11},\frac5{11})$ off a grid is guesswork | | Substitution | one variable has coefficient $1$ or $-1$ | fractions appear if you isolate a bigger coefficient | | Elimination | the coefficients are bigger, or the system is large | multiply every term; subtract all of the signs | | Cramer’s rule | writing a formula or a program | $D=0$ means no formula: test it exactly | For three or more unknowns, elimination is the one that grows into Gaussian elimination, the method behind every serious linear solver, and Cramer’s rule becomes very slow. The square roots, fractions and decimals that can appear in the answers are handled the usual way: leave the exact fraction as long as you can ([fractions](https://nunada.my.id/articles/rational-numbers/#add-subtract-fractions)) and round only at the end. ## Why do nearly parallel lines make a computer give the wrong answer? **When two lines are nearly parallel, a tiny change in one number moves their crossing point a long way, so the system is ill-conditioned and a computer, which stores numbers with tiny errors, can return a badly wrong answer or none at all.** Take $$\begin{cases} x+y=2 \\ x+(1+\varepsilon)\,y=2+\delta \end{cases}$$ with $\varepsilon$ small. Subtract the first from the second: $\varepsilon y=\delta$, so $y=\frac{\delta}{\varepsilon}$ and $x=2-\frac\delta\varepsilon$. With $\delta=0$ the answer is $(2,0)$. With $\varepsilon=10^{-6}$ and a nudge of only $\delta=10^{-9}$ in one right-hand side, $y$ becomes $10^{-3}$: a change in the ninth decimal place of one number appears in the third of the answer. The amplification is $\frac1\varepsilon$ and the condition number of the coefficients, which measures how much any change can be magnified, is about $\frac4\varepsilon$. A computer adds a second problem. $D=a_1b_2-a_2b_1$ subtracts two products that are nearly equal, which is [cancellation](https://nunada.my.id/articles/floating-point-numbers/#cancellation), and in double precision $1+\varepsilon$ is exactly $1$ once $\varepsilon$ is below about $10^{-16}$: both equations look identical, $D$ comes out exactly $0$, and a solver reports "singular" or divides by zero. Move the sliders below to see the exact answer, the double-precision answer, and where the computer gives up. What helps: for a system you build by hand from whole numbers or fractions, use exact arithmetic (Python’s `Fraction` never loses the $\varepsilon$); never test `D == 0` on numbers that came from measurements, compare with a tolerance; and for real data use a solver that pivots and report the residual and the condition number, remembering that a tiny residual does not prove a small error when the condition number is huge. ## How do you solve a system of equations in a program? **A program solves a two-variable system with Cramer’s rule in a few lines: compute $D$, divide when it is not zero, and otherwise decide between "no solution" and "infinitely many" from the right-hand sides.** For whole numbers do everything in integers and fractions, so that $\frac{31}{11}$ stays exact. The three programs below print the same four systems from this article, the last two being parallel and the same line, and then show the nearly parallel trap: $1\cdot(1+10^{-16})-1\cdot1$ is exactly $0$ in double precision, while Python’s exact fractions still find the answer $(1,1)$. ```python from fractions import Fraction def solve2(a1, b1, c1, a2, b2, c2): """a1 x + b1 y = c1 and a2 x + b2 y = c2, exactly. Each equation must contain x or y.""" a1, b1, c1, a2, b2, c2 = (Fraction(v) for v in (a1, b1, c1, a2, b2, c2)) D = a1 * b2 - a2 * b1 if D != 0: return 'one', (c1 * b2 - c2 * b1) / D, (a1 * c2 - a2 * c1) / D # D = 0: the lines have the same direction; they are one line when the right-hand sides fit as well if a1 * c2 == a2 * c1 and b1 * c2 == b2 * c1: return 'line', None, None return 'none', None, None def describe(*system): kind, x, y = solve2(*system) if kind == 'one': return f'x = {x}; y = {y}' return 'infinitely many solutions' if kind == 'line' else 'no solution' print(describe(1, 1, 10, 1, -1, 2)) # x = 6; y = 4 print(describe(2, 3, 7, 1, -4, 1)) # x = 31/11; y = 5/11 print(describe(2, 3, 6, 4, 6, 18)) # no solution print(describe(1, 2, 4, 3, 6, 12)) # infinitely many solutions # nearly parallel lines: x + y = 2 and x + (1 + e) y = 2 + e, whose exact answer is (1, 1) e = 1e-16 print(1 * (1 + e) - 1 * 1) # 0.0: in doubles the two equations are the same tiny = Fraction(1, 10**16) print(describe(1, 1, 2, 1, 1 + tiny, 2 + tiny)) # x = 1; y = 1 ``` ```javascript const gcd = (a, b) => (b === 0 ? Math.abs(a) : gcd(b, a % b)) // n / d in lowest terms, as text const frac = (n, d) => { const g = gcd(n, d) * Math.sign(d) return `${n / g}${d / g === 1 ? '' : '/' + d / g}` } function solve2(a1, b1, c1, a2, b2, c2) { const D = a1 * b2 - a2 * b1 if (D !== 0) return `x = ${frac(c1 * b2 - c2 * b1, D)}; y = ${frac(a1 * c2 - a2 * c1, D)}` // D = 0: one line when the right-hand sides fit as well, else parallel const same = a1 * c2 === a2 * c1 && b1 * c2 === b2 * c1 return same ? 'infinitely many solutions' : 'no solution' } solve2(1, 1, 10, 1, -1, 2) // 'x = 6; y = 4' solve2(2, 3, 7, 1, -4, 1) // 'x = 31/11; y = 5/11' solve2(2, 3, 6, 4, 6, 18) // 'no solution' solve2(1, 2, 4, 3, 6, 12) // 'infinitely many solutions' // nearly parallel lines: in doubles, 1 + 1e-16 is exactly 1 const e = 1e-16 1 * (1 + e) - 1 * 1 // 0 ``` ```cpp #include #include using namespace std; int gcd(int a, int b) { return b == 0 ? (a < 0 ? -a : a) : gcd(b, a % b); } // prints n / d in lowest terms void printFraction(int n, int d) { int g = gcd(n, d); if (d < 0) g = -g; n = n / g; d = d / g; if (d == 1) printf("%d", n); else printf("%d/%d", n, d); } void solve2(int a1, int b1, int c1, int a2, int b2, int c2) { int D = a1 * b2 - a2 * b1; if (D != 0) { printf("x = "); printFraction(c1 * b2 - c2 * b1, D); printf("; y = "); printFraction(a1 * c2 - a2 * c1, D); printf("\n"); } else if (a1 * c2 == a2 * c1 && b1 * c2 == b2 * c1) { printf("infinitely many solutions\n"); } else { printf("no solution\n"); } } int main() { solve2(1, 1, 10, 1, -1, 2); solve2(2, 3, 7, 1, -4, 1); solve2(2, 3, 6, 4, 6, 18); solve2(1, 2, 4, 3, 6, 12); double e = 1e-16; printf("%.1f\n", 1 * (1 + e) - 1 * 1); return 0; } /* output: x = 6; y = 4 x = 31/11; y = 5/11 no solution infinitely many solutions 0.0 */ ``` ## Where do systems of equations come from? **Systems of linear equations are among the oldest problems in mathematics, and the method of elimination is older than the notation we use for it.** - **From about 1800 BCE.** Clay tablets from Babylon pose problems that amount to two linear equations in two unknowns, such as two fields whose areas and combined yield are known, and solve them with rules that come to elimination. - **By the 1st century CE.** The Chinese Nine Chapters on the Mathematical Art devotes its eighth chapter, fangcheng ("rectangular arrays"), to systems of several equations, solved by an elimination procedure on arrays of numbers laid out with counting rods, the same steps as Gaussian elimination. - **1557.** Robert Recorde writes the first equals sign, $=$, "bicause noe 2 thynges can be moare equalle" than two parallel lines of the same length. - **1707 and 1750.** Newton’s lectures, published in 1707, describe elimination for several unknowns, and Gabriel Cramer publishes, in 1750, the determinant rule that carries his name (Colin Maclaurin had found it for two and three unknowns a little earlier). - **Early 19th century.** Gauss uses the systematic elimination for his least-squares calculations, which is why it is called Gaussian elimination; it is the ancestor of the solvers in every numerical library today. ## What are the common mistakes with systems of equations? **The most common mistakes with systems of equations are the nine below, each with the correct statement.** | Mistake | Correct | |---|---| | ❌ Substitute the expression into the same equation it came from | That gives $0=0$ or $x=x$: put it into the other equation. | | ❌ Multiply only one term, or one side, when scaling an equation | Multiply every term on both sides, or the equation is no longer the same one. | | ❌ Add when the coefficients have the same sign and expect it to cancel | Opposite signs: add. Equal signs: subtract. Check that the variable is gone. | | ❌ $(3x+2y)-(x-y)=2x+y$ | Subtracting changes every sign: $(3x+2y)-(x-y)=2x+3y$. | | ❌ Find $x$ and stop | A solution is a pair: go back for the other variable. | | ❌ Check the answer in one equation only | Check both: $(0,10)$ fits $x+y=10$ but not $x-y=2$. | | ❌ $0=0$ means no solution, $0=5$ means infinitely many | The other way round: $0=0$ is true (infinitely many); $0=5$ is false (none). | | ❌ The answer must be whole numbers | It often is not: $2x+3y=7$ and $x-4y=1$ give $(\frac{31}{11},\frac5{11})$. | | ❌ Test $D==0$ on floating-point numbers | Rounding hides or invents zeros: use exact numbers, or compare with a tolerance. | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: systems of linear equations at a glance - **System:** $a_1x+b_1y=c_1$ and $a_2x+b_2y=c_2$ at once; the solution is the pair $(x,y)$ on both lines. - **Three outcomes:** cross (one solution, $D\ne0$), parallel (none), same line (infinitely many); for the last two $D=0$. - **Substitution:** isolate a variable (best with coefficient $\pm1$), put it in the other equation, solve, go back. - **Elimination:** scale so a variable has opposite coefficients, add (subtract if equal), solve, go back; $0=0$ means infinitely many, $0=5$ means none. - **Cramer:** $x=\frac{c_1b_2-c_2b_1}{D}$, $y=\frac{a_1c_2-a_2c_1}{D}$; $|D|$ is the area on the coefficient vectors. - **Word problems:** name the unknowns, one equation per fact, solve, check in the story, answer in a sentence. - **Numerics:** nearly parallel lines amplify errors by about $\frac1\varepsilon$; double precision sees $D=0$ below $10^{-16}$; use exact fractions for exact data. ## Glossary: key terms - **System of linear equations**: Two or more linear equations that must all be true at once; with two unknowns, two lines. - **Solution of a system**: The pair of numbers x and y that makes every equation of the system true; the point where the lines meet. - **Substitution**: Solving one equation for a variable and putting that expression into the other equation. - **Elimination**: Adding or subtracting multiples of the equations so that one variable cancels. - **Determinant of a 2 by 2 system**: The number a1 b2 minus a2 b1; the system has exactly one solution when it is not zero. - **Cramer’s rule**: The formulas x equals Dx over D and y equals Dy over D that solve a system when D is not zero. - **Parallel lines**: Lines with the same slope that never meet; a system of two of them has no solution. - **Coincident lines**: Two equations describing the same line; every point of it is a solution. - **Ill-conditioned system**: A system whose answer changes a lot when the numbers change a little, as with nearly parallel lines. - **Condition number**: A number that says how many times a change in the data can be magnified in the answer; it is large for nearly parallel lines. ## Frequently asked questions ### What is a system of linear equations in two variables? It is two linear equations, a1 x plus b1 y equals c1 and a2 x plus b2 y equals c2, that must hold at the same time. Its solution is the pair x and y that satisfies both, which on a graph is the point where the two lines cross. ### How do you solve a system of equations by substitution? Solve one equation for one variable, put that expression into the other equation, solve the equation that now has one variable, and substitute back to get the other. Then check the pair in both original equations. ### How do you solve a system of equations by elimination? Multiply the equations so one variable has coefficients of the same size, then add them if the signs are opposite or subtract them if equal, so that variable cancels. Solve for the other, then go back for the first. ### How can you tell whether a system has no solution or infinitely many? Look at D, a1 b2 minus a2 b1. If D is not zero there is one solution. If D is zero the lines have the same direction: they are the same line, with infinitely many solutions, when the right sides fit too, and parallel, with none, when they do not. ### What does the solution of a system mean on a graph? Each equation is a line, and every point of a line satisfies its equation. The solution of the system is therefore the point that lies on both lines, their intersection. Parallel lines have none, and identical lines share all their points. ### What is Cramer’s rule for two equations? When D, a1 b2 minus a2 b1, is not zero, x equals Dx over D and y equals Dy over D, where Dx is c1 b2 minus c2 b1 and Dy is a1 c2 minus a2 c1. It is elimination carried out once for every system. ### How do you solve a word problem with two unknowns? Name the two unknowns with their units, write one equation for each different fact in the problem, solve the system by substitution or elimination, and check the answer against the story before answering in a sentence. ### Why do nearly parallel lines make a computer solver unreliable? Their crossing point moves a long way when a number changes slightly, so tiny rounding errors are magnified, and in double precision two very close slopes can become identical, giving a determinant of exactly zero. Exact fractions avoid this for exact data. --- # Sistem Persamaan Linear Dua Variabel (SPLDV): Metode dan Grafik Source: https://nunada.my.id/artikel/sistem-persamaan-linear-dua-variabel/ Updated: 2026-10-30 ## Jawaban singkat **Sistem dua persamaan linear dengan dua variabel mencari satu pasangan $(x,y)$ yang memenuhi kedua persamaan, yang pada grafik adalah titik tempat dua garis berpotongan.** Selesaikan dengan substitusi (selesaikan satu persamaan untuk sebuah variabel lalu masukkan ke yang lain) atau eliminasi (jumlahkan atau kurangkan kelipatan persamaan agar sebuah variabel habis). Kedua garis dapat berpotongan, tak bertemu, atau berimpit, memberi satu, tidak ada, atau tak terhingga penyelesaian, dan $D=a_1b_2-a_2b_1$ menentukan yang mana. ### Poin penting - Sistem adalah dua syarat sekaligus: $a_1x+b_1y=c_1$ dan $a_2x+b_2y=c_2$. Tiap persamaan sendirian memiliki tak terhingga penyelesaian (titik-titik sebuah garis); sistem meminta pasangan yang berada di kedua garis. - Hanya ada tiga kemungkinan: garis berpotongan (satu penyelesaian, $D\ne0$), sejajar (tidak ada, $D=0$ dan ruas kanan tidak cocok), atau garis yang sama (tak terhingga, $D=0$ dan cocok). - Substitusi paling mudah bila ada variabel berkoefisien $1$ atau $-1$; eliminasi berlaku untuk semua sistem dan menjaga bilangan tetap bulat: kalikan agar satu variabel berkoefisien berlawanan, lalu jumlahkan (atau kurangkan bila sama). - Eliminasi yang berakhir pada $0=0$ berarti tak terhingga penyelesaian, dan yang berakhir pada $0=5$ (pernyataan salah apa pun) berarti tidak ada. Selalu periksa jawaban di kedua persamaan semula. - Aturan Cramer memberi jawabannya sekaligus bila $D\ne0$: $x=\frac{c_1b_2-c_2b_1}{D}$ dan $y=\frac{a_1c_2-a_2c_1}{D}$. $|D|$ adalah luas jajar genjang pada vektor koefisien, sehingga $D=0$ berarti kedua garis berarah sama. - Garis yang hampir sejajar membuat jawaban sangat peka: untuk $x+y=2$ dan $x+(1+\varepsilon)y=2+\delta$ jawabannya bergeser sebesar $\delta/\varepsilon$. Dalam presisi ganda, $1+\varepsilon$ tepat $1$ di bawah sekitar $10^{-16}$ dan penyelesai melihat $D=0$; pecahan eksak tidak. ## Apa itu sistem persamaan linear dua variabel (SPLDV)? **Sistem dua persamaan linear dengan dua variabel adalah sepasang persamaan, $a_1x+b_1y=c_1$ dan $a_2x+b_2y=c_2$, yang harus benar sekaligus; penyelesaiannya adalah pasangan bilangan $(x,y)$ yang membuat keduanya benar.** "Linear" berarti tiap bilangan tak diketahui hanya berpangkat satu dan hanya dikalikan bilangan, sehingga tiap persamaan adalah garis lurus. Di sekolah di Indonesia topik ini disebut SPLDV, singkatan dari sistem persamaan linear dua variabel. Ambil $x+y=10$. Ia punya tak terhingga penyelesaian: $(0,10)$, $(4,6)$, $(5,5)$, $(6,4)$, $(10,0)$, dan setiap pasangan lain yang berjumlah $10$. Persamaan $x-y=2$ juga punya tak terhingga: $(2,0)$, $(3,1)$, $(6,4)$, $(8,6)$. Hanya satu pasangan yang ada di kedua daftar, $(6,4)$, dan itulah penyelesaian sistem $$\begin{cases} x+y=10 \\ x-y=2 \end{cases}$$ Periksa di kedua persamaan: $6+4=10$ dan $6-4=2$. Tiap persamaan sendirian menyisakan satu derajat kebebasan; persamaan kedua menghilangkannya, itulah sebabnya dua persamaan dapat memastikan dua bilangan tak diketahui. Menuliskan soal cerita sebagai pasangan seperti itu adalah keterampilan [mengubah kalimat menjadi aljabar](https://nunada.my.id/artikel/bentuk-aljabar/#words-to-algebra). ## Apa yang ditunjukkan grafik sistem, dan berapa banyak penyelesaian yang mungkin? **Tiap persamaan adalah garis, dan penyelesaian sistem adalah tempat kedua garis bertemu, sehingga sistem punya tepat satu penyelesaian, tidak ada, atau tak terhingga.** Bila $b\ne0$ persamaan $ax+by=c$ adalah garis $y=\frac{c-ax}{b}$ dengan kemiringan $-\frac ab$; bila $b=0$ ia garis tegak $x=\frac ca$. Dua garis di bidang hanya dapat berada pada tiga posisi: | Kedua garis | Penyelesaian | $D=a_1b_2-a_2b_1$ | Contoh | |---|---|---|---| | berpotongan di satu titik | tepat satu | $D\ne0$ | $x+y=10$ dan $x-y=2$ | | sejajar | tidak ada | $D=0$, ruas kanan tidak cocok | $2x+3y=6$ dan $4x+6y=18$ | | garis yang sama | tak terhingga | $D=0$, ruas kanan cocok | $x+2y=4$ dan $3x+6y=12$ | Bilangan $D$ menentukan karena dua garis sejajar tepat ketika kemiringannya sama: $-\frac{a_1}{b_1}=-\frac{a_2}{b_2}$, yang setelah dikali silang menjadi $a_1b_2=a_2b_1$, yaitu $D=0$. Bila $D=0$ kedua garis saling menumpuk atau berjauhan, dan ruas kanan yang memberi tahu mana: bila $c_2$ adalah kelipatan $c_1$ yang sama dengan kelipatan bilangan lainnya, persamaan kedua adalah persamaan pertama yang menyamar. Jalan pintas di sekolah membandingkan rasio: satu penyelesaian bila $\frac{a_1}{a_2}\ne\frac{b_1}{b_2}$, tidak ada bila $\frac{a_1}{a_2}=\frac{b_1}{b_2}\ne\frac{c_1}{c_2}$, tak terhingga bila ketiga rasio sama. Ia gagal bila ada koefisien $0$ (tak dapat dibagi), dan $D$ tak pernah gagal. Ketik dua persamaan mana pun di bawah dan lihat garisnya. *Dua persamaan $x+y=10$ dan $x-y=2$ adalah dua garis. Keduanya berpotongan di satu titik, $(6,4)$, dan titik itu satu-satunya pasangan yang terletak pada kedua garis: $6+4=10$ dan $6-4=2$.* *Garis $2x+3y=6$ dan $4x+6y=18$ memiliki kemiringan yang sama, $-\frac23$, dan tinggi yang berbeda di sumbu $y$ ($2$ dan $3$). Keduanya sejajar, sehingga tak ada titik yang terletak pada keduanya dan sistem itu tidak memiliki penyelesaian.* *Persamaan $x+2y=4$ dan $3x+6y=12$ adalah persamaan yang sama, yang kedua adalah yang pertama dikalikan $3$. Garisnya saling menumpuk (satu digambar putus-putus), sehingga setiap titik pada garis itu, seperti $(4,0)$, $(2,1)$, atau $(0,2)$, adalah penyelesaian: tak terhingga banyaknya.* ## Bagaimana menyelesaikan sistem dengan metode substitusi? **Untuk menyelesaikan dengan substitusi, selesaikan satu persamaan untuk satu variabel, masukkan ungkapan itu ke persamaan lain, selesaikan persamaan satu variabel yang dihasilkan, lalu kembali mencari variabel yang lain.** Ambil $$\begin{cases} 2x-y=1 \\ 3x+2y=12 \end{cases}$$ 1. Selesaikan persamaan pertama untuk $y$, yang berkoefisien $-1$: $y=2x-1$. 2. Masukkan itu sebagai $y$ ke persamaan yang lain: $3x+2(2x-1)=12$. 3. Jabarkan dan gabungkan suku sejenis ([lihat aturannya](https://nunada.my.id/artikel/bentuk-aljabar/#like-terms)): $3x+4x-2=12$, sehingga $7x=14$ dan $x=2$. 4. Kembali: $y=2\cdot2-1=3$. Penyelesaiannya $(2,3)$. Periksa kedua persamaan: $2\cdot2-3=1$ dan $3\cdot2+2\cdot3=12$. Dua hal paling sering salah. Memasukkan ke persamaan yang sama dengan asal ungkapan itu hanya menghasilkan $0=0$ atau $x=x$, karena itu fakta yang sama dua kali. Dan kurung yang hilang di sekitar ungkapan yang dimasukkan mengubah jumlahnya: yang benar $2(2x-1)$, bukan $2\cdot2x-1$. Substitusi paling baik bila ada variabel berkoefisien $1$ atau $-1$, seperti di sini. Bila semua koefisien lebih besar, mengisolasi sebuah variabel menimbulkan pecahan: pada $2x+3y=12$ dan $3x-2y=5$, menyelesaikan yang pertama untuk $x$ memberi $x=6-\frac32y$, dan pekerjaan lebih mudah dengan eliminasi, berikut. ## Bagaimana menyelesaikan sistem dengan metode eliminasi? **Untuk menyelesaikan dengan eliminasi, kalikan persamaan agar satu variabel memiliki koefisien yang sama besar, lalu jumlahkan persamaan bila koefisiennya berlawanan tanda (atau kurangkan bila tandanya sama), sehingga variabel itu habis.** Persamaan boleh dijumlahkan karena menambah hal yang sama pada kedua ruas pernyataan yang benar menjaganya tetap benar. Kasus mudah dulu, $x+y=10$ dan $x-y=2$: koefisien $y$ sudah berlawanan, jadi penjumlahan memberi $2x=12$, $x=6$, dan persamaan pertama memberi $y=4$. Bila tak ada variabel yang habis sekaligus, ubah skala persamaan. Untuk $$\begin{cases} 2x+3y=12 \\ 3x-2y=5 \end{cases}$$ buat koefisien $y$ menjadi $6$ dan $-6$: kalikan persamaan pertama dengan $2$ dan yang kedua dengan $3$. $$\begin{cases} 4x+6y=24 \\ 9x-6y=15 \end{cases}$$ Menjumlahkan menghabiskan $y$: $13x=39$, sehingga $x=3$. Masukkan $x=3$ ke persamaan pertama semula: $6+3y=12$, sehingga $y=2$. Periksa yang kedua: $3\cdot3-2\cdot2=5$. Pengalinya berasal dari kelipatan persekutuan terkecil kedua koefisien, di sini $6$ ([lihat KPK](https://nunada.my.id/artikel/bilangan-bulat/#gcd-lcm)); pakai yang terkecil, agar bilangan tetap kecil. Mengeliminasi $x$ sebagai gantinya sama baiknya: kalikan dengan $3$ dan $2$ lalu kurangkan. Dua kewaspadaan. Kalikan setiap suku persamaan, kedua ruas termasuk. Dan saat mengurangkan sebuah persamaan, ubah tanda setiap suku di dalamnya, bukan hanya yang pertama. Cobalah sistemmu sendiri, dengan langkah-langkah yang ditulis, di bawah: salah satu dari tiga metode, dengan pecahan eksak sepanjang jalan. ## Apa yang terjadi bila sistem tidak punya penyelesaian atau punya tak terhingga? **Bila eliminasi menghabiskan setiap variabel, yang tersisa adalah pernyataan tanpa bilangan tak diketahui: bila benar ($0=0$) sistem punya tak terhingga penyelesaian, dan bila salah ($0=-4$) ia tidak punya.** Tak ada yang keliru; aljabar sedang melaporkan geometrinya. Tanpa penyelesaian. Untuk $2x+4y=10$ dan $x+2y=7$, kalikan yang kedua dengan $2$ untuk mendapat $2x+4y=14$ dan kurangkan dari yang pertama: $0=-4$. Itu salah untuk setiap $x$ dan $y$, sehingga tak ada pasangan yang memenuhi keduanya: garisnya sejajar. Ruas kirinya cocok (satu dua kali yang lain) tetapi ruas kanannya tidak. Tak terhingga penyelesaian. Untuk $x+2y=4$ dan $3x+6y=12$, kalikan yang pertama dengan $3$ untuk mendapat $3x+6y=12$ dan kurangkan yang kedua: $0=0$. Itu selalu benar, jadi persamaan kedua tak memberi hal baru: ia persamaan pertama yang menyamar, dan setiap titik pada garis $x+2y=4$ adalah penyelesaian. Mereka dapat didaftar dengan memilih $y=t$ bebas: $x=4-2t$, $y=t$, memberi $(4,0)$ untuk $t=0$, $(2,1)$ untuk $t=1$, $(0,2)$ untuk $t=2$, dan seterusnya. Jangan tertukar: $0=0$ benar, sehingga ada banyak penyelesaian; $0=5$ salah, sehingga tidak ada. Hal yang sama terjadi pada substitusi, tempat persamaan satu variabel berubah menjadi $0=0$ atau $0=5$ alih-alih $7x=14$. Kedua sistem itu ada di widget di atas; ketik untuk melihat pengerjaannya. ## Apa aturan Cramer untuk dua persamaan, dan mengapa determinan yang menentukan? **Aturan Cramer mengatakan bahwa bila $D=a_1b_2-a_2b_1\ne0$, penyelesaiannya $x=\frac{D_x}{D}$ dan $y=\frac{D_y}{D}$, dengan $D_x=c_1b_2-c_2b_1$ dan $D_y=a_1c_2-a_2c_1$.** Ia adalah eliminasi yang dikerjakan sekali untuk setiap sistem. Untuk mengeliminasi $y$ dari $a_1x+b_1y=c_1$ dan $a_2x+b_2y=c_2$, kalikan yang pertama dengan $b_2$ dan yang kedua dengan $b_1$ lalu kurangkan: $$(a_1b_2-a_2b_1)\,x=c_1b_2-c_2b_1.$$ Untuk mengeliminasi $x$, kalikan dengan $a_2$ dan $a_1$ lalu kurangkan dengan arah sebaliknya: $$(a_1b_2-a_2b_1)\,y=a_1c_2-a_2c_1.$$ Kedua persamaan memiliki koefisien yang sama $D$ di depannya, sehingga bila $D\ne0$ kamu membagi dan selesai; bila $D=0$ kamu tak dapat membagi, dan itu tepat kasus sejajar atau berimpit. Untuk $2x+3y=12$ dan $3x-2y=5$: $D=2\cdot(-2)-3\cdot3=-13$, $D_x=12\cdot(-2)-5\cdot3=-39$, $D_y=2\cdot5-3\cdot12=-26$. Jadi $x=\frac{-39}{-13}=3$ dan $y=\frac{-26}{-13}=2$, seperti sebelumnya. Ada gambar di balik $D$. Ambil koefisien tiap persamaan sebagai vektor, $n_1=(a_1,b_1)$ dan $n_2=(a_2,b_2)$ (masing-masing tegak lurus pada garisnya). Maka $|D|$ adalah luas jajar genjang yang direntangkannya. Bila kedua garis berarah sama, $n_1$ dan $n_2$ sejajar, jajar genjangnya pipih, dan $D=0$. *Untuk $2x+3y=12$ dan $3x-2y=5$, koefisiennya membentuk vektor $n_1=(2,3)$ dan $n_2=(3,-2)$. Jajar genjang pada keduanya memiliki luas $|2\cdot(-2)-3\cdot3|=13$, yaitu $|D|$. Bila kedua vektor searah, jajar genjangnya pipih, luasnya $0$, dan kedua garis berarah sama.* ## Bagaimana menyelesaikan soal cerita dengan dua bilangan tak diketahui? **Selesaikan soal cerita dengan dua bilangan tak diketahui dalam lima langkah: namai kedua bilangan tak diketahui beserta satuannya, tulis satu persamaan untuk tiap fakta, selesaikan sistemnya, periksa jawaban terhadap kata-kata soal, dan jawab dengan satu kalimat.** Persamaannya bagian yang sulit; menyelesaikannya sama seperti di atas. Tiket. Dua tiket dewasa dan tiga tiket anak harganya Rp60.000 seluruhnya, dan satu tiket dewasa dan dua tiket anak Rp35.000. Misalkan $x$ harga tiket dewasa dan $y$ harga tiket anak, dalam ribu rupiah: $$\begin{cases} 2x+3y=60 \\ x+2y=35 \end{cases}$$ Kalikan yang kedua dengan $2$ untuk mendapat $2x+4y=70$, kurangkan yang pertama: $y=10$. Lalu $x=35-2\cdot10=15$. Tiket dewasa Rp15.000 dan tiket anak Rp10.000. Periksa dalam kata-kata: $2\cdot15+3\cdot10=60$ dan $15+2\cdot10=35$. Umur. Seorang ayah dan anaknya berumur $40$ tahun bersama-sama, dan umur ayah tiga kali umur anaknya. Dengan $x$ umur ayah dan $y$ umur anak: $x+y=40$ dan $x=3y$. Ini cocok untuk substitusi: $3y+y=40$, sehingga $y=10$ dan $x=30$. Perahu di sungai. Sebuah perahu melaju $18$ km/jam searah arus dan $12$ km/jam melawan arus. Bila $x$ kecepatan perahu di air tenang dan $y$ kecepatan arus, maka $x+y=18$ dan $x-y=12$. Menjumlahkan memberi $2x=30$, sehingga perahu melaju $15$ km/jam dan arusnya $3$ km/jam. Kekeliruan paling umum adalah menulis kedua persamaan tentang fakta yang sama. Tiap persamaan harus memakai informasi yang berbeda; bila yang kedua dapat diperoleh dari yang pertama, kamu akan bertemu $0=0$. Dan selalu periksa terhadap ceritanya: umur $-3$ atau harga $0{,}5$ orang bisa menjadi petunjuk bahwa sebuah persamaan disusun salah. ## Metode mana yang sebaiknya dipilih untuk sistem persamaan? **Pakai substitusi bila ada variabel berkoefisien $1$ atau $-1$, eliminasi bila koefisiennya lebih besar, aturan Cramer bila kamu ingin rumus atau program, dan grafik untuk melihat ketiga kemungkinan.** Keempatnya memberi jawaban yang sama. | Metode | Terbaik bila | Waspadai | |---|---|---| | Grafik | ingin melihat berapa banyak penyelesaian | membaca $(\frac{31}{11},\frac5{11})$ dari kisi hanyalah tebakan | | Substitusi | satu variabel berkoefisien $1$ atau $-1$ | pecahan muncul bila mengisolasi koefisien yang lebih besar | | Eliminasi | koefisien lebih besar, atau sistemnya besar | kalikan setiap suku; kurangkan semua tandanya | | Aturan Cramer | menulis rumus atau program | $D=0$ berarti tak ada rumus: ujilah secara eksak | Untuk tiga bilangan tak diketahui atau lebih, eliminasi adalah yang berkembang menjadi eliminasi Gauss, metode di balik setiap penyelesai linear yang serius, dan aturan Cramer menjadi sangat lambat. Pecahan dan desimal yang dapat muncul pada jawaban ditangani seperti biasa: biarkan pecahan eksak selama mungkin ([pecahan](https://nunada.my.id/artikel/bilangan-rasional/#add-subtract-fractions)) dan bulatkan hanya di akhir. ## Mengapa garis yang hampir sejajar membuat komputer memberi jawaban yang salah? **Bila dua garis hampir sejajar, perubahan kecil pada satu bilangan memindahkan titik potongnya jauh sekali, sehingga sistem itu berkondisi buruk dan komputer, yang menyimpan bilangan dengan galat kecil, dapat memberi jawaban yang sangat salah atau tidak ada sama sekali.** Ambil $$\begin{cases} x+y=2 \\ x+(1+\varepsilon)\,y=2+\delta \end{cases}$$ dengan $\varepsilon$ kecil. Kurangkan yang pertama dari yang kedua: $\varepsilon y=\delta$, sehingga $y=\frac{\delta}{\varepsilon}$ dan $x=2-\frac\delta\varepsilon$. Dengan $\delta=0$ jawabannya $(2,0)$. Dengan $\varepsilon=10^{-6}$ dan geseran hanya $\delta=10^{-9}$ pada satu ruas kanan, $y$ menjadi $10^{-3}$: perubahan di desimal kesembilan satu bilangan muncul di desimal ketiga jawabannya. Faktor pembesarannya $\frac1\varepsilon$ dan bilangan kondisi koefisien, yang mengukur seberapa besar perubahan apa pun dapat dibesarkan, sekitar $\frac4\varepsilon$. Komputer menambah masalah kedua. $D=a_1b_2-a_2b_1$ mengurangkan dua hasil kali yang hampir sama, yaitu [pembatalan](https://nunada.my.id/artikel/bilangan-floating-point/#cancellation), dan dalam presisi ganda $1+\varepsilon$ tepat $1$ begitu $\varepsilon$ di bawah sekitar $10^{-16}$: kedua persamaan tampak identik, $D$ keluar tepat $0$, dan penyelesai melaporkan "singular" atau membagi dengan nol. Geser penggeser di bawah untuk melihat jawaban eksak, jawaban presisi ganda, dan tempat komputer menyerah. Yang membantu: untuk sistem yang kamu susun sendiri dari bilangan bulat atau pecahan, pakai aritmetika eksak (`Fraction` Python tak pernah kehilangan $\varepsilon$); jangan pernah menguji `D == 0` pada bilangan yang berasal dari pengukuran, bandingkan dengan toleransi; dan untuk data nyata pakai penyelesai yang melakukan pivot dan laporkan residu serta bilangan kondisinya, dengan mengingat bahwa residu yang kecil tidak membuktikan galat yang kecil bila bilangan kondisinya sangat besar. ## Bagaimana menyelesaikan sistem persamaan dalam program? **Program menyelesaikan sistem dua variabel dengan aturan Cramer dalam beberapa baris: hitung $D$, bagi bila tidak nol, dan bila nol tentukan antara "tidak ada penyelesaian" dan "tak terhingga" dari ruas kanannya.** Untuk bilangan bulat kerjakan semuanya dalam bilangan bulat dan pecahan, agar $\frac{31}{11}$ tetap eksak. Ketiga program di bawah mencetak empat sistem yang sama dari artikel ini, dua yang terakhir sejajar dan garis yang sama, lalu memperlihatkan jebakan hampir sejajar: $1\cdot(1+10^{-16})-1\cdot1$ tepat $0$ dalam presisi ganda, sedangkan pecahan eksak Python masih menemukan jawaban $(1,1)$. ```python from fractions import Fraction def solve2(a1, b1, c1, a2, b2, c2): """a1 x + b1 y = c1 and a2 x + b2 y = c2, exactly. Each equation must contain x or y.""" a1, b1, c1, a2, b2, c2 = (Fraction(v) for v in (a1, b1, c1, a2, b2, c2)) D = a1 * b2 - a2 * b1 if D != 0: return 'one', (c1 * b2 - c2 * b1) / D, (a1 * c2 - a2 * c1) / D # D = 0: the lines have the same direction; they are one line when the right-hand sides fit as well if a1 * c2 == a2 * c1 and b1 * c2 == b2 * c1: return 'line', None, None return 'none', None, None def describe(*system): kind, x, y = solve2(*system) if kind == 'one': return f'x = {x}; y = {y}' return 'infinitely many solutions' if kind == 'line' else 'no solution' print(describe(1, 1, 10, 1, -1, 2)) # x = 6; y = 4 print(describe(2, 3, 7, 1, -4, 1)) # x = 31/11; y = 5/11 print(describe(2, 3, 6, 4, 6, 18)) # no solution print(describe(1, 2, 4, 3, 6, 12)) # infinitely many solutions # nearly parallel lines: x + y = 2 and x + (1 + e) y = 2 + e, whose exact answer is (1, 1) e = 1e-16 print(1 * (1 + e) - 1 * 1) # 0.0: in doubles the two equations are the same tiny = Fraction(1, 10**16) print(describe(1, 1, 2, 1, 1 + tiny, 2 + tiny)) # x = 1; y = 1 ``` ```javascript const gcd = (a, b) => (b === 0 ? Math.abs(a) : gcd(b, a % b)) // n / d in lowest terms, as text const frac = (n, d) => { const g = gcd(n, d) * Math.sign(d) return `${n / g}${d / g === 1 ? '' : '/' + d / g}` } function solve2(a1, b1, c1, a2, b2, c2) { const D = a1 * b2 - a2 * b1 if (D !== 0) return `x = ${frac(c1 * b2 - c2 * b1, D)}; y = ${frac(a1 * c2 - a2 * c1, D)}` // D = 0: one line when the right-hand sides fit as well, else parallel const same = a1 * c2 === a2 * c1 && b1 * c2 === b2 * c1 return same ? 'infinitely many solutions' : 'no solution' } solve2(1, 1, 10, 1, -1, 2) // 'x = 6; y = 4' solve2(2, 3, 7, 1, -4, 1) // 'x = 31/11; y = 5/11' solve2(2, 3, 6, 4, 6, 18) // 'no solution' solve2(1, 2, 4, 3, 6, 12) // 'infinitely many solutions' // nearly parallel lines: in doubles, 1 + 1e-16 is exactly 1 const e = 1e-16 1 * (1 + e) - 1 * 1 // 0 ``` ```cpp #include #include using namespace std; int gcd(int a, int b) { return b == 0 ? (a < 0 ? -a : a) : gcd(b, a % b); } // prints n / d in lowest terms void printFraction(int n, int d) { int g = gcd(n, d); if (d < 0) g = -g; n = n / g; d = d / g; if (d == 1) printf("%d", n); else printf("%d/%d", n, d); } void solve2(int a1, int b1, int c1, int a2, int b2, int c2) { int D = a1 * b2 - a2 * b1; if (D != 0) { printf("x = "); printFraction(c1 * b2 - c2 * b1, D); printf("; y = "); printFraction(a1 * c2 - a2 * c1, D); printf("\n"); } else if (a1 * c2 == a2 * c1 && b1 * c2 == b2 * c1) { printf("infinitely many solutions\n"); } else { printf("no solution\n"); } } int main() { solve2(1, 1, 10, 1, -1, 2); solve2(2, 3, 7, 1, -4, 1); solve2(2, 3, 6, 4, 6, 18); solve2(1, 2, 4, 3, 6, 12); double e = 1e-16; printf("%.1f\n", 1 * (1 + e) - 1 * 1); return 0; } /* output: x = 6; y = 4 x = 31/11; y = 5/11 no solution infinitely many solutions 0.0 */ ``` ## Dari mana asal sistem persamaan? **Sistem persamaan linear termasuk masalah tertua dalam matematika, dan metode eliminasi lebih tua daripada notasi yang kita pakai untuknya.** - **Dari sekitar 1800 SM.** Lempeng tanah liat dari Babilonia mengajukan soal yang setara dengan dua persamaan linear dengan dua bilangan tak diketahui, seperti dua ladang yang luas dan hasil panen gabungannya diketahui, dan menyelesaikannya dengan aturan yang sama dengan eliminasi. - **Pada abad ke-1 M.** Kitab Tiongkok Sembilan Bab tentang Seni Matematika mengabdikan bab kedelapan, fangcheng ("susunan persegi panjang"), untuk sistem beberapa persamaan, yang diselesaikan dengan prosedur eliminasi pada susunan bilangan yang ditata dengan batang hitung, langkah yang sama dengan eliminasi Gauss. - **1557.** Robert Recorde menulis tanda sama dengan pertama, $=$, "karena tak ada dua hal yang lebih sama" daripada dua garis sejajar yang sama panjang. - **1707 dan 1750.** Kuliah Newton, diterbitkan 1707, menguraikan eliminasi untuk beberapa bilangan tak diketahui, dan Gabriel Cramer menerbitkan, pada 1750, aturan determinan yang memakai namanya (Colin Maclaurin telah menemukannya untuk dua dan tiga bilangan tak diketahui sedikit lebih awal). - **Awal abad ke-19.** Gauss memakai eliminasi yang sistematis untuk perhitungan kuadrat terkecilnya, itulah sebabnya ia disebut eliminasi Gauss; ia leluhur penyelesai di setiap pustaka numerik sekarang. ## Apa kesalahan umum pada sistem persamaan? **Kesalahan paling umum pada sistem persamaan adalah sembilan hal berikut, masing-masing dengan pernyataan yang benar.** | Kesalahan | Yang benar | |---|---| | ❌ Mensubstitusi ungkapan ke persamaan yang sama dengan asalnya | Itu memberi $0=0$ atau $x=x$: masukkan ke persamaan yang lain. | | ❌ Mengalikan hanya satu suku, atau satu ruas, saat mengubah skala persamaan | Kalikan setiap suku di kedua ruas, atau persamaannya bukan lagi yang sama. | | ❌ Menjumlahkan saat koefisien bertanda sama dan berharap habis | Tanda berlawanan: jumlahkan. Tanda sama: kurangkan. Pastikan variabelnya habis. | | ❌ $(3x+2y)-(x-y)=2x+y$ | Mengurangkan mengubah setiap tanda: $(3x+2y)-(x-y)=2x+3y$. | | ❌ Menemukan $x$ lalu berhenti | Penyelesaian adalah pasangan: kembali mencari variabel yang lain. | | ❌ Memeriksa jawaban di satu persamaan saja | Periksa keduanya: $(0,10)$ cocok dengan $x+y=10$ tetapi tidak dengan $x-y=2$. | | ❌ $0=0$ berarti tak ada penyelesaian, $0=5$ berarti tak terhingga | Sebaliknya: $0=0$ benar (tak terhingga); $0=5$ salah (tidak ada). | | ❌ Jawabannya harus bilangan bulat | Sering tidak: $2x+3y=7$ dan $x-4y=1$ memberi $(\frac{31}{11},\frac5{11})$. | | ❌ Menguji $D==0$ pada bilangan floating-point | Pembulatan menyembunyikan atau menciptakan nol: pakai bilangan eksak, atau bandingkan dengan toleransi. | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: sistem persamaan linear sekilas - **Sistem:** $a_1x+b_1y=c_1$ dan $a_2x+b_2y=c_2$ sekaligus; penyelesaiannya adalah pasangan $(x,y)$ pada kedua garis. - **Tiga kemungkinan:** berpotongan (satu penyelesaian, $D\ne0$), sejajar (tidak ada), garis yang sama (tak terhingga); untuk dua yang terakhir $D=0$. - **Substitusi:** isolasi sebuah variabel (terbaik dengan koefisien $\pm1$), masukkan ke persamaan yang lain, selesaikan, kembali. - **Eliminasi:** ubah skala agar satu variabel berkoefisien berlawanan, jumlahkan (kurangkan bila sama), selesaikan, kembali; $0=0$ berarti tak terhingga, $0=5$ berarti tidak ada. - **Cramer:** $x=\frac{c_1b_2-c_2b_1}{D}$, $y=\frac{a_1c_2-a_2c_1}{D}$; $|D|$ adalah luas pada vektor koefisien. - **Soal cerita:** namai bilangan tak diketahui, satu persamaan per fakta, selesaikan, periksa dalam cerita, jawab dengan satu kalimat. - **Numerik:** garis hampir sejajar memperbesar galat sekitar $\frac1\varepsilon$; presisi ganda melihat $D=0$ di bawah $10^{-16}$; pakai pecahan eksak untuk data eksak. ## Glosarium: istilah penting - **Sistem persamaan linear**: Dua persamaan linear atau lebih yang harus benar sekaligus; dengan dua bilangan tak diketahui, dua garis. - **Penyelesaian sistem**: Pasangan bilangan x dan y yang membuat setiap persamaan sistem benar; titik tempat garis-garis bertemu. - **Substitusi**: Menyelesaikan satu persamaan untuk sebuah variabel dan memasukkan ungkapan itu ke persamaan yang lain. - **Eliminasi**: Menjumlahkan atau mengurangkan kelipatan persamaan agar satu variabel habis. - **Determinan sistem 2 kali 2**: Bilangan a1 b2 dikurangi a2 b1; sistem memiliki tepat satu penyelesaian bila ia tidak nol. - **Aturan Cramer**: Rumus x sama dengan Dx per D dan y sama dengan Dy per D yang menyelesaikan sistem bila D tidak nol. - **Garis sejajar**: Garis dengan kemiringan sama yang tak pernah bertemu; sistem dua garis itu tidak memiliki penyelesaian. - **Garis berimpit**: Dua persamaan yang menggambarkan garis yang sama; setiap titiknya adalah penyelesaian. - **Sistem berkondisi buruk**: Sistem yang jawabannya berubah banyak bila bilangannya berubah sedikit, seperti pada garis yang hampir sejajar. - **Bilangan kondisi**: Bilangan yang menyatakan berapa kali perubahan pada data dapat dibesarkan pada jawaban; ia besar untuk garis yang hampir sejajar. ## Pertanyaan yang sering diajukan ### Apa itu sistem persamaan linear dua variabel? Ia adalah dua persamaan linear, a1 x ditambah b1 y sama dengan c1 dan a2 x ditambah b2 y sama dengan c2, yang harus berlaku bersamaan. Penyelesaiannya adalah pasangan x dan y yang memenuhi keduanya, yang pada grafik adalah titik tempat kedua garis berpotongan. ### Bagaimana menyelesaikan sistem persamaan dengan substitusi? Selesaikan satu persamaan untuk satu variabel, masukkan ungkapan itu ke persamaan lain, selesaikan persamaan yang kini bervariabel satu, dan substitusikan kembali untuk mendapat yang lain. Lalu periksa pasangan itu di kedua persamaan semula. ### Bagaimana menyelesaikan sistem persamaan dengan eliminasi? Kalikan persamaan agar satu variabel memiliki koefisien yang sama besar, lalu jumlahkan bila tandanya berlawanan atau kurangkan bila sama, sehingga variabel itu habis. Selesaikan untuk yang lain, lalu kembali mencari yang pertama. ### Bagaimana mengetahui sistem tidak punya penyelesaian atau punya tak terhingga? Lihat D, a1 b2 dikurangi a2 b1. Bila D tidak nol ada satu penyelesaian. Bila D nol kedua garis berarah sama: keduanya garis yang sama, dengan tak terhingga penyelesaian, bila ruas kanan juga cocok, dan sejajar, tanpa penyelesaian, bila tidak. ### Apa arti penyelesaian sistem pada grafik? Tiap persamaan adalah garis, dan setiap titik pada garis memenuhi persamaannya. Penyelesaian sistem karenanya adalah titik yang terletak pada kedua garis, perpotongannya. Garis sejajar tidak memilikinya, dan garis yang identik berbagi semua titiknya. ### Apa aturan Cramer untuk dua persamaan? Bila D, a1 b2 dikurangi a2 b1, tidak nol, x sama dengan Dx per D dan y sama dengan Dy per D, dengan Dx adalah c1 b2 dikurangi c2 b1 dan Dy adalah a1 c2 dikurangi a2 c1. Ia adalah eliminasi yang dikerjakan sekali untuk setiap sistem. ### Bagaimana menyelesaikan soal cerita dengan dua bilangan tak diketahui? Namai kedua bilangan tak diketahui beserta satuannya, tulis satu persamaan untuk setiap fakta berbeda dalam soal, selesaikan sistem dengan substitusi atau eliminasi, dan periksa jawaban terhadap cerita sebelum menjawab dengan satu kalimat. ### Mengapa garis hampir sejajar membuat penyelesai komputer tidak andal? Titik potongnya bergeser jauh bila sebuah bilangan berubah sedikit, sehingga galat pembulatan kecil dibesarkan, dan dalam presisi ganda dua kemiringan yang sangat dekat dapat menjadi identik, menghasilkan determinan tepat nol. Pecahan eksak menghindarinya untuk data eksak. --- # Law of Cosines: Pythagoras for Every Triangle, and What It Solves Source: https://nunada.my.id/articles/law-of-cosines/ Updated: 2026-10-29 ## Quick answer **The law of cosines says that in a triangle with sides $a$, $b$ and the angle $C$ between them, the opposite side satisfies $c^2=a^2+b^2-2ab\cos C$: the Pythagorean theorem with a correction that vanishes at a right angle.** It finds the third side from two sides and the angle between them, and every angle from three sides, with $\cos C=\frac{a^2+b^2-c^2}{2ab}$. The sign of the correction also says whether the angle is acute, right or obtuse. It also adds forces at an angle. ### Key takeaways - In $c^2=a^2+b^2-2ab\cos C$, $C$ is the angle between $a$ and $b$, which is also the angle opposite $c$. At $C=90^\circ$, $\cos C=0$ and it is the Pythagorean theorem; for an acute angle the correction subtracts and $c$ is shorter than the hypotenuse of the same legs, for an obtuse angle it adds. - It follows from one altitude and Pythagoras: the altitude splits $a$ into $b\cos C$ and $a-b\cos C$ (the first is negative, and the foot falls outside, if $C$ is obtuse), and $c^2=h^2+(a-b\cos C)^2$ with $h=b\sin C$. - Two sides and the angle between them (SAS) give the third side directly. Three sides (SSS) give every angle, $\cos C=\frac{a^2+b^2-c^2}{2ab}$: find the largest angle first, the one opposite the longest side, because it is the only one that can be obtuse. - Since $-1\le\cos C\le1$, the third side is always between $|a-b|$ and $a+b$: the law contains the triangle inequality. And comparing $c^2$ with $a^2+b^2$ tells acute, right or obtuse from the sides alone, which proves the converse of the Pythagorean theorem. - Two forces $F_1$ and $F_2$ whose directions make the angle $\theta$ add to $R$ with $R^2=F_1^2+F_2^2+2F_1F_2\cos\theta$, a plus because the triangle's angle is $180^\circ-\theta$. A journey of two legs on bearings is the same triangle, and the law gives the distance and the bearing back. - In a program, the arccosine form loses the angle of a thin triangle: sides $10^8$, $10^8$ and $1$ give $\cos C$ rounded to $1$ and an angle of $0$ instead of $5.7\times10^{-7}$ degrees. The half-angle form $\tan\frac C2=\sqrt{\frac{(s-a)(s-b)}{s(s-c)}}$, with $s-a$ and $s-b$ computed as $\frac{c\pm(b-a)}{2}$, keeps it. ## What does the law of cosines say? **The law of cosines says that in a triangle with sides $a$ and $b$ enclosing the angle $C$, the third side $c$, opposite $C$, satisfies $c^2=a^2+b^2-2ab\cos C$.** Read it as the Pythagorean theorem plus a correction. If $C$ is a right angle, $\cos C=0$, the correction disappears and $c^2=a^2+b^2$. If $C$ is acute, $\cos C>0$ and the correction subtracts: the third side is shorter than the hypotenuse of a right triangle with the same two legs. If $C$ is obtuse, $\cos C<0$ and the correction adds: it is longer. The letters follow the same convention as in the law of sines: $A$, $B$, $C$ are the angles and $a$, $b$, $c$ the sides opposite them. In the formula above $C$ is both the angle opposite $c$ and the angle between $a$ and $b$, and it is the same angle. The other two forms are the same law with the letters moved: $a^2=b^2+c^2-2bc\cos A$ and $b^2=a^2+c^2-2ac\cos B$. Solving for the cosine gives the form for finding an angle: $$\cos C=\frac{a^2+b^2-c^2}{2ab}.$$ A first check with the triangle $13$, $14$, $15$: for the angle $A$ opposite $13$, $\cos A=\frac{14^2+15^2-13^2}{2\cdot14\cdot15}=\frac{252}{420}=0.6$, so $A=53.13^\circ$, the same angle as in the $3$-$4$-$5$ triangle. When is it needed? The law of sines needs a side together with its opposite angle; when there is none, with two sides and the angle between them or with three sides, the law of cosines is the way in (see [the law of sines](https://nunada.my.id/articles/law-of-sines/#sines-or-cosines) for the choice between them, and [the article on triangles](https://nunada.my.id/articles/triangles/#solve-a-triangle) for the overview). ## Why is the law of cosines true? A proof with one altitude **The law of cosines follows from the Pythagorean theorem applied to a right triangle cut off by an altitude.** Put the angle $C$ at the vertex $C$ and drop the altitude $h$ from $A$ onto the line $CB$. In the right triangle with hypotenuse $b$ and the angle $C$, the adjacent side is $b\cos C$ and the height is $h=b\sin C$ (see [the right triangle](https://nunada.my.id/articles/basic-trigonometry/#right-triangles)). The altitude cuts the side $a$ into $b\cos C$ and $a-b\cos C$. The other right triangle has the hypotenuse $c$ and legs $h$ and $a-b\cos C$, so by Pythagoras $$c^2=h^2+(a-b\cos C)^2=b^2\sin^2C+a^2-2ab\cos C+b^2\cos^2C.$$ Collect $b^2\sin^2C+b^2\cos^2C=b^2$ (the identity $\sin^2C+\cos^2C=1$, see [the identities](https://nunada.my.id/articles/trigonometric-identities/#fundamental)) and you are left with $$c^2=a^2+b^2-2ab\cos C.$$ If $C$ is obtuse, the foot of the altitude falls outside the triangle, on the extension of $a$, at the distance $-b\cos C$ (a positive number, since $\cos C<0$) from $C$, and the right triangle has the leg $a+(-b\cos C)=a-b\cos C$. The computation is word for word the same, so one formula covers both cases. **A second proof, by coordinates.** Put $C$ at the origin, $B$ at $(a,0)$ and $A$ at $(b\cos C,\,b\sin C)$. The distance from $A$ to $B$ squared is $(b\cos C-a)^2+(b\sin C)^2$, which expands to the same thing. In vector language it is the identity $|u-v|^2=|u|^2+|v|^2-2\,u\cdot v$ with $u\cdot v=|u||v|\cos C$, which is why the dot product is defined with a cosine. *An acute angle $C$. The altitude $h$ from $A$ falls on the side $a$ and cuts it into $b\cos C$ and $a-b\cos C$, with $h=b\sin C$. Pythagoras in the right triangle on the right gives $c^2=h^2+(a-b\cos C)^2$, which with $h=b\sin C$ expands to $a^2+b^2-2ab\cos C$.* *An obtuse angle $C$. The foot of the altitude is now outside the triangle, on the extension of $a$, at the distance $|b\cos C|=-b\cos C$ from $C$. The right triangle has the leg $a+|b\cos C|=a-b\cos C$, so the same computation gives $c^2=h^2+(a-b\cos C)^2=a^2+b^2-2ab\cos C$: the formula needs no separate case, since $\cos C$ is negative.* ## How does the law turn the Pythagorean theorem into a rule for every angle? **Picture two sides of fixed lengths $a$ and $b$ joined at a hinge, with the angle $C$ between them: the third side $c$ is the distance between their free ends, and it grows as the hinge opens.** At $C$ near $0^\circ$ the two sides lie almost on top of each other and $c\approx|a-b|$. At $C=90^\circ$ they are perpendicular and $c=\sqrt{a^2+b^2}$. At $C$ near $180^\circ$ they point in opposite directions and $c\approx a+b$. In between, $c$ increases steadily, because $\cos C$ decreases from $1$ to $-1$. This is the triangle inequality in disguise. Since $-1\le\cos C\le1$, the law gives $a^2+b^2-2ab\le c^2\le a^2+b^2+2ab$, that is $(a-b)^2\le c^2\le(a+b)^2$, so $$|a-b|\le c\le a+b.$$ Here is the sign rule in one line: $c^20$ ($C$ acute), $c^2=a^2+b^2$ exactly when $C=90^\circ$, and $c^2>a^2+b^2$ exactly when $C$ is obtuse. So the Pythagorean theorem and its converse (a triangle with $c^2=a^2+b^2$ has a right angle at $C$) are the one case $\cos C=0$ of a single law. Open the hinge below, move the two sides, and watch the correction term change sign at the right angle. ## How do you find the third side from two sides, or all the angles from three sides? **With two sides and the angle between them (SAS), the law of cosines gives the third side in one step; with three sides (SSS), it gives each angle, and the order matters: start with the largest angle.** **SAS.** $a=7$, $b=10$ and $C=120^\circ$. Then $c^2=149-140\cos120^\circ=149+70=219$, so $c=14.80$. The angle is obtuse and the correction $+70$ made $c$ longer than the hypotenuse $\sqrt{149}=12.21$. The two other angles come next, with the law of cosines again or with [the law of sines](https://nunada.my.id/articles/law-of-sines/#two-angles-and-a-side): $\sin A=\frac{7\sin120^\circ}{14.80}=0.4096$, and since $A$ is not the largest angle it is acute, so $A=24.18^\circ$ and $B=180^\circ-120^\circ-24.18^\circ=35.82^\circ$. **SSS.** Take the sides $5$, $7$, $10$. The longest side, $10$, is opposite the largest angle $C$, and it is the only angle that could be obtuse, so find it first: $\cos C=\frac{25+49-100}{2\cdot5\cdot7}=\frac{-26}{70}=-0.3714$, and the negative cosine says $C=111.80^\circ$ is obtuse (the arccosine returns a single angle from $0^\circ$ to $180^\circ$, so it cannot be wrong about that). Then $\cos A=\frac{49+100-25}{2\cdot7\cdot10}=\frac{124}{140}=0.8857$, $A=27.66^\circ$, and $B=180^\circ-111.80^\circ-27.66^\circ=40.54^\circ$. A check: the angles add up to $180^\circ$, and the largest angle faces the longest side. Why largest first? Once the largest angle is known to be acute (or found to be obtuse) the others are certainly acute, so even the law of sines, whose arcsine only returns acute angles, is safe for them. Start with a smaller angle by the law of sines and an obtuse largest angle gives the wrong answer. ## How can you tell from the sides alone whether a triangle is acute, right or obtuse? **Compare the square of the longest side with the sum of the squares of the other two: smaller means all angles are acute, equal means a right angle, larger means an obtuse angle.** This is the law of cosines read for the sign. If $c$ is the longest side, the angle $C$ opposite it is the largest, and $c^2-(a^2+b^2)=-2ab\cos C$ has the sign of $-\cos C$: negative for an acute $C$, zero for a right angle, positive for an obtuse one. The other two angles are smaller than $C$, so they are acute whenever $C$ is not obtuse; if $C$ is obtuse they are acute anyway, since a triangle has at most one angle of $90^\circ$ or more. | Sides | $c^2$ | $a^2+b^2$ | The largest angle | |---|---|---|---| | $4$, $5$, $6$ | $36$ | $41$ | acute: $c^2a^2+b^2$ | The middle row is the **converse of the Pythagorean theorem**: if the squares of the sides satisfy $c^2=a^2+b^2$, the triangle has a right angle opposite $c$. The converse is not obvious from the statement of the theorem alone, but with the law of cosines it takes a line: $c^2=a^2+b^2$ forces $-2ab\cos C=0$, so $\cos C=0$ and $C=90^\circ$. This test needs only squares of lengths, so it can be done exactly (see [the types of triangles](https://nunada.my.id/articles/triangles/#types)). ## How do you add two forces that pull at an angle? **Two forces pulling in directions that make the angle $\theta$ add up to a single force $R$ with $R^2=F_1^2+F_2^2+2F_1F_2\cos\theta$, which is the law of cosines with the other angle of the parallelogram.** Draw $F_1$ and then $F_2$ from its tip: the resultant $R$ closes the triangle. The angle of that triangle at the tip of $F_1$ is not $\theta$ but $180^\circ-\theta$, because the direction of $F_2$ makes $\theta$ with the extension of $F_1$. Since $\cos(180^\circ-\theta)=-\cos\theta$, the minus of the law becomes a plus. **Example.** $30$ N and $40$ N with $60^\circ$ between their directions: $R^2=2500+2400\cos60^\circ=2500+1200=3700$, so $R=60.83$ N. At $90^\circ$ it is $\sqrt{900+1600}=50$ N, the Pythagorean theorem. At $0^\circ$ the forces pull the same way and add, $70$ N; at $180^\circ$ they oppose and subtract, $10$ N. The direction of $R$ makes the angle $\arctan\frac{F_2\sin\theta}{F_1+F_2\cos\theta}=34.7^\circ$ with $F_1$. The same rule adds any two vectors, such as velocities (a boat and a current) or displacements. The mistake to avoid is writing the minus: it belongs to the angle inside the triangle, the plus to the angle between the two directions as the problem gives it. *Two forces of $30$ N and $40$ N whose directions make an angle of $60^\circ$ (drawn at a tenth of the scale). Their sum $R$ is the diagonal of the parallelogram, and the triangle $0,F_1,R$ has the angle $180^\circ-60^\circ=120^\circ$ at the end of $F_1$. So $R^2=30^2+40^2-2\cdot30\cdot40\cos120^\circ=3700$ and $R\approx60.83$ N.* ## How do you find the distance and the bearing after a journey of two legs? **A journey of two straight legs is two sides of a triangle, the distance back to the start is the third side, and the law of cosines gives it from the lengths and the turn at the bend.** A bearing is an angle measured clockwise from north, written with three digits ($060^\circ$, $085^\circ$), the way a ship or aircraft is steered. If the course changes from the bearing $b_1$ to $b_2$, it turns through $|b_2-b_1|$ (the smaller way round, never more than $180^\circ$), and the angle of the triangle at the bend is $180^\circ$ minus that turn. **Example.** $120$ km on $060^\circ$, then $90$ km on $120^\circ$. The turn is $60^\circ$, so the angle at the bend is $120^\circ$ and the distance back is $$s=\sqrt{120^2+90^2-2\cdot120\cdot90\cos120^\circ}=\sqrt{33300}=182.48\ \text{km}.$$ For the direction, find the angle at the start between the first leg and the straight line, again by the law of cosines on the three sides. It is opposite the second leg of $90$ km, so $\cos\alpha=\frac{120^2+182.48^2-90^2}{2\cdot120\cdot182.48}=0.9042$ and $\alpha=25.3^\circ$. The course turned to the right at the bend, so the end lies to the right of the first bearing: $060^\circ+25.3^\circ=085.3^\circ$. The bearing back is $085.3^\circ+180^\circ=265.3^\circ$. Set your own journey below; the widget finds the angle at the start by the law of cosines and chooses the side from the direction of the turn. *A ship sails $120$ km on bearing $060^\circ$ (measured clockwise from north) and then $90$ km on bearing $120^\circ$. The course turns by $60^\circ$ at the bend, so the triangle's angle there is $180^\circ-60^\circ=120^\circ$ and the law of cosines gives the distance back to the start: $\sqrt{120^2+90^2-2\cdot120\cdot90\cos120^\circ}=\sqrt{33300}\approx182.5$ km, on bearing $085.3^\circ$.* ## How is the law of cosines connected to Heron's formula and to the length of a median? **Two classic formulas come out of the law of cosines by algebra: the area from three sides (Heron) and the length of a median (Apollonius).** **Heron's formula.** The area is $K=\frac12ab\sin C$, so $16K^2=4a^2b^2\sin^2C=4a^2b^2(1-\cos^2C)$. Put in $2ab\cos C=a^2+b^2-c^2$ from the law: $$16K^2=4a^2b^2-(a^2+b^2-c^2)^2=\left[2ab-(a^2+b^2-c^2)\right]\left[2ab+(a^2+b^2-c^2)\right].$$ The first bracket is $c^2-(a-b)^2=(c-a+b)(c+a-b)$ and the second is $(a+b)^2-c^2=(a+b-c)(a+b+c)$, so $16K^2=(a+b+c)(-a+b+c)(a-b+c)(a+b-c)$, which with $s=\frac{a+b+c}{2}$ is $K=\sqrt{s(s-a)(s-b)(s-c)}$. For $13$, $14$, $15$ this is $\sqrt{21\cdot8\cdot7\cdot6}=84$ (see [the area of a triangle](https://nunada.my.id/articles/triangles/#perimeter-and-area)). **The median.** Let $m_c$ be the median from $C$ to the midpoint $M$ of $c$. Apply the law of cosines to the two triangles $ACM$ and $BCM$, whose angles at $M$ add up to $180^\circ$, so their cosines are opposite: $a^2=m_c^2+\frac{c^2}{4}-m_cc\cos\mu$ and $b^2=m_c^2+\frac{c^2}{4}+m_cc\cos\mu$. Add the two equations and the cosine cancels: $$a^2+b^2=2m_c^2+\frac{c^2}{2}\quad\Rightarrow\quad m_c=\frac12\sqrt{2a^2+2b^2-c^2}.$$ For $a=13$, $b=15$, $c=14$: $m_c=\frac12\sqrt{338+450-196}=\frac12\sqrt{592}=12.17$. In a right triangle with $a=6$, $b=8$, $c=10$ it gives $\frac12\sqrt{72+128-100}=5$, half the hypotenuse, a fact about the circumcenter of a right triangle (see [the medians and centers](https://nunada.my.id/articles/triangles/#centers)). ## Why does the law of cosines lose the angle of a thin triangle, and what do you do? **For a very thin triangle the arccosine form $\arccos\frac{a^2+b^2-c^2}{2ab}$ throws away the angle, because the cosine of a tiny angle is a number that rounds to $1$; the half-angle form keeps it.** Take the sides $10^8$, $10^8$ and $1$. The true angle opposite the side $1$ is $2\arcsin\frac{1}{2\cdot10^8}=5.73\times10^{-7}$ degrees. But $a^2+b^2=2\times10^{16}$ and subtracting $c^2=1$ changes nothing a double-precision number can show (the spacing of doubles near $2\times10^{16}$ is $4$), so the ratio is exactly $1$ and the arccosine is exactly $0$: the angle has vanished. Before that point, the angle is correct but carries fewer and fewer digits: the cosine of an angle near $0$ is flat, so an error of $10^{-16}$ in it is an error of $10^{-8}$ radians in the angle. Two ways out. For a thin triangle with a small angle $C$, find that angle with the law of sines, which does not square anything. Or use the half-angle form, in terms of the half-perimeter $s=\frac{a+b+c}{2}$: $$\tan\frac C2=\sqrt{\frac{(s-a)(s-b)}{s(s-c)}}.$$ It needs care in one place: $s-a=\frac{b+c-a}{2}$ is a small difference of big numbers if $c$ is tiny, so write it as $s-a=\frac{c+(b-a)}{2}$ and $s-b=\frac{c-(b-a)}{2}$, where the subtraction $b-a$ of two long, close sides is exact. The widget below shows both forms for any three sides; try "very thin". ## How do you use the law of cosines in a program? **A program uses the law of cosines in three functions: the third side from two sides and the included angle, the angle from three sides, and the resultant of two vectors; the one place that needs care is the angle from three sides.** Convert degrees to radians before `cos`, check the triangle inequality before taking an arccosine, and clamp the ratio into $[-1,1]$ so that rounding cannot make `acos` fail. For a thin triangle, do not trust the plain arccosine, as the section above showed. The programs below find the third side for $a=7$, $b=10$, $C=120^\circ$ (giving $14.7986$), the three angles of the triangle $5$, $7$, $10$ (largest first: $111.80^\circ$, $27.66^\circ$, $40.54^\circ$), the resultant of $30$ N and $40$ N at $60^\circ$ ($60.83$ N), and the thin triangle $10^8$, $10^8$, $1$ whose angle, in millionths of a degree, is $0$ by the arccosine and $0.573$ by the half-angle form. ```python import math def third_side(a, b, C): """The side opposite C (degrees) between the sides a and b: c^2 = a^2 + b^2 - 2ab cos C.""" return math.sqrt(a * a + b * b - 2 * a * b * math.cos(math.radians(C))) def angle_naive(a, b, c): """The angle opposite c by the arccosine, the ratio clamped into [-1, 1].""" x = (a * a + b * b - c * c) / (2 * a * b) return math.degrees(math.acos(max(-1.0, min(1.0, x)))) def angle_stable(a, b, c): """The same angle by the half-angle form; s - a and s - b are written (c +- (b - a)) / 2 so a tiny c is not lost.""" u = (c + (b - a)) / 2 v = (c - (b - a)) / 2 s = (a + b + c) / 2 return math.degrees(2 * math.atan(math.sqrt(u * v / (s * (s - c))))) def resultant(F1, F2, theta): """The size of the sum of two forces whose directions make the angle theta (degrees).""" return math.sqrt(F1 * F1 + F2 * F2 + 2 * F1 * F2 * math.cos(math.radians(theta))) print(round(third_side(7, 10, 120), 4)) # 14.7986 a, b, c = 5, 7, 10 # the largest angle first: the one opposite the longest side C = angle_naive(a, b, c) A = angle_naive(b, c, a) print(round(C, 2), round(A, 2), round(180 - C - A, 2)) # 111.8 27.66 40.54 print(round(resultant(30, 40, 60), 2)) # 60.83 print(round(angle_naive(1e8, 1e8, 1) * 1e6, 4), round(angle_stable(1e8, 1e8, 1) * 1e6, 4)) # 0.0 0.573 ``` ```javascript const rad = (d) => (d * Math.PI) / 180 const deg = (r) => (r * 180) / Math.PI // the side opposite C (degrees) between the sides a and b: c^2 = a^2 + b^2 - 2ab cos C const thirdSide = (a, b, C) => Math.sqrt(a * a + b * b - 2 * a * b * Math.cos(rad(C))) // the angle opposite c by the arccosine, the ratio clamped into [-1, 1] function angleNaive(a, b, c) { const x = (a * a + b * b - c * c) / (2 * a * b) return deg(Math.acos(Math.max(-1, Math.min(1, x)))) } // the same angle by the half-angle form; s - a and s - b are written (c +- (b - a)) / 2 so a tiny c is not lost function angleStable(a, b, c) { const u = (c + (b - a)) / 2 const v = (c - (b - a)) / 2 const s = (a + b + c) / 2 return deg(2 * Math.atan(Math.sqrt((u * v) / (s * (s - c))))) } // the size of the sum of two forces whose directions make the angle theta (degrees) const resultant = (F1, F2, theta) => Math.sqrt(F1 * F1 + F2 * F2 + 2 * F1 * F2 * Math.cos(rad(theta))) +thirdSide(7, 10, 120).toFixed(4) // 14.7986 const [a, b, c] = [5, 7, 10] // the largest angle first: the one opposite the longest side const C = angleNaive(a, b, c) const A = angleNaive(b, c, a) ;[+C.toFixed(2), +A.toFixed(2), +(180 - C - A).toFixed(2)] // [111.8, 27.66, 40.54] +resultant(30, 40, 60).toFixed(2) // 60.83 ;[+(angleNaive(1e8, 1e8, 1) * 1e6).toFixed(4), +(angleStable(1e8, 1e8, 1) * 1e6).toFixed(4)] // [0, 0.573] ``` ```cpp #include #include #include using namespace std; const double PI = 3.14159265358979323846; double rad(double d) { return d * PI / 180.0; } double deg(double r) { return r * 180.0 / PI; } // the side opposite C (degrees) between the sides a and b double thirdSide(double a, double b, double C) { return sqrt(a * a + b * b - 2 * a * b * cos(rad(C))); } // the angle opposite c by the arccosine, the ratio clamped into [-1, 1] double angleNaive(double a, double b, double c) { double x = (a * a + b * b - c * c) / (2 * a * b); if (x > 1) x = 1; if (x < -1) x = -1; return deg(acos(x)); } // the same angle by the half-angle form; s - a and s - b are written (c +- (b - a)) / 2 so a tiny c is not lost double angleStable(double a, double b, double c) { double u = (c + (b - a)) / 2; double v = (c - (b - a)) / 2; double s = (a + b + c) / 2; return deg(2 * atan(sqrt(u * v / (s * (s - c))))); } // the size of the sum of two forces whose directions make the angle theta (degrees) double resultant(double F1, double F2, double theta) { return sqrt(F1 * F1 + F2 * F2 + 2 * F1 * F2 * cos(rad(theta))); } int main() { printf("%.4f\n", thirdSide(7, 10, 120)); double C = angleNaive(5, 7, 10); // the largest angle first: the one opposite the longest side double A = angleNaive(7, 10, 5); printf("%.2f %.2f %.2f\n", C, A, 180 - C - A); printf("%.2f\n", resultant(30, 40, 60)); printf("%.4f %.4f\n", angleNaive(1e8, 1e8, 1) * 1e6, angleStable(1e8, 1e8, 1) * 1e6); return 0; } /* output: 14.7986 111.80 27.66 40.54 60.83 0.0000 0.5730 */ ``` ## Where does the law of cosines come from? **The law of cosines is older than the cosine: Euclid proved it as two theorems about squares and rectangles, and it became a formula only when the cosine became a number.** - **About 300 BCE.** Euclid's Elements, Book II, Propositions 12 and 13, are the law of cosines in the language of geometry: in an obtuse triangle the square on the side opposite the obtuse angle is greater than the squares on the other two sides by twice a rectangle, and in an acute triangle it is less by twice a rectangle. The rectangle is $a\cdot b\cos C$, built from a side and the projection of the other. - **15th century.** Jamshid al-Kashi, working in Samarkand, states the law in a form suited to computing a side from two sides and the angle between them with a table of sines. In France it is still called Al-Kashi's theorem. - **1748.** Euler's Introductio treats the sine and cosine as functions of a number, so that the rectangle can be written $ab\cos C$ and the law as the single formula used today. - **19th and 20th centuries.** With vectors, the law becomes $|u-v|^2=|u|^2+|v|^2-2\,u\cdot v$, and the dot product $u\cdot v=|u||v|\cos\theta$ is defined so that this holds, which carries the law into any number of dimensions. ## What are the common mistakes with the law of cosines? **The most common mistakes with the law of cosines are the nine below, each with the correct statement.** | Mistake | Correct | |---|---| | ❌ $c^2=a^2+b^2-2ab\cos A$ (the wrong angle) | The angle is $C$, between $a$ and $b$ and opposite $c$. | | ❌ $c=a+b-2ab\cos C$ (forgetting the squares) | It is $c^2$ on the left; take the square root at the end. | | ❌ $(a^2+b^2-2ab)\cos C$ | The cosine multiplies only the term $2ab$: $a^2+b^2-2ab\cos C$. | | ❌ Take $\arccos$ of a ratio without checking | Check the triangle inequality first, and clamp the ratio into $[-1,1]$ in a program. | | ❌ Calculator in radian mode with degree data | Set degrees, or convert, or every cosine is wrong. | | ❌ $R^2=F_1^2+F_2^2-2F_1F_2\cos\theta$ for forces at the angle $\theta$ | The triangle's angle is $180^\circ-\theta$: $R^2=F_1^2+F_2^2+2F_1F_2\cos\theta$. | | ❌ Find a small angle first by the arccosine and subtract to get the largest | Find the largest angle first (opposite the longest side); only it can be obtuse. | | ❌ Trust $\arccos$ for a very thin triangle | The cosine rounds to $1$: use the half-angle form or the law of sines. | | ❌ A bearing is measured from the east axis | A bearing is measured clockwise from north, with three digits ($060^\circ$). | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: the law of cosines at a glance - **The law:** $c^2=a^2+b^2-2ab\cos C$, with $C$ between $a$ and $b$ and opposite $c$; and $\cos C=\frac{a^2+b^2-c^2}{2ab}$. - **Pythagoras with a correction:** at $90^\circ$ it vanishes; acute subtracts, obtuse adds. - **Proof:** the altitude splits $a$ into $b\cos C$ and $a-b\cos C$ (the first is negative for an obtuse $C$), and $h=b\sin C$. - **Range and kinds:** $|a-b|\le c\le a+b$; comparing $c^2$ with $a^2+b^2$ gives acute, right or obtuse, and proves the converse of Pythagoras. - **SAS:** the third side in one step. **SSS:** each angle; the largest first. - **Forces:** $R^2=F_1^2+F_2^2+2F_1F_2\cos\theta$ for the angle $\theta$ between the directions. **Journeys:** the angle at the bend is $180^\circ$ minus the turn. - **Heron and median:** $16K^2=4a^2b^2-(a^2+b^2-c^2)^2$ gives Heron's formula; $m_c=\frac12\sqrt{2a^2+2b^2-c^2}$. - **Numerics:** the arccosine loses a thin triangle's angle; use $\tan\frac C2=\sqrt{\frac{(s-a)(s-b)}{s(s-c)}}$ with $s-a=\frac{c+(b-a)}{2}$ and $s-b=\frac{c-(b-a)}{2}$. ## Glossary: key terms - **Law of cosines**: The rule that in a triangle the square of a side equals the sum of the squares of the other two minus twice their product times the cosine of the angle between them. - **Included angle**: The angle between two given sides of a triangle, which is also the angle opposite the third side. - **Correction term**: The term minus 2ab cos C that turns the Pythagorean theorem into the law of cosines; it is zero at a right angle, negative for an acute angle and positive for an obtuse one. - **Triangle inequality**: The rule that each side of a triangle is shorter than the sum of the other two and longer than their difference, which the law of cosines contains. - **Resultant**: The single force or vector equal to the sum of two others; its size follows from the law of cosines with the angle 180 degrees minus the angle between the directions. - **Bearing**: A direction given as an angle measured clockwise from north, written with three digits, such as 060 degrees. - **Median**: The segment from a vertex of a triangle to the midpoint of the opposite side; its length is a half of the square root of 2a squared plus 2b squared minus c squared. - **Half-angle form**: The formula tan of C over 2 equals the square root of s minus a times s minus b over s times s minus c, which finds an angle from three sides without losing the digits of a tiny angle. ## Frequently asked questions ### What is the formula for the law of cosines? In a triangle with sides a, b, c and the angle C between a and b, c squared equals a squared plus b squared minus 2 a b times the cosine of C. For a right angle the cosine is zero and it becomes the Pythagorean theorem. ### How do you prove the law of cosines? Drop the altitude from A onto side a. It cuts a into b cos C and a minus b cos C, and its height is b sin C. Pythagoras in the right triangle on the other side gives c squared, and sin squared plus cos squared equals 1 finishes it. ### When do you use the law of cosines instead of the law of sines? When no side comes with its opposite angle: two sides and the angle between them, or three sides. With a side and its opposite angle known, the law of sines is quicker. For finding an angle the law of cosines is also safer. ### How do you find an angle from three sides? Use cos C equals a squared plus b squared minus c squared, over 2 a b, and take the arccosine. Find the largest angle first, opposite the longest side, since only it can be obtuse; a negative cosine means obtuse. ### Why does the law of cosines become the Pythagorean theorem at 90 degrees? The cosine of 90 degrees is zero, so the term minus 2 a b cos C disappears and c squared equals a squared plus b squared. The term is the correction for an angle that is not a right angle: negative if acute, positive if obtuse. ### How do you add two forces at an angle? Use R squared equals F1 squared plus F2 squared plus 2 F1 F2 cos theta, where theta is the angle between the directions of the two forces. It is a plus because the angle inside the triangle is 180 degrees minus theta. ### Why does the law of cosines give a wrong angle for a very thin triangle? The cosine of a tiny angle is a number extremely close to 1, which a computer rounds to exactly 1, so the arccosine returns 0. Use the half-angle formula for tan of C over 2, or the law of sines, which keep the digits. ### How do you find the distance after two legs of a journey with different bearings? The angle of the triangle at the bend is 180 degrees minus the turn between the two bearings. Then the distance is the square root of d1 squared plus d2 squared minus 2 d1 d2 times the cosine of that angle. --- # Aturan Kosinus: Pythagoras untuk Setiap Segitiga dan Kegunaannya Source: https://nunada.my.id/artikel/aturan-kosinus/ Updated: 2026-10-29 ## Jawaban singkat **Aturan kosinus mengatakan bahwa pada segitiga dengan sisi $a$, $b$ dan sudut $C$ di antaranya, sisi di depannya memenuhi $c^2=a^2+b^2-2ab\cos C$: teorema Pythagoras dengan koreksi yang lenyap pada sudut siku-siku.** Ia mencari sisi ketiga dari dua sisi dan sudut apitnya, dan setiap sudut dari tiga sisi, dengan $\cos C=\frac{a^2+b^2-c^2}{2ab}$. Tanda koreksinya juga mengatakan apakah sudutnya lancip, siku-siku, atau tumpul. Rumus yang sama menjumlahkan dua gaya pada sebuah sudut dan mengubah dua leg perjalanan menjadi jarak. ### Poin penting - Pada $c^2=a^2+b^2-2ab\cos C$, $C$ adalah sudut di antara $a$ dan $b$, yang juga sudut di depan $c$. Pada $C=90^\circ$, $\cos C=0$ dan ia menjadi teorema Pythagoras; untuk sudut lancip koreksinya mengurangi dan $c$ lebih pendek daripada sisi miring bersisi tegak yang sama, untuk sudut tumpul ia menambah. - Ia mengikuti dari satu garis tinggi dan Pythagoras: garis tinggi membagi $a$ menjadi $b\cos C$ dan $a-b\cos C$ (yang pertama negatif, dan kakinya jatuh di luar, bila $C$ tumpul), dan $c^2=h^2+(a-b\cos C)^2$ dengan $h=b\sin C$. - Dua sisi dan sudut apitnya (SAS) memberi sisi ketiga secara langsung. Tiga sisi (SSS) memberi setiap sudut, $\cos C=\frac{a^2+b^2-c^2}{2ab}$: cari sudut terbesar dulu, yang di depan sisi terpanjang, karena hanya ia yang dapat tumpul. - Karena $-1\le\cos C\le1$, sisi ketiga selalu berada di antara $|a-b|$ dan $a+b$: aturan itu memuat ketaksamaan segitiga. Dan membandingkan $c^2$ dengan $a^2+b^2$ memberi tahu lancip, siku-siku, atau tumpul dari sisi-sisinya saja, yang membuktikan kebalikan teorema Pythagoras. - Dua gaya $F_1$ dan $F_2$ yang arahnya membentuk sudut $\theta$ menjumlah menjadi $R$ dengan $R^2=F_1^2+F_2^2+2F_1F_2\cos\theta$, dengan plus karena sudut segitiganya $180^\circ-\theta$. Perjalanan dua leg pada arah mata angin adalah segitiga yang sama, dan aturan itu memberi jarak dan arah pulang. - Dalam program, bentuk arkus kosinus kehilangan sudut segitiga tipis: sisi $10^8$, $10^8$, dan $1$ memberi $\cos C$ yang dibulatkan menjadi $1$ dan sudut $0$ alih-alih $5{,}7\times10^{-7}$ derajat. Bentuk setengah sudut $\tan\frac C2=\sqrt{\frac{(s-a)(s-b)}{s(s-c)}}$, dengan $s-a$ dan $s-b$ dihitung sebagai $\frac{c\pm(b-a)}{2}$, menjaganya. ## Apa bunyi aturan kosinus? **Aturan kosinus mengatakan bahwa pada segitiga dengan sisi $a$ dan $b$ yang mengapit sudut $C$, sisi ketiga $c$, di depan $C$, memenuhi $c^2=a^2+b^2-2ab\cos C$.** Bacalah sebagai teorema Pythagoras ditambah koreksi. Bila $C$ sudut siku-siku, $\cos C=0$, koreksinya lenyap dan $c^2=a^2+b^2$. Bila $C$ lancip, $\cos C>0$ dan koreksinya mengurangi: sisi ketiga lebih pendek daripada sisi miring segitiga siku-siku dengan dua sisi tegak yang sama. Bila $C$ tumpul, $\cos C<0$ dan koreksinya menambah: ia lebih panjang. Huruf-hurufnya mengikuti kesepakatan yang sama seperti pada aturan sinus: $A$, $B$, $C$ adalah sudut dan $a$, $b$, $c$ sisi di depannya. Pada rumus di atas $C$ adalah sekaligus sudut di depan $c$ dan sudut di antara $a$ dan $b$, dan itu sudut yang sama. Dua bentuk lainnya adalah aturan yang sama dengan huruf dipindahkan: $a^2=b^2+c^2-2bc\cos A$ dan $b^2=a^2+c^2-2ac\cos B$. Menyelesaikan untuk kosinus memberi bentuk untuk mencari sudut: $$\cos C=\frac{a^2+b^2-c^2}{2ab}.$$ Pemeriksaan pertama dengan segitiga $13$, $14$, $15$: untuk sudut $A$ di depan $13$, $\cos A=\frac{14^2+15^2-13^2}{2\cdot14\cdot15}=\frac{252}{420}=0{,}6$, sehingga $A=53{,}13^\circ$, sudut yang sama seperti pada segitiga $3$-$4$-$5$. Kapan ia diperlukan? Aturan sinus memerlukan sebuah sisi bersama sudut di depannya; bila tak ada, dengan dua sisi dan sudut apitnya atau dengan tiga sisi, aturan kosinus adalah jalan masuknya (lihat [aturan sinus](https://nunada.my.id/artikel/aturan-sinus/#sines-or-cosines) untuk pilihan di antara keduanya, dan [artikel tentang segitiga](https://nunada.my.id/artikel/segitiga/#solve-a-triangle) untuk gambaran umumnya). ## Mengapa aturan kosinus benar? Bukti dengan satu garis tinggi **Aturan kosinus mengikuti dari teorema Pythagoras yang diterapkan pada segitiga siku-siku yang dipotong oleh sebuah garis tinggi.** Letakkan sudut $C$ di titik sudut $C$ dan jatuhkan garis tinggi $h$ dari $A$ ke garis $CB$. Pada segitiga siku-siku dengan sisi miring $b$ dan sudut $C$, sisi samping adalah $b\cos C$ dan tingginya $h=b\sin C$ (lihat [segitiga siku-siku](https://nunada.my.id/artikel/trigonometri-dasar/#right-triangles)). Garis tinggi itu membagi sisi $a$ menjadi $b\cos C$ dan $a-b\cos C$. Segitiga siku-siku yang lain memiliki sisi miring $c$ dan sisi tegak $h$ serta $a-b\cos C$, sehingga menurut Pythagoras $$c^2=h^2+(a-b\cos C)^2=b^2\sin^2C+a^2-2ab\cos C+b^2\cos^2C.$$ Kumpulkan $b^2\sin^2C+b^2\cos^2C=b^2$ (identitas $\sin^2C+\cos^2C=1$, lihat [identitas](https://nunada.my.id/artikel/identitas-trigonometri/#fundamental)) dan tersisa $$c^2=a^2+b^2-2ab\cos C.$$ Bila $C$ tumpul, kaki garis tinggi jatuh di luar segitiga, pada perpanjangan $a$, berjarak $-b\cos C$ (bilangan positif, karena $\cos C<0$) dari $C$, dan segitiga siku-siku memiliki sisi tegak $a+(-b\cos C)=a-b\cos C$. Perhitungannya sama persis, jadi satu rumus mencakup kedua kasus. **Bukti kedua, dengan koordinat.** Letakkan $C$ di titik asal, $B$ di $(a,0)$ dan $A$ di $(b\cos C,\,b\sin C)$. Kuadrat jarak $A$ ke $B$ adalah $(b\cos C-a)^2+(b\sin C)^2$, yang dijabarkan menjadi hal yang sama. Dalam bahasa vektor ia adalah identitas $|u-v|^2=|u|^2+|v|^2-2\,u\cdot v$ dengan $u\cdot v=|u||v|\cos C$, itulah sebabnya perkalian titik didefinisikan dengan kosinus. *Sudut $C$ lancip. Garis tinggi $h$ dari $A$ jatuh pada sisi $a$ dan membaginya menjadi $b\cos C$ dan $a-b\cos C$, dengan $h=b\sin C$. Pythagoras pada segitiga siku-siku di kanan memberi $c^2=h^2+(a-b\cos C)^2$, yang dengan $h=b\sin C$ dijabarkan menjadi $a^2+b^2-2ab\cos C$.* *Sudut $C$ tumpul. Kaki garis tinggi kini berada di luar segitiga, pada perpanjangan $a$, berjarak $|b\cos C|=-b\cos C$ dari $C$. Segitiga siku-siku itu memiliki sisi tegak $a+|b\cos C|=a-b\cos C$, sehingga perhitungan yang sama memberi $c^2=h^2+(a-b\cos C)^2=a^2+b^2-2ab\cos C$: rumusnya tak memerlukan kasus tersendiri, karena $\cos C$ negatif.* ## Bagaimana aturan itu mengubah teorema Pythagoras menjadi aturan untuk setiap sudut? **Bayangkan dua sisi dengan panjang tetap $a$ dan $b$ yang disambung dengan engsel, dengan sudut $C$ di antaranya: sisi ketiga $c$ adalah jarak antara ujung-ujung bebasnya, dan ia bertambah ketika engsel membuka.** Pada $C$ dekat $0^\circ$ kedua sisi hampir bertumpuk dan $c\approx|a-b|$. Pada $C=90^\circ$ keduanya tegak lurus dan $c=\sqrt{a^2+b^2}$. Pada $C$ dekat $180^\circ$ keduanya menunjuk berlawanan arah dan $c\approx a+b$. Di antaranya, $c$ bertambah terus, karena $\cos C$ menurun dari $1$ ke $-1$. Inilah ketaksamaan segitiga dalam penyamaran. Karena $-1\le\cos C\le1$, aturan itu memberi $a^2+b^2-2ab\le c^2\le a^2+b^2+2ab$, yaitu $(a-b)^2\le c^2\le(a+b)^2$, sehingga $$|a-b|\le c\le a+b.$$ Inilah aturan tanda dalam satu baris: $c^20$ ($C$ lancip), $c^2=a^2+b^2$ tepat ketika $C=90^\circ$, dan $c^2>a^2+b^2$ tepat ketika $C$ tumpul. Jadi teorema Pythagoras dan kebalikannya (segitiga dengan $c^2=a^2+b^2$ bersudut siku-siku di $C$) adalah satu kasus $\cos C=0$ dari satu aturan. Buka engsel di bawah, ubah kedua sisinya, dan lihat suku koreksi berganti tanda di sudut siku-siku. ## Bagaimana mencari sisi ketiga dari dua sisi, atau semua sudut dari tiga sisi? **Dengan dua sisi dan sudut apitnya (SAS), aturan kosinus memberi sisi ketiga dalam satu langkah; dengan tiga sisi (SSS), ia memberi tiap sudut, dan urutannya penting: mulailah dari sudut terbesar.** **SAS.** $a=7$, $b=10$, dan $C=120^\circ$. Maka $c^2=149-140\cos120^\circ=149+70=219$, sehingga $c=14{,}80$. Sudutnya tumpul dan koreksi $+70$ membuat $c$ lebih panjang daripada sisi miring $\sqrt{149}=12{,}21$. Kedua sudut lain berikutnya, dengan aturan kosinus lagi atau dengan [aturan sinus](https://nunada.my.id/artikel/aturan-sinus/#two-angles-and-a-side): $\sin A=\frac{7\sin120^\circ}{14{,}80}=0{,}4096$, dan karena $A$ bukan sudut terbesar ia lancip, sehingga $A=24{,}18^\circ$ dan $B=180^\circ-120^\circ-24{,}18^\circ=35{,}82^\circ$. **SSS.** Ambil sisi $5$, $7$, $10$. Sisi terpanjang, $10$, berada di depan sudut terbesar $C$, dan hanya ia yang dapat tumpul, jadi cari lebih dulu: $\cos C=\frac{25+49-100}{2\cdot5\cdot7}=\frac{-26}{70}=-0{,}3714$, dan kosinus yang negatif mengatakan $C=111{,}80^\circ$ tumpul (arkus kosinus mengembalikan satu sudut dari $0^\circ$ sampai $180^\circ$, sehingga ia tak dapat keliru tentang itu). Lalu $\cos A=\frac{49+100-25}{2\cdot7\cdot10}=\frac{124}{140}=0{,}8857$, $A=27{,}66^\circ$, dan $B=180^\circ-111{,}80^\circ-27{,}66^\circ=40{,}54^\circ$. Pemeriksaan: sudut-sudutnya berjumlah $180^\circ$, dan sudut terbesar menghadap sisi terpanjang. Mengapa yang terbesar dulu? Begitu sudut terbesar diketahui lancip (atau ditemukan tumpul) sudut lainnya pasti lancip, sehingga bahkan aturan sinus, yang arkus sinusnya hanya mengembalikan sudut lancip, aman untuk mereka. Mulai dari sudut yang lebih kecil dengan aturan sinus dan sudut terbesar yang tumpul memberi jawaban yang salah. ## Bagaimana mengetahui dari sisi-sisinya saja apakah segitiga lancip, siku-siku, atau tumpul? **Bandingkan kuadrat sisi terpanjang dengan jumlah kuadrat dua sisi lainnya: lebih kecil berarti semua sudut lancip, sama berarti sudut siku-siku, lebih besar berarti ada sudut tumpul.** Ini adalah aturan kosinus yang dibaca untuk tandanya. Bila $c$ sisi terpanjang, sudut $C$ di depannya adalah yang terbesar, dan $c^2-(a^2+b^2)=-2ab\cos C$ bertanda sama dengan $-\cos C$: negatif untuk $C$ lancip, nol untuk sudut siku-siku, positif untuk yang tumpul. Kedua sudut lain lebih kecil daripada $C$, sehingga lancip selama $C$ tidak tumpul; bila $C$ tumpul keduanya tetap lancip, karena segitiga memiliki paling banyak satu sudut $90^\circ$ atau lebih. | Sisi | $c^2$ | $a^2+b^2$ | Sudut terbesar | |---|---|---|---| | $4$, $5$, $6$ | $36$ | $41$ | lancip: $c^2a^2+b^2$ | Baris tengah adalah **kebalikan teorema Pythagoras**: bila kuadrat sisi-sisinya memenuhi $c^2=a^2+b^2$, segitiga itu bersudut siku-siku di depan $c$. Kebalikannya tidak jelas dari pernyataan teorema saja, tetapi dengan aturan kosinus ia hanya satu baris: $c^2=a^2+b^2$ memaksa $-2ab\cos C=0$, sehingga $\cos C=0$ dan $C=90^\circ$. Uji ini hanya memerlukan kuadrat panjang, sehingga dapat dikerjakan secara eksak (lihat [jenis-jenis segitiga](https://nunada.my.id/artikel/segitiga/#types)). ## Bagaimana menjumlahkan dua gaya yang menarik pada sebuah sudut? **Dua gaya yang menarik pada arah yang membentuk sudut $\theta$ menjumlah menjadi satu gaya $R$ dengan $R^2=F_1^2+F_2^2+2F_1F_2\cos\theta$, yaitu aturan kosinus dengan sudut jajar genjang yang lain.** Gambar $F_1$ lalu $F_2$ dari ujungnya: resultan $R$ menutup segitiganya. Sudut segitiga itu di ujung $F_1$ bukan $\theta$ melainkan $180^\circ-\theta$, karena arah $F_2$ membentuk $\theta$ dengan perpanjangan $F_1$. Karena $\cos(180^\circ-\theta)=-\cos\theta$, minus pada aturan itu menjadi plus. **Contoh.** $30$ N dan $40$ N dengan $60^\circ$ di antara arahnya: $R^2=2500+2400\cos60^\circ=2500+1200=3700$, sehingga $R=60{,}83$ N. Pada $90^\circ$ ia $\sqrt{900+1600}=50$ N, teorema Pythagoras. Pada $0^\circ$ gaya menarik ke arah yang sama dan menjumlah, $70$ N; pada $180^\circ$ saling berlawanan dan mengurang, $10$ N. Arah $R$ membentuk sudut $\arctan\frac{F_2\sin\theta}{F_1+F_2\cos\theta}=34{,}7^\circ$ dengan $F_1$. Aturan yang sama menjumlah dua vektor mana pun, seperti kecepatan (perahu dan arus) atau perpindahan. Kesalahan yang harus dihindari adalah menulis minus: ia milik sudut di dalam segitiga, plus milik sudut antara kedua arah sebagaimana diberikan soal. *Dua gaya $30$ N dan $40$ N yang arahnya membentuk sudut $60^\circ$ (digambar pada sepersepuluh skala). Jumlahnya $R$ adalah diagonal jajar genjang, dan segitiga $0,F_1,R$ memiliki sudut $180^\circ-60^\circ=120^\circ$ di ujung $F_1$. Jadi $R^2=30^2+40^2-2\cdot30\cdot40\cos120^\circ=3700$ dan $R\approx60{,}83$ N.* ## Bagaimana mencari jarak dan arah setelah perjalanan dua leg? **Perjalanan dua leg lurus adalah dua sisi sebuah segitiga, jarak kembali ke awal adalah sisi ketiga, dan aturan kosinus memberikannya dari panjang kedua leg dan belokan di tikungan.** Arah mata angin (bearing) adalah sudut yang diukur searah jarum jam dari utara, ditulis tiga angka ($060^\circ$, $085^\circ$), seperti kapal atau pesawat dikemudikan. Bila haluan berubah dari arah $b_1$ ke $b_2$, ia berbelok sebesar $|b_2-b_1|$ (lewat jalan yang lebih pendek, tak pernah lebih dari $180^\circ$), dan sudut segitiga di tikungan adalah $180^\circ$ dikurangi belokan itu. **Contoh.** $120$ km pada $060^\circ$, lalu $90$ km pada $120^\circ$. Belokannya $60^\circ$, jadi sudut di tikungan $120^\circ$ dan jarak kembali $$s=\sqrt{120^2+90^2-2\cdot120\cdot90\cos120^\circ}=\sqrt{33300}=182{,}48\ \text{km}.$$ Untuk arahnya, cari sudut di awal antara leg pertama dan garis lurus, lagi dengan aturan kosinus pada ketiga sisi: sudut di awal ada di depan leg kedua sepanjang $90$ km, sehingga $\cos\alpha=\frac{120^2+182{,}48^2-90^2}{2\cdot120\cdot182{,}48}=0{,}9042$ dan $\alpha=25{,}3^\circ$. Haluan berbelok ke kanan di tikungan, jadi ujungnya berada di kanan arah pertama: arah akhir $060^\circ+25{,}3^\circ=085{,}3^\circ$. Arah pulang $085{,}3^\circ+180^\circ=265{,}3^\circ$. Atur perjalananmu sendiri di bawah; widget mencari sudut di awal dengan aturan kosinus dan memilih sisinya dari arah belokan. *Sebuah kapal berlayar $120$ km pada arah $060^\circ$ (diukur searah jarum jam dari utara) lalu $90$ km pada arah $120^\circ$. Haluan berbelok $60^\circ$ di tikungan, sehingga sudut segitiga di sana $180^\circ-60^\circ=120^\circ$ dan aturan kosinus memberi jarak ke awal: $\sqrt{120^2+90^2-2\cdot120\cdot90\cos120^\circ}=\sqrt{33300}\approx182{,}5$ km, pada arah $085{,}3^\circ$.* ## Bagaimana aturan kosinus terhubung dengan rumus Heron dan panjang garis berat? **Dua rumus klasik keluar dari aturan kosinus lewat aljabar: luas dari tiga sisi (Heron) dan panjang garis berat (Apollonius).** **Rumus Heron.** Luasnya $K=\frac12ab\sin C$, sehingga $16K^2=4a^2b^2\sin^2C=4a^2b^2(1-\cos^2C)$. Masukkan $2ab\cos C=a^2+b^2-c^2$ dari aturan itu: $$16K^2=4a^2b^2-(a^2+b^2-c^2)^2=\left[2ab-(a^2+b^2-c^2)\right]\left[2ab+(a^2+b^2-c^2)\right].$$ Kurung pertama adalah $c^2-(a-b)^2=(c-a+b)(c+a-b)$ dan yang kedua $(a+b)^2-c^2=(a+b-c)(a+b+c)$, sehingga $16K^2=(a+b+c)(-a+b+c)(a-b+c)(a+b-c)$, yang dengan $s=\frac{a+b+c}{2}$ adalah $K=\sqrt{s(s-a)(s-b)(s-c)}$. Untuk $13$, $14$, $15$ ini $\sqrt{21\cdot8\cdot7\cdot6}=84$ (lihat [luas segitiga](https://nunada.my.id/artikel/segitiga/#perimeter-and-area)). **Garis berat.** Misalkan $m_c$ garis berat dari $C$ ke titik tengah $M$ sisi $c$. Terapkan aturan kosinus pada dua segitiga $ACM$ dan $BCM$, yang sudutnya di $M$ berjumlah $180^\circ$, sehingga kosinusnya berlawanan: $a^2=m_c^2+\frac{c^2}{4}-m_cc\cos\mu$ dan $b^2=m_c^2+\frac{c^2}{4}+m_cc\cos\mu$. Jumlahkan kedua persamaan itu dan kosinusnya saling meniadakan: $$a^2+b^2=2m_c^2+\frac{c^2}{2}\quad\Rightarrow\quad m_c=\frac12\sqrt{2a^2+2b^2-c^2}.$$ Untuk $a=13$, $b=15$, $c=14$: $m_c=\frac12\sqrt{338+450-196}=\frac12\sqrt{592}=12{,}17$. Pada segitiga siku-siku dengan $a=6$, $b=8$, $c=10$ ia memberi $\frac12\sqrt{72+128-100}=5$, setengah sisi miring, fakta tentang pusat lingkaran luar segitiga siku-siku (lihat [garis berat dan titik-titik penting](https://nunada.my.id/artikel/segitiga/#centers)). ## Mengapa aturan kosinus kehilangan sudut segitiga tipis, dan apa yang dilakukan? **Untuk segitiga yang sangat tipis, bentuk arkus kosinus $\arccos\frac{a^2+b^2-c^2}{2ab}$ membuang sudutnya, karena kosinus sudut yang sangat kecil adalah bilangan yang dibulatkan menjadi $1$; bentuk setengah sudut menjaganya.** Ambil sisi $10^8$, $10^8$, dan $1$. Sudut sebenarnya di depan sisi $1$ adalah $2\arcsin\frac{1}{2\cdot10^8}=5{,}73\times10^{-7}$ derajat. Tetapi $a^2+b^2=2\times10^{16}$ dan mengurangkan $c^2=1$ tidak mengubah apa pun yang dapat ditunjukkan bilangan presisi ganda (jarak antar-bilangan ganda di dekat $2\times10^{16}$ adalah $4$), sehingga rasionya tepat $1$ dan arkus kosinusnya tepat $0$: sudutnya lenyap. Sebelum titik itu, sudutnya benar tetapi membawa makin sedikit digit: kosinus sudut dekat $0$ itu landai, sehingga galat $10^{-16}$ padanya adalah galat $10^{-8}$ radian pada sudutnya. Dua jalan keluar. Untuk segitiga tipis dengan sudut kecil $C$, cari sudut itu dengan aturan sinus, yang tidak mengkuadratkan apa pun. Atau pakai bentuk setengah sudut, dalam setengah keliling $s=\frac{a+b+c}{2}$: $$\tan\frac C2=\sqrt{\frac{(s-a)(s-b)}{s(s-c)}}.$$ Ia memerlukan kehati-hatian di satu tempat: $s-a=\frac{b+c-a}{2}$ adalah selisih kecil bilangan besar bila $c$ sangat kecil, jadi tulis $s-a=\frac{c+(b-a)}{2}$ dan $s-b=\frac{c-(b-a)}{2}$, tempat pengurangan $b-a$ dua sisi panjang yang berdekatan itu eksak. Widget di bawah memperlihatkan kedua bentuk untuk tiga sisi mana pun; coba "sangat tipis". ## Bagaimana memakai aturan kosinus dalam program? **Program memakai aturan kosinus dalam tiga fungsi: sisi ketiga dari dua sisi dan sudut apit, sudut dari tiga sisi, dan resultan dua vektor; satu-satunya tempat yang memerlukan kehati-hatian adalah sudut dari tiga sisi.** Ubah derajat ke radian sebelum `cos`, periksa ketaksamaan segitiga sebelum mengambil arkus kosinus, dan batasi rasionya ke $[-1,1]$ agar pembulatan tidak membuat `acos` gagal. Untuk segitiga tipis, jangan percaya arkus kosinus biasa, seperti yang ditunjukkan bagian di atas. Program di bawah mencari sisi ketiga untuk $a=7$, $b=10$, $C=120^\circ$ (memberi $14{,}7986$), ketiga sudut segitiga $5$, $7$, $10$ (terbesar dulu: $111{,}80^\circ$, $27{,}66^\circ$, $40{,}54^\circ$), resultan $30$ N dan $40$ N pada $60^\circ$ ($60{,}83$ N), dan segitiga tipis $10^8$, $10^8$, $1$ yang sudutnya, dalam sepersejuta derajat, adalah $0$ menurut arkus kosinus dan $0{,}573$ menurut bentuk setengah sudut. ```python import math def third_side(a, b, C): """The side opposite C (degrees) between the sides a and b: c^2 = a^2 + b^2 - 2ab cos C.""" return math.sqrt(a * a + b * b - 2 * a * b * math.cos(math.radians(C))) def angle_naive(a, b, c): """The angle opposite c by the arccosine, the ratio clamped into [-1, 1].""" x = (a * a + b * b - c * c) / (2 * a * b) return math.degrees(math.acos(max(-1.0, min(1.0, x)))) def angle_stable(a, b, c): """The same angle by the half-angle form; s - a and s - b are written (c +- (b - a)) / 2 so a tiny c is not lost.""" u = (c + (b - a)) / 2 v = (c - (b - a)) / 2 s = (a + b + c) / 2 return math.degrees(2 * math.atan(math.sqrt(u * v / (s * (s - c))))) def resultant(F1, F2, theta): """The size of the sum of two forces whose directions make the angle theta (degrees).""" return math.sqrt(F1 * F1 + F2 * F2 + 2 * F1 * F2 * math.cos(math.radians(theta))) print(round(third_side(7, 10, 120), 4)) # 14.7986 a, b, c = 5, 7, 10 # the largest angle first: the one opposite the longest side C = angle_naive(a, b, c) A = angle_naive(b, c, a) print(round(C, 2), round(A, 2), round(180 - C - A, 2)) # 111.8 27.66 40.54 print(round(resultant(30, 40, 60), 2)) # 60.83 print(round(angle_naive(1e8, 1e8, 1) * 1e6, 4), round(angle_stable(1e8, 1e8, 1) * 1e6, 4)) # 0.0 0.573 ``` ```javascript const rad = (d) => (d * Math.PI) / 180 const deg = (r) => (r * 180) / Math.PI // the side opposite C (degrees) between the sides a and b: c^2 = a^2 + b^2 - 2ab cos C const thirdSide = (a, b, C) => Math.sqrt(a * a + b * b - 2 * a * b * Math.cos(rad(C))) // the angle opposite c by the arccosine, the ratio clamped into [-1, 1] function angleNaive(a, b, c) { const x = (a * a + b * b - c * c) / (2 * a * b) return deg(Math.acos(Math.max(-1, Math.min(1, x)))) } // the same angle by the half-angle form; s - a and s - b are written (c +- (b - a)) / 2 so a tiny c is not lost function angleStable(a, b, c) { const u = (c + (b - a)) / 2 const v = (c - (b - a)) / 2 const s = (a + b + c) / 2 return deg(2 * Math.atan(Math.sqrt((u * v) / (s * (s - c))))) } // the size of the sum of two forces whose directions make the angle theta (degrees) const resultant = (F1, F2, theta) => Math.sqrt(F1 * F1 + F2 * F2 + 2 * F1 * F2 * Math.cos(rad(theta))) +thirdSide(7, 10, 120).toFixed(4) // 14.7986 const [a, b, c] = [5, 7, 10] // the largest angle first: the one opposite the longest side const C = angleNaive(a, b, c) const A = angleNaive(b, c, a) ;[+C.toFixed(2), +A.toFixed(2), +(180 - C - A).toFixed(2)] // [111.8, 27.66, 40.54] +resultant(30, 40, 60).toFixed(2) // 60.83 ;[+(angleNaive(1e8, 1e8, 1) * 1e6).toFixed(4), +(angleStable(1e8, 1e8, 1) * 1e6).toFixed(4)] // [0, 0.573] ``` ```cpp #include #include #include using namespace std; const double PI = 3.14159265358979323846; double rad(double d) { return d * PI / 180.0; } double deg(double r) { return r * 180.0 / PI; } // the side opposite C (degrees) between the sides a and b double thirdSide(double a, double b, double C) { return sqrt(a * a + b * b - 2 * a * b * cos(rad(C))); } // the angle opposite c by the arccosine, the ratio clamped into [-1, 1] double angleNaive(double a, double b, double c) { double x = (a * a + b * b - c * c) / (2 * a * b); if (x > 1) x = 1; if (x < -1) x = -1; return deg(acos(x)); } // the same angle by the half-angle form; s - a and s - b are written (c +- (b - a)) / 2 so a tiny c is not lost double angleStable(double a, double b, double c) { double u = (c + (b - a)) / 2; double v = (c - (b - a)) / 2; double s = (a + b + c) / 2; return deg(2 * atan(sqrt(u * v / (s * (s - c))))); } // the size of the sum of two forces whose directions make the angle theta (degrees) double resultant(double F1, double F2, double theta) { return sqrt(F1 * F1 + F2 * F2 + 2 * F1 * F2 * cos(rad(theta))); } int main() { printf("%.4f\n", thirdSide(7, 10, 120)); double C = angleNaive(5, 7, 10); // the largest angle first: the one opposite the longest side double A = angleNaive(7, 10, 5); printf("%.2f %.2f %.2f\n", C, A, 180 - C - A); printf("%.2f\n", resultant(30, 40, 60)); printf("%.4f %.4f\n", angleNaive(1e8, 1e8, 1) * 1e6, angleStable(1e8, 1e8, 1) * 1e6); return 0; } /* output: 14.7986 111.80 27.66 40.54 60.83 0.0000 0.5730 */ ``` ## Dari mana aturan kosinus berasal? **Aturan kosinus lebih tua daripada kosinus: Euclid membuktikannya sebagai dua teorema tentang persegi dan persegi panjang, dan ia menjadi rumus hanya ketika kosinus menjadi bilangan.** - **Sekitar 300 SM.** Elements Euclid, Buku II, Proposisi 12 dan 13, adalah aturan kosinus dalam bahasa geometri: pada segitiga tumpul kuadrat sisi di depan sudut tumpul lebih besar daripada kuadrat dua sisi lainnya sebesar dua kali sebuah persegi panjang, dan pada segitiga lancip ia lebih kecil sebesar dua kali sebuah persegi panjang. Persegi panjang itu adalah $a\cdot b\cos C$, dibangun dari sebuah sisi dan proyeksi sisi lainnya. - **Abad ke-15.** Jamshid al-Kashi, yang bekerja di Samarkand, menyatakan aturan itu dalam bentuk yang cocok untuk menghitung sebuah sisi dari dua sisi dan sudut apitnya dengan tabel sinus. Di Prancis ia masih disebut teorema Al-Kashi. - **1748.** Introductio karya Euler memperlakukan sinus dan kosinus sebagai fungsi bilangan, sehingga persegi panjang itu dapat ditulis $ab\cos C$ dan aturannya sebagai satu rumus yang dipakai sekarang. - **Abad ke-19 dan ke-20.** Dengan vektor, aturan itu menjadi $|u-v|^2=|u|^2+|v|^2-2\,u\cdot v$, dan perkalian titik $u\cdot v=|u||v|\cos\theta$ didefinisikan agar ini berlaku, yang membawa aturan itu ke dimensi mana pun. ## Apa kesalahan umum pada aturan kosinus? **Kesalahan paling umum pada aturan kosinus adalah sembilan hal berikut, masing-masing dengan pernyataan yang benar.** | Kesalahan | Yang benar | |---|---| | ❌ $c^2=a^2+b^2-2ab\cos A$ (sudut yang salah) | Sudutnya $C$, di antara $a$ dan $b$ dan di depan $c$. | | ❌ $c=a+b-2ab\cos C$ (lupa kuadrat) | Ruas kiri adalah $c^2$; tarik akar kuadrat di akhir. | | ❌ $(a^2+b^2-2ab)\cos C$ | Kosinus hanya mengalikan suku $2ab$: $a^2+b^2-2ab\cos C$. | | ❌ Mengambil $\arccos$ dari rasio tanpa memeriksa | Periksa ketaksamaan segitiga dulu, dan batasi rasio ke $[-1,1]$ dalam program. | | ❌ Kalkulator mode radian dengan data derajat | Atur ke derajat, atau ubah, kalau tidak setiap kosinus salah. | | ❌ $R^2=F_1^2+F_2^2-2F_1F_2\cos\theta$ untuk gaya pada sudut $\theta$ | Sudut segitiganya $180^\circ-\theta$: $R^2=F_1^2+F_2^2+2F_1F_2\cos\theta$. | | ❌ Mencari sudut kecil dulu dengan arkus kosinus lalu mengurangi untuk mendapat yang terbesar | Cari sudut terbesar dulu (di depan sisi terpanjang); hanya ia yang dapat tumpul. | | ❌ Mempercayai $\arccos$ untuk segitiga yang sangat tipis | Kosinus dibulatkan menjadi $1$: pakai bentuk setengah sudut atau aturan sinus. | | ❌ Arah mata angin diukur dari sumbu timur | Arah diukur searah jarum jam dari utara, dengan tiga angka ($060^\circ$). | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: aturan kosinus sekilas - **Aturannya:** $c^2=a^2+b^2-2ab\cos C$, dengan $C$ di antara $a$ dan $b$ dan di depan $c$; dan $\cos C=\frac{a^2+b^2-c^2}{2ab}$. - **Pythagoras dengan koreksi:** pada $90^\circ$ ia lenyap; lancip mengurangi, tumpul menambah. - **Bukti:** garis tinggi membagi $a$ menjadi $b\cos C$ dan $a-b\cos C$ (yang pertama negatif untuk $C$ tumpul), dan $h=b\sin C$. - **Jangkauan dan jenis:** $|a-b|\le c\le a+b$; membandingkan $c^2$ dengan $a^2+b^2$ memberi lancip, siku-siku, atau tumpul, dan membuktikan kebalikan Pythagoras. - **SAS:** sisi ketiga dalam satu langkah. **SSS:** tiap sudut; yang terbesar dulu. - **Gaya:** $R^2=F_1^2+F_2^2+2F_1F_2\cos\theta$ untuk sudut $\theta$ di antara arahnya. **Perjalanan:** sudut di tikungan adalah $180^\circ$ dikurangi belokan. - **Heron dan garis berat:** $16K^2=4a^2b^2-(a^2+b^2-c^2)^2$ memberi rumus Heron; $m_c=\frac12\sqrt{2a^2+2b^2-c^2}$. - **Numerik:** arkus kosinus kehilangan sudut segitiga tipis; pakai $\tan\frac C2=\sqrt{\frac{(s-a)(s-b)}{s(s-c)}}$ dengan $s-a=\frac{c+(b-a)}{2}$ dan $s-b=\frac{c-(b-a)}{2}$. ## Glosarium: istilah penting - **Aturan kosinus**: Aturan bahwa pada segitiga kuadrat sebuah sisi sama dengan jumlah kuadrat dua sisi lainnya dikurangi dua kali hasil kalinya kali kosinus sudut di antaranya. - **Sudut apit**: Sudut di antara dua sisi yang diberikan pada segitiga, yang juga sudut di depan sisi ketiga. - **Suku koreksi**: Suku minus 2ab cos C yang mengubah teorema Pythagoras menjadi aturan kosinus; ia nol pada sudut siku-siku, negatif untuk sudut lancip, dan positif untuk yang tumpul. - **Ketaksamaan segitiga**: Aturan bahwa tiap sisi segitiga lebih pendek daripada jumlah dua sisi lainnya dan lebih panjang daripada selisihnya, yang termuat dalam aturan kosinus. - **Resultan**: Gaya atau vektor tunggal yang sama dengan jumlah dua lainnya; besarnya mengikuti aturan kosinus dengan sudut 180 derajat dikurangi sudut di antara arahnya. - **Arah mata angin**: Arah yang diberikan sebagai sudut yang diukur searah jarum jam dari utara, ditulis dengan tiga angka, seperti 060 derajat. - **Garis berat**: Ruas dari sebuah titik sudut segitiga ke titik tengah sisi di depannya; panjangnya setengah akar dari 2a kuadrat ditambah 2b kuadrat dikurangi c kuadrat. - **Bentuk setengah sudut**: Rumus tan C per 2 sama dengan akar dari s dikurangi a kali s dikurangi b per s kali s dikurangi c, yang mencari sudut dari tiga sisi tanpa kehilangan digit sudut yang sangat kecil. ## Pertanyaan yang sering diajukan ### Apa rumus aturan kosinus? Pada segitiga dengan sisi a, b, c dan sudut C di antara a dan b, c kuadrat sama dengan a kuadrat ditambah b kuadrat dikurangi 2 a b kali kosinus C. Untuk sudut siku-siku kosinusnya nol dan ia menjadi teorema Pythagoras. ### Bagaimana membuktikan aturan kosinus? Jatuhkan garis tinggi dari A ke sisi a. Ia membagi a menjadi b cos C dan a dikurangi b cos C, dan tingginya b sin C. Pythagoras pada segitiga siku-siku di sisi lain memberi c kuadrat, dan sin kuadrat ditambah cos kuadrat sama dengan 1 menyelesaikannya. ### Kapan memakai aturan kosinus alih-alih aturan sinus? Ketika tak ada sisi yang disertai sudut di depannya: dua sisi dan sudut apitnya, atau tiga sisi. Dengan sebuah sisi dan sudut di depannya diketahui, aturan sinus lebih cepat. Untuk mencari sudut, aturan kosinus juga lebih aman. ### Bagaimana mencari sudut dari tiga sisi? Pakai cos C sama dengan a kuadrat ditambah b kuadrat dikurangi c kuadrat, per 2 a b, dan ambil arkus kosinus. Cari sudut terbesar dulu, di depan sisi terpanjang, karena hanya ia yang dapat tumpul; kosinus negatif berarti tumpul. ### Mengapa aturan kosinus menjadi teorema Pythagoras pada 90 derajat? Kosinus 90 derajat adalah nol, sehingga suku minus 2 a b cos C lenyap dan c kuadrat sama dengan a kuadrat ditambah b kuadrat. Suku itu adalah koreksi untuk sudut yang bukan siku-siku: negatif bila lancip, positif bila tumpul. ### Bagaimana menjumlahkan dua gaya pada sebuah sudut? Pakai R kuadrat sama dengan F1 kuadrat ditambah F2 kuadrat ditambah 2 F1 F2 cos theta, dengan theta sudut di antara arah kedua gaya. Ia plus karena sudut di dalam segitiga adalah 180 derajat dikurangi theta. ### Mengapa aturan kosinus memberi sudut yang salah untuk segitiga yang sangat tipis? Kosinus sudut yang sangat kecil adalah bilangan yang sangat dekat dengan 1, yang dibulatkan komputer menjadi tepat 1, sehingga arkus kosinus mengembalikan 0. Pakai rumus setengah sudut untuk tan C per 2, atau aturan sinus, yang menjaga digitnya. ### Bagaimana mencari jarak setelah dua leg perjalanan dengan arah berbeda? Sudut segitiga di tikungan adalah 180 derajat dikurangi belokan di antara kedua arah. Lalu jaraknya adalah akar dari d1 kuadrat ditambah d2 kuadrat dikurangi 2 d1 d2 kali kosinus sudut itu. --- # Law of Sines: Solving Triangles, the Ambiguous Case and Surveying Source: https://nunada.my.id/articles/law-of-sines/ Updated: 2026-10-29 ## Quick answer **The law of sines says that in every triangle each side divided by the sine of the opposite angle gives the same number, $\frac{a}{\sin A}=\frac{b}{\sin B}=\frac{c}{\sin C}$, and that number is the diameter $2R$ of the circle through the three vertices.** It solves a triangle once you know a side and its opposite angle, plus one more angle or side: two angles and a side give one triangle, while two sides and an angle opposite one of them give none, one or two. It also gives the area $\frac12ab\sin C$. ### Key takeaways - In a triangle with sides $a$, $b$, $c$ opposite the angles $A$, $B$, $C$, $\frac{a}{\sin A}=\frac{b}{\sin B}=\frac{c}{\sin C}$. It holds for every triangle, acute or obtuse, since $\sin(180^\circ-x)=\sin x$. - The proof is one altitude: $h=b\sin A=a\sin B$. The common value is the diameter of the circumscribed circle: $\frac{a}{\sin A}=2R$, because a diameter from $B$ makes a right triangle with the side $a$ as a leg. - Two angles and any side (ASA or AAS) determine one triangle: find the third angle as $180^\circ-A-B$, then use $k=\frac{a}{\sin A}$ and $b=k\sin B$, $c=k\sin C$. - Two sides and an angle opposite one of them (SSA) can give zero, one or two triangles. The sine of the unknown angle has two answers between $0^\circ$ and $180^\circ$, $B$ and $180^\circ-B$, and each is a triangle if it leaves room for the third angle. - The area is $\frac12ab\sin C$ with any pair of sides and the angle between them, and also $\frac{abc}{4R}$. Two angles and a side give it as $\frac{a^2\sin B\sin C}{2\sin A}$. - From a baseline $L$ and two angles to a far point, the law of sines gives its distance, but an error of one degree in a reading can move the answer by $5\%$ or by $25\%$ depending on the angle at the point: lines of sight that cross at nearly a right angle are the steadiest. ## What does the law of sines say? **The law of sines says that in every triangle the ratio of a side to the sine of the angle opposite it is the same for all three sides: $\frac{a}{\sin A}=\frac{b}{\sin B}=\frac{c}{\sin C}$.** The letters follow one convention: $A$, $B$, $C$ are the angles, and $a$, $b$, $c$ the sides opposite them, so $a$ is the side across from $A$. Take the $3$-$4$-$5$ right triangle: the angle opposite the side $3$ is $36.87^\circ$, whose sine is $0.6$, and $\frac{3}{0.6}=5$; opposite $4$ is $53.13^\circ$ with sine $0.8$ and $\frac{4}{0.8}=5$; and opposite $5$ is the right angle, with sine $1$ and $\frac{5}{1}=5$. All three ratios are $5$. It is usually written in one of three equivalent ways. As a chain of ratios (above). As proportions, $a:b:c=\sin A:\sin B:\sin C$, which says that the sides are in the same proportion as the sines of their opposite angles (not as the angles themselves). Or upside down, $\frac{\sin A}{a}=\frac{\sin B}{b}=\frac{\sin C}{c}$, which is the form to use when the unknown is an angle. It holds for obtuse triangles too, because the sine of an obtuse angle is positive and equals the sine of its supplement, $\sin(180^\circ-x)=\sin x$. What it needs is a pair: a side together with the angle opposite it. Once you have one pair, any other side or angle gives you a second, and the equation can be solved for the missing one. This article shows why the law is true, what the common value means, how to use it in each case, and what goes wrong in one case, the ambiguous one. For solving a triangle in general, with the law of cosines as well, see [the article on triangles](https://nunada.my.id/articles/triangles/#solve-a-triangle). ## Why is the law of sines true? A proof with one altitude **The law of sines follows from writing the same altitude of the triangle in two ways.** Draw the altitude $h$ from $C$ down to the line $AB$. It splits the triangle into two right triangles that share the side $h$. In the one with the angle $A$ and hypotenuse $b$, the definition of the sine (see [the right triangle](https://nunada.my.id/articles/basic-trigonometry/#right-triangles)) gives $\sin A=\frac{h}{b}$, so $h=b\sin A$. In the one with the angle $B$ and hypotenuse $a$, $\sin B=\frac{h}{a}$, so $h=a\sin B$. The two expressions are the same length, so $b\sin A=a\sin B$. Divide both sides by $\sin A\sin B$ and you get $$\frac{a}{\sin A}=\frac{b}{\sin B}.$$ Draw an altitude from another vertex and the same argument ties $b$ and $c$, or $a$ and $c$, so all three ratios are equal. If the angle at $A$ or at $B$ is obtuse, the foot of the altitude falls outside the side $AB$, on its extension, and the right triangle that contains $h$ has the angle $180^\circ-A$ instead of $A$. Nothing changes, because $\sin(180^\circ-A)=\sin A$. That is also why the law holds for every triangle, and it is the seed of the ambiguous case later: an angle and its supplement have the same sine. *The altitude $h$ from $C$ makes two right triangles. In one, $h=b\sin A$; in the other, $h=a\sin B$. So $b\sin A=a\sin B$, which is $\frac{a}{\sin A}=\frac{b}{\sin B}$.* ## What is the common value of the three ratios? The circle through the vertices **The common value $\frac{a}{\sin A}=\frac{b}{\sin B}=\frac{c}{\sin C}$ is the diameter $2R$ of the circle that passes through the three vertices (the circumscribed circle), where $R$ is its radius.** To see why, draw that circle with centre $O$ and a diameter $BB'$ from the vertex $B$. Two facts about circles do the work. An angle that sits on a diameter is a right angle (Thales), so in the triangle $BCB'$ the angle at $C$ is $90^\circ$. And two angles that look at the same chord $BC$ from the same arc are equal, so the angle at $B'$ equals the angle $A$. In the right triangle $BCB'$ the side $BC=a$ is opposite the angle $B'=A$ and the hypotenuse is $BB'=2R$, hence $$\sin A=\frac{a}{2R},\qquad\text{that is}\qquad\frac{a}{\sin A}=2R.$$ (If $A$ is obtuse, $B'$ is on the other arc and its angle is $180^\circ-A$, with the same sine.) The same argument works from any vertex, so all three ratios are $2R$. This gives a formula for the circumradius, $R=\frac{a}{2\sin A}$, and a few quick consequences. In a right triangle with $C=90^\circ$, $\sin C=1$, so $c=2R$: the hypotenuse is a diameter, and the centre is the midpoint of the hypotenuse (the $3$-$4$-$5$ triangle has $R=2.5$). For the triangle with sides $13$, $14$, $15$, the angles are $53.13^\circ$, $59.49^\circ$ and $67.38^\circ$ and $\frac{13}{\sin53.13^\circ}=16.25$, so $R=8.125$. The centre of this circle, the circumcenter, is one of the triangle's four classical centres (see [the centres of a triangle](https://nunada.my.id/articles/triangles/#centers)). Set two angles and a side below and read the three ratios, the circle and the area. *The circle through $A$, $B$ and $C$, with centre $O$ and radius $R$. $BB'$ is a diameter, so the angle at $C$ is a right angle, and the angle at $B'$ equals the angle at $A$ (both look at the chord $BC$ from the same arc). In the right triangle $BCB'$: $\sin A=\frac{a}{2R}$.* ## How do you solve a triangle when you know two angles and a side? **When two angles and any side are known (ASA or AAS), the triangle is completely determined: find the third angle from the angle sum, then use the law of sines for the other two sides.** The third angle is free, because the three angles of a triangle add up to $180^\circ$ (see [the angle sum](https://nunada.my.id/articles/triangles/#angle-sum)). After that there is always a side with its opposite angle, which is the pair the law needs. 1. **Third angle.** $C=180^\circ-A-B$. If this is not positive, there is no triangle. 2. **The common ratio.** Compute $k=\frac{a}{\sin A}$ from the side and angle you were given. 3. **The other sides.** $b=k\sin B$ and $c=k\sin C$. 4. **Check.** The longest side must be opposite the largest angle, and the three ratios must agree. **Example.** $A=40^\circ$, $B=65^\circ$ and $a=12$. Then $C=180^\circ-40^\circ-65^\circ=75^\circ$ and $k=\frac{12}{\sin40^\circ}=18.6687$, so $b=18.6687\sin65^\circ=16.92$ and $c=18.6687\sin75^\circ=18.03$. The largest angle, $75^\circ$, is opposite the longest side, $18.03$, as it should be. The same triangle is described by ASA: given $A=40^\circ$, the side $c=18.03$ between the angles $A$ and $B$, and $B=65^\circ$, the same steps give the same sides. Two practical points. Keep the full value of $k$ in your calculator, and use the given data, not a rounded result of an earlier step, so that errors do not pile up. And if you know only angles, the triangle is not determined: every triangle similar to it has the same angles, and one side sets the size. ## Why do two sides and an angle sometimes give two triangles, or none? **Two sides and an angle opposite one of them (SSA) can give no triangle, one or two, because the sine of the unknown angle has two answers between $0^\circ$ and $180^\circ$, $B$ and $180^\circ-B$, and each one is a triangle only if it leaves room for the third angle.** Say $a$, $b$ and $A$ are given. The law of sines gives $\sin B=\frac{b\sin A}{a}$. Three things can happen. - If $\frac{b\sin A}{a}>1$, no angle has that sine: **no triangle**. The side $a$ is too short to reach. - If the value is exactly $1$, $B=90^\circ$: **one right triangle**. - Otherwise there are two angles, $B_1=\arcsin\left(\frac{b\sin A}{a}\right)$ (the acute one, the only one that a calculator reports) and $B_2=180^\circ-B_1$ (obtuse). The second one is a triangle only if $A+B_2<180^\circ$. The picture shows it. Put $A$ at the origin with a ray going right, and $C$ at distance $b$ from $A$ at the angle $A$. The unknown vertex $B$ is on the ray at distance $a$ from $C$: that is where the circle of radius $a$ around $C$ meets the ray. A circle and a ray can meet in $0$, $1$ or $2$ points, and the height of $C$ above the ray, $h=b\sin A$, decides which. | The angle $A$ | The side $a$ opposite it | Triangles | |---|---|---| | acute | $ab$ | one | | right or obtuse | $a\le b$ | none | **Example.** $a=3$, $b=5$, $A=30^\circ$. The height is $h=5\sin30^\circ=2.5$, and $2.5<3<5$: two triangles. $\sin B=\frac{5\sin30^\circ}{3}=\frac56=0.8333$, so $B_1=56.44^\circ$ and $B_2=123.56^\circ$. For $B_1$: $C=180^\circ-30^\circ-56.44^\circ=93.56^\circ$ and $c=\frac{3\sin93.56^\circ}{\sin30^\circ}=5.99$. For $B_2$: $C=26.44^\circ$ and $c=2.67$. Both fit the data. With $a=9$, $b=5$ and $A=120^\circ$ (obtuse) only one triangle exists: $B=28.76^\circ$, $C=31.24^\circ$, $c=5.39$, since a second angle $B$ of $151.24^\circ$ would leave no room next to $120^\circ$. And $a=2$, $b=5$, $A=30^\circ$ is shorter than $h=2.5$: no triangle. The ambiguity is exactly the equation $\sin B=c$ of [the article on trigonometric equations](https://nunada.my.id/articles/trigonometric-equations/#what-it-is): an inverse sine returns one angle, and the other is yours to find. Slide $a$ below and watch the circle. *The ambiguous case with $A=30^\circ$, $b=5$ and $a=3$. The vertex $C$ is fixed. The unknown vertex $B$ is on the ray from $A$ at distance $a=3$ from $C$, that is, where the circle of radius $3$ around $C$ meets the ray: at two points, $B_1$ and $B_2$, so two triangles ($c\approx2.67$ and $c\approx5.99$).* ## How does the law of sines connect to the area of a triangle? **The area of a triangle is half the product of two sides and the sine of the angle between them, $K=\frac12ab\sin C$, and putting it together with the law of sines gives $K=\frac{abc}{4R}$.** The first formula is the altitude formula with the height written as $h=b\sin C$ instead of measured: area is $\frac12\times$ base $a$ $\times$ height $h$, and the height from $A$ is $b\sin C$. It holds for any pair, $K=\frac12bc\sin A=\frac12ac\sin B=\frac12ab\sin C$, which is a good check on a solved triangle. Replace $\sin C$ by $\frac{c}{2R}$ (the law of sines) and it becomes $K=\frac12ab\cdot\frac{c}{2R}=\frac{abc}{4R}$, so the radius of the circle through the vertices is $R=\frac{abc}{4K}$. For the $13$, $14$, $15$ triangle the area is $84$ (see [the area of a triangle](https://nunada.my.id/articles/triangles/#perimeter-and-area)), so $R=\frac{13\cdot14\cdot15}{4\cdot84}=\frac{2730}{336}=8.125$, the same value as before. And $\frac12\cdot13\cdot14\cdot\sin67.38^\circ=84$ again. When two angles and a side are known (AAS) you do not even need the other sides: $K=\frac{a^2\sin B\sin C}{2\sin A}$. For $A=40^\circ$, $B=65^\circ$, $a=12$ this is $\frac{144\cdot0.9063\cdot0.9659}{2\cdot0.6428}=98.06$, the same as $\frac12\cdot12\cdot16.92\cdot\sin75^\circ$. This is how a plot of land is measured from a baseline and angles. ## How do you measure the width of a river with the law of sines? **To measure a distance you cannot walk, measure a baseline you can walk and two angles, and the law of sines does the rest; this is triangulation.** A tree $T$ stands on the far bank. On your bank you mark two points $P$ and $Q$ a known distance $L$ apart, and from each you read the angle between the baseline and the line of sight to the tree, $\alpha$ at $P$ and $\beta$ at $Q$. The three angles of the triangle $PQT$ add up to $180^\circ$, so the angle at the tree is $\gamma=180^\circ-\alpha-\beta$, and the law of sines pairs the side $L$ with the angle $\gamma$: $$\frac{PT}{\sin\beta}=\frac{L}{\sin\gamma}\quad\Rightarrow\quad PT=\frac{L\sin\beta}{\sin(\alpha+\beta)},\qquad QT=\frac{L\sin\alpha}{\sin(\alpha+\beta)}.$$ (because $\sin\gamma=\sin(180^\circ-\alpha-\beta)=\sin(\alpha+\beta)$). The width of the river is the perpendicular distance from $T$ to the baseline, $h=PT\sin\alpha$. **Example.** $L=100$ m, $\alpha=60^\circ$ and $\beta=70^\circ$. Then $\gamma=50^\circ$, $PT=\frac{100\sin70^\circ}{\sin50^\circ}=122.67$ m, $QT=\frac{100\sin60^\circ}{\sin50^\circ}=113.05$ m and the river is $h=122.67\sin60^\circ=106.23$ m wide. No one crossed the water. **How good is the answer?** The angles are read with an instrument, and every reading is a little off. If each of the two angles may be wrong by $1^\circ$, the width above could be anywhere from $101.2$ m to $111.3$ m, about $5\%$ either way. The error depends on the shape of the triangle: with $\alpha=\beta=85^\circ$ the lines of sight are nearly parallel, the angle at the tree is only $10^\circ$ and the same $1^\circ$ error can change the answer by $25\%$; with $\alpha=\beta=45^\circ$, a right angle at the tree, it is only $3.6\%$. A surveyor therefore chooses the baseline so that the two lines of sight cross at a healthy angle, near $90^\circ$. The method is older than any instrument: Thales' shadow measurement used similar triangles, as in [the article on triangles](https://nunada.my.id/articles/triangles/#congruence-similarity), and triangulation uses angles instead of shadows. Try your own baseline and angles below. *Measuring across a river. Two observers $P$ and $Q$ stand a distance $L$ apart on one bank and read the angles $\alpha$ and $\beta$ to a tree $T$ on the other. The angle at $T$ is $180^\circ-\alpha-\beta$, the law of sines gives $PT=\frac{L\sin\beta}{\sin(\alpha+\beta)}$, and the width is $h=PT\sin\alpha$. (Drawn with $L=100$ m, $\alpha=60^\circ$ and $\beta=70^\circ$, where $h\approx106$ m.)* ## When do you use the law of sines and when the law of cosines? **Use the law of sines when you know a side and its opposite angle (a pair), and the law of cosines when you do not.** Look at what the three given measurements are: | You know | Is there a pair? | Start with | |---|---|---| | two angles and a side (ASA, AAS) | yes, after the third angle | law of sines | | two sides and an angle opposite one (SSA) | yes | law of sines (check for two) | | two sides and the angle between them (SAS) | no | law of cosines for the third side | | three sides (SSS) | no | law of cosines for an angle | [The law of cosines](https://nunada.my.id/articles/law-of-cosines/#what-it-says), $c^2=a^2+b^2-2ab\cos C$, is the [Pythagorean theorem](https://nunada.my.id/articles/pythagorean-theorem/#generalizations) with a correction. It is the safer tool for finding an angle, since the arccosine returns a single angle between $0^\circ$ and $180^\circ$ and so tells acute from obtuse, while the arcsine cannot. A common plan for SAS: use the law of cosines for the third side, then find the smaller of the two other angles with the law of sines, because the smaller angle is always acute and the arcsine is then right. ## How do you use the law of sines in a program? **A program solves AAS directly and has to treat SSA as a list: compute $\sin B$, return nothing if it is above $1$, and otherwise try both $B$ and $180^\circ-B$.** Three details. Convert degrees to radians before calling `sin`. Do not call `asin` with a value that is $1.0000000000000002$ by rounding: allow a tiny margin and clamp. And keep the second angle only if the third, $180^\circ-A-B$, is positive. A program that returns the single acute $B$ silently loses the second triangle. The programs below solve $A=40^\circ$, $B=65^\circ$, $a=12$ (giving $b=16.9196$ and $c=18.0326$), then $a=3$, $b=5$, $A=30^\circ$ (two triangles, $B=56.44^\circ$ and $B=123.56^\circ$), count the triangles for $a=2$ and for the obtuse case $a=9$, $b=5$, $A=120^\circ$, and finally find the river width $106.23$ m. ```python import math def solve_aas(A, B, a): """Two angles (degrees) and the side a opposite A: the sides and angles (a, b, c, A, B, C), or None.""" C = 180 - A - B if min(A, B, C, a) <= 0: return None # the angles leave nothing for the third k = a / math.sin(math.radians(A)) # the common ratio, 2R return a, k * math.sin(math.radians(B)), k * math.sin(math.radians(C)), A, B, C def solve_ssa(a, b, A): """Two sides and the angle A opposite a: a list with 0, 1 or 2 triangles (a, b, c, A, B, C).""" s = b * math.sin(math.radians(A)) / a # sin B if s > 1 + 1e-12: return [] # no angle has a sine above 1 B1 = math.degrees(math.asin(min(1.0, s))) # asin gives only the acute angle found = [] for B in sorted({B1, 180 - B1}): # the other angle with the same sine C = 180 - A - B if C > 1e-9: # it is a triangle only if something is left for C found.append((a, b, a * math.sin(math.radians(C)) / math.sin(math.radians(A)), A, B, C)) return found def river_width(L, alpha, beta): """Baseline L and the angles alpha, beta at its ends: the distance from the target to the baseline.""" gamma = 180 - alpha - beta pt = L * math.sin(math.radians(beta)) / math.sin(math.radians(gamma)) return pt * math.sin(math.radians(alpha)) print([round(x, 4) for x in solve_aas(40, 65, 12)]) # [12, 16.9196, 18.0326, 40, 65, 75] for t in solve_ssa(3, 5, 30): print(round(t[4], 2), round(t[5], 2), round(t[2], 2)) # 56.44 93.56 5.99, then 123.56 26.44 2.67 print(len(solve_ssa(2, 5, 30)), len(solve_ssa(9, 5, 120))) # 0 1 print(round(river_width(100, 60, 70), 2)) # 106.23 ``` ```javascript const rad = (d) => (d * Math.PI) / 180 const deg = (r) => (r * 180) / Math.PI function solveAas(A, B, a) { // two angles (degrees) and the side a opposite A: [a, b, c, A, B, C], or null const C = 180 - A - B if (Math.min(A, B, C, a) <= 0) return null // the angles leave nothing for the third const k = a / Math.sin(rad(A)) // the common ratio, 2R return [a, k * Math.sin(rad(B)), k * Math.sin(rad(C)), A, B, C] } function solveSsa(a, b, A) { // two sides and the angle A opposite a: a list with 0, 1 or 2 triangles const s = (b * Math.sin(rad(A))) / a // sin B if (s > 1 + 1e-12) return [] // no angle has a sine above 1 const B1 = deg(Math.asin(Math.min(1, s))) // asin gives only the acute angle const found = [] for (const B of [...new Set([B1, 180 - B1])].sort((p, q) => p - q)) { // the other angle with the same sine const C = 180 - A - B if (C > 1e-9) found.push([a, b, (a * Math.sin(rad(C))) / Math.sin(rad(A)), A, B, C]) // a triangle only if something is left for C } return found } function riverWidth(L, alpha, beta) { // baseline L and the angles alpha, beta at its ends: the distance from the target to the baseline const gamma = 180 - alpha - beta const pt = (L * Math.sin(rad(beta))) / Math.sin(rad(gamma)) return pt * Math.sin(rad(alpha)) } solveAas(40, 65, 12).map((x) => +x.toFixed(4)) // [12, 16.9196, 18.0326, 40, 65, 75] solveSsa(3, 5, 30).map((t) => [+t[4].toFixed(2), +t[5].toFixed(2), +t[2].toFixed(2)]) // [[56.44, 93.56, 5.99], [123.56, 26.44, 2.67]] ;[solveSsa(2, 5, 30).length, solveSsa(9, 5, 120).length] // [0, 1] +riverWidth(100, 60, 70).toFixed(2) // 106.23 ``` ```cpp #include #include #include using namespace std; const double PI = 3.14159265358979323846; double rad(double d) { return d * PI / 180.0; } double deg(double r) { return r * 180.0 / PI; } double Bs[2], Cs[2], cs[2]; // the triangles of the last solveSsa call // Two sides and the angle A opposite a: fills Bs, Cs, cs and returns how many triangles (0, 1 or 2). int solveSsa(double a, double b, double A) { double s = b * sin(rad(A)) / a; // sin B if (s > 1 + 1e-12) return 0; // no angle has a sine above 1 if (s > 1) s = 1; double B1 = deg(asin(s)); // asin gives only the acute angle int count = 0; for (int i = 0; i < 2; i++) { double B = i == 0 ? B1 : 180 - B1; // the other angle with the same sine if (i == 1 && fabs(B - B1) < 1e-9) continue; double C = 180 - A - B; if (C > 1e-9) { // a triangle only if something is left for C Bs[count] = B; Cs[count] = C; cs[count] = a * sin(rad(C)) / sin(rad(A)); count++; } } return count; } double riverWidth(double L, double alpha, double beta) { double gamma = 180 - alpha - beta; double pt = L * sin(rad(beta)) / sin(rad(gamma)); return pt * sin(rad(alpha)); } int main() { double A = 40, B = 65, a = 12; // two angles and a side double C = 180 - A - B; double k = a / sin(rad(A)); // the common ratio, 2R printf("%.4f %.4f %.0f\n", k * sin(rad(B)), k * sin(rad(C)), C); int n = solveSsa(3, 5, 30); for (int i = 0; i < n; i++) printf("%.2f %.2f %.2f\n", Bs[i], Cs[i], cs[i]); int none = solveSsa(2, 5, 30); int obtuse = solveSsa(9, 5, 120); printf("%d %d\n", none, obtuse); printf("%.2f\n", riverWidth(100, 60, 70)); return 0; } /* output: 16.9196 18.0326 75 56.44 93.56 5.99 123.56 26.44 2.67 0 1 106.23 */ ``` ## Where does the law of sines come from? **The law of sines grew out of astronomy, was stated in its plane form by mathematicians writing in Arabic, and became the working tool of the surveyors who measured whole countries.** - **10th to 13th century.** Mathematicians writing in Arabic, among them Abu al-Wafa, al-Jayyani and al-Tusi, state and prove the law of sines, first for triangles on a sphere (needed for astronomy and for the direction of Mecca) and then for plane triangles. Al-Tusi's treatise on the quadrilateral is the best-known source for the plane form. - **1464.** Regiomontanus writes De triangulis omnimodis (printed in 1533), the first European book to treat triangles, with the law of sines, as a subject of its own and not as a chapter of astronomy. - **1533.** Gemma Frisius describes triangulation, fixing the position of a point from a measured baseline and two angles. - **1617.** Willebrord Snellius measures a degree of the meridian by a chain of triangles, the first measurement of the Earth by triangulation, in Eratosthenes Batavus. - **From 1802.** The Great Trigonometrical Survey of India, begun by William Lambton, carries a chain of triangles across the subcontinent from the south to the Himalaya, with angles read by instruments and sides computed by the law of sines. In 1856 it announced the height of Peak XV, later called Everest, as about $8.8$ km. ## What are the common mistakes with the law of sines? **The most common mistakes with the law of sines are the nine below, each with the correct statement.** | Mistake | Correct | |---|---| | ❌ $\frac{a}{\sin B}=\frac{b}{\sin A}$ (a side with the wrong angle) | Each side goes with the angle opposite it: $\frac{a}{\sin A}=\frac{b}{\sin B}$. | | ❌ $\frac{a}{A}=\frac{b}{B}$ (the angles themselves) | Sides are proportional to the sines of the angles, not to the angles. | | ❌ Take only $B=\arcsin\left(\frac{b\sin A}{a}\right)$ and stop | The other angle is $180^\circ-B$, and it may give a second triangle. | | ❌ Keep $B=180^\circ-B_1$ without checking | It is a triangle only if $A+B_2<180^\circ$. | | ❌ Go on when $\sin B$ comes out above $1$ | No angle has such a sine: there is no triangle. | | ❌ Use the law of sines for SAS or SSS | There is no known side–angle pair: use the law of cosines first. | | ❌ The longest side is opposite the smallest angle | It is opposite the largest angle. | | ❌ Round $k$ or $b$ and then use it to find $c$ | Use the given data and keep full precision until the end. | | ❌ Calculator in radian mode with degree data | Set degrees (or convert), or every sine is wrong. | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: the law of sines at a glance - **The law:** $\frac{a}{\sin A}=\frac{b}{\sin B}=\frac{c}{\sin C}$, with each side opposite its angle; true for every triangle, since $\sin(180^\circ-x)=\sin x$. - **Why:** the altitude is $h=b\sin A=a\sin B$; the common value is the diameter $2R$ of the circle through the vertices. - **ASA and AAS:** $C=180^\circ-A-B$, then $k=\frac{a}{\sin A}$, $b=k\sin B$, $c=k\sin C$; one triangle. - **SSA:** $\sin B=\frac{b\sin A}{a}$ has two answers, $B$ and $180^\circ-B$; with $h=b\sin A$ and an acute $A$: $ab$ one, otherwise none. - **Area:** $K=\frac12ab\sin C=\frac{abc}{4R}$; with AAS, $K=\frac{a^2\sin B\sin C}{2\sin A}$. - **Surveying:** baseline $L$ and angles $\alpha$, $\beta$ give $PT=\frac{L\sin\beta}{\sin(\alpha+\beta)}$ and the width $h=PT\sin\alpha$; lines of sight that cross near a right angle are steadiest. - **Which law:** a side with its opposite angle, use sines; SAS and SSS, use cosines first. ## Glossary: key terms - **Law of sines**: The rule that in every triangle each side divided by the sine of the opposite angle gives the same number, which is the diameter of the circle through the three vertices. - **Opposite angle**: The angle across the triangle from a given side, the one whose vertex is not an end of that side; side a is opposite angle A. - **Circumscribed circle**: The circle that passes through all three vertices of a triangle; its radius R satisfies a over sin A equal to 2R. - **ASA and AAS**: The cases in which two angles and a side of a triangle are known, which determine exactly one triangle. - **Ambiguous case (SSA)**: The case in which two sides and an angle opposite one of them are known, which can fit no triangle, one triangle or two triangles. - **Supplementary angles**: Two angles that add up to 180 degrees; they have the same sine, which is why the law of sines can give two answers. - **Baseline**: A measured distance between two observation points, from which the distance to a faraway point is found with two angles. - **Triangulation**: Finding the position of a point, or a distance, by measuring a baseline and the angles to the point and solving the triangle with the law of sines. ## Frequently asked questions ### What is the law of sines formula? In a triangle with sides a, b, c opposite the angles A, B, C, a over sin A equals b over sin B equals c over sin C. Each side divided by the sine of its opposite angle is the same number for all three sides. ### How do you prove the law of sines? Draw the altitude from one vertex. It equals b sin A and also a sin B, so b sin A equals a sin B, which rearranges to a over sin A equals b over sin B. Repeating with another altitude covers the third side. ### What does the common value in the law of sines mean? It is the diameter of the circumscribed circle, the circle through the three vertices. A side divided by the sine of its opposite angle equals 2R, so the radius is R equals a over 2 sin A. ### When can you use the law of sines? When you know a side together with the angle opposite it: two angles and a side, or two sides and an angle opposite one of them. With two sides and the angle between them, or three sides, use the law of cosines first. ### How do you find the second solution in the ambiguous case? A calculator gives only the acute angle B for sin B. The other angle is 180 degrees minus B. It is a second triangle only if A plus that angle is less than 180 degrees, and then the third side follows from the law of sines. ### How do you find the area of a triangle with sines? Use one half times two sides times the sine of the angle between them: one half a b sin C. With the law of sines this also equals a b c over 4R, where R is the radius of the circumscribed circle. ### Does the law of sines work for obtuse triangles? Yes, for every triangle. The sine of an obtuse angle is positive and equals the sine of its supplement, 180 degrees minus the angle, which is what the altitude proof uses when the foot of the altitude falls outside the side. ### How do you measure the width of a river with the law of sines? Measure a baseline L on your bank and the angles alpha and beta to a point on the far bank. The distance from one end is L sin beta over sin of alpha plus beta, and multiplying by sin alpha gives the width. --- # Aturan Sinus: Memecahkan Segitiga, Kasus Ambigu, dan Survei Source: https://nunada.my.id/artikel/aturan-sinus/ Updated: 2026-10-29 ## Jawaban singkat **Aturan sinus mengatakan bahwa pada setiap segitiga tiap sisi dibagi sinus sudut di depannya memberi bilangan yang sama, $\frac{a}{\sin A}=\frac{b}{\sin B}=\frac{c}{\sin C}$, dan bilangan itu adalah diameter $2R$ lingkaran yang melalui ketiga titik sudut.** Ia memecahkan segitiga begitu kita tahu sebuah sisi dan sudut di depannya, ditambah satu sudut lagi atau satu sisi lagi: dua sudut dan satu sisi memberi satu segitiga, sedangkan dua sisi dan sudut di depan salah satunya dapat memberi nol, satu, atau dua. Ia juga memberi luas $\frac12ab\sin C$. ### Poin penting - Pada segitiga dengan sisi $a$, $b$, $c$ di depan sudut $A$, $B$, $C$, $\frac{a}{\sin A}=\frac{b}{\sin B}=\frac{c}{\sin C}$. Ia berlaku untuk setiap segitiga, lancip maupun tumpul, karena $\sin(180^\circ-x)=\sin x$. - Buktinya satu garis tinggi: $h=b\sin A=a\sin B$. Nilai bersamanya adalah diameter lingkaran luar: $\frac{a}{\sin A}=2R$, karena diameter dari $B$ membentuk segitiga siku-siku dengan sisi $a$ sebagai salah satu sisi tegaknya. - Dua sudut dan sembarang sisi (ASA atau AAS) menentukan satu segitiga: cari sudut ketiga sebagai $180^\circ-A-B$, lalu pakai $k=\frac{a}{\sin A}$ dan $b=k\sin B$, $c=k\sin C$. - Dua sisi dan sudut di depan salah satunya (SSA) dapat memberi nol, satu, atau dua segitiga. Sinus sudut yang tak diketahui punya dua jawaban di antara $0^\circ$ dan $180^\circ$, yaitu $B$ dan $180^\circ-B$, dan masing-masing menjadi segitiga bila menyisakan ruang untuk sudut ketiga. - Luasnya $\frac12ab\sin C$ dengan sepasang sisi dan sudut apitnya, dan juga $\frac{abc}{4R}$. Dua sudut dan satu sisi memberinya sebagai $\frac{a^2\sin B\sin C}{2\sin A}$. - Dari garis dasar $L$ dan dua sudut ke titik yang jauh, aturan sinus memberi jaraknya, tetapi galat satu derajat pada bacaan dapat menggeser jawaban sebesar $5\%$ atau $25\%$ tergantung sudut di titik itu: garis pandang yang berpotongan hampir siku-siku adalah yang paling stabil. ## Apa bunyi aturan sinus? **Aturan sinus mengatakan bahwa pada setiap segitiga perbandingan sebuah sisi terhadap sinus sudut di depannya sama untuk ketiga sisi: $\frac{a}{\sin A}=\frac{b}{\sin B}=\frac{c}{\sin C}$.** Huruf-hurufnya mengikuti satu kesepakatan: $A$, $B$, $C$ adalah sudut, dan $a$, $b$, $c$ sisi di depannya, jadi $a$ adalah sisi yang berseberangan dengan $A$. Ambil segitiga siku-siku $3$-$4$-$5$: sudut di depan sisi $3$ adalah $36{,}87^\circ$, yang sinusnya $0{,}6$, dan $\frac{3}{0{,}6}=5$; di depan $4$ adalah $53{,}13^\circ$ dengan sinus $0{,}8$ dan $\frac{4}{0{,}8}=5$; dan di depan $5$ adalah sudut siku-siku, dengan sinus $1$ dan $\frac{5}{1}=5$. Ketiga perbandingan itu $5$. Biasanya ia ditulis dalam salah satu dari tiga cara yang setara. Sebagai rantai perbandingan (di atas). Sebagai perbandingan senilai, $a:b:c=\sin A:\sin B:\sin C$, yang mengatakan bahwa sisi-sisinya berbanding sama dengan sinus sudut di depannya (bukan dengan sudutnya sendiri). Atau terbalik, $\frac{\sin A}{a}=\frac{\sin B}{b}=\frac{\sin C}{c}$, bentuk yang dipakai bila yang tak diketahui adalah sudut. Ia berlaku juga untuk segitiga tumpul, karena sinus sudut tumpul positif dan sama dengan sinus pelurusnya, $\sin(180^\circ-x)=\sin x$. Yang diperlukannya adalah sebuah pasangan: sebuah sisi bersama sudut di depannya. Begitu ada satu pasangan, sisi atau sudut lain memberi pasangan kedua, dan persamaannya dapat diselesaikan untuk yang hilang. Artikel ini menunjukkan mengapa aturan itu benar, apa arti nilai bersamanya, bagaimana memakainya dalam tiap kasus, dan apa yang salah pada satu kasus, yang ambigu. Untuk memecahkan segitiga secara umum, dengan aturan kosinus juga, lihat [artikel tentang segitiga](https://nunada.my.id/artikel/segitiga/#solve-a-triangle). ## Mengapa aturan sinus benar? Bukti dengan satu garis tinggi **Aturan sinus mengikuti dari penulisan garis tinggi segitiga yang sama dalam dua cara.** Gambar garis tinggi $h$ dari $C$ turun ke garis $AB$. Ia membelah segitiga menjadi dua segitiga siku-siku yang berbagi sisi $h$. Pada yang bersudut $A$ dan sisi miring $b$, definisi sinus (lihat [segitiga siku-siku](https://nunada.my.id/artikel/trigonometri-dasar/#right-triangles)) memberi $\sin A=\frac{h}{b}$, sehingga $h=b\sin A$. Pada yang bersudut $B$ dan sisi miring $a$, $\sin B=\frac{h}{a}$, sehingga $h=a\sin B$. Kedua bentuk itu panjangnya sama, jadi $b\sin A=a\sin B$. Bagi kedua ruas dengan $\sin A\sin B$ dan diperoleh $$\frac{a}{\sin A}=\frac{b}{\sin B}.$$ Gambar garis tinggi dari titik sudut lain dan argumen yang sama mengikat $b$ dan $c$, atau $a$ dan $c$, sehingga ketiga perbandingan sama. Bila sudut di $A$ atau di $B$ tumpul, kaki garis tinggi jatuh di luar sisi $AB$, pada perpanjangannya, dan segitiga siku-siku yang memuat $h$ bersudut $180^\circ-A$ alih-alih $A$. Tak ada yang berubah, karena $\sin(180^\circ-A)=\sin A$. Itu juga sebabnya aturan ini berlaku untuk setiap segitiga, dan ia adalah benih kasus ambigu nanti: sebuah sudut dan pelurusnya memiliki sinus yang sama. *Garis tinggi $h$ dari $C$ membentuk dua segitiga siku-siku. Pada yang satu, $h=b\sin A$; pada yang lain, $h=a\sin B$. Jadi $b\sin A=a\sin B$, yaitu $\frac{a}{\sin A}=\frac{b}{\sin B}$.* ## Apa nilai bersama ketiga perbandingan itu? Lingkaran yang melalui titik-titik sudut **Nilai bersama $\frac{a}{\sin A}=\frac{b}{\sin B}=\frac{c}{\sin C}$ adalah diameter $2R$ lingkaran yang melalui ketiga titik sudut (lingkaran luar), dengan $R$ jari-jarinya.** Untuk melihat alasannya, gambar lingkaran itu dengan pusat $O$ dan diameter $BB'$ dari titik sudut $B$. Dua fakta tentang lingkaran bekerja di sini. Sudut yang bertumpu pada diameter adalah sudut siku-siku (Thales), jadi pada segitiga $BCB'$ sudut di $C$ adalah $90^\circ$. Dan dua sudut yang memandang tali busur $BC$ yang sama dari busur yang sama adalah sama besar, jadi sudut di $B'$ sama dengan sudut $A$. Pada segitiga siku-siku $BCB'$ sisi $BC=a$ berada di depan sudut $B'=A$ dan sisi miringnya $BB'=2R$, sehingga $$\sin A=\frac{a}{2R},\qquad\text{yaitu}\qquad\frac{a}{\sin A}=2R.$$ (Bila $A$ tumpul, $B'$ berada pada busur yang lain dan sudutnya $180^\circ-A$, dengan sinus yang sama.) Argumen yang sama berlaku dari titik sudut mana pun, sehingga ketiga perbandingan adalah $2R$. Ini memberi rumus jari-jari lingkaran luar, $R=\frac{a}{2\sin A}$, dan beberapa akibat cepat. Pada segitiga siku-siku dengan $C=90^\circ$, $\sin C=1$, jadi $c=2R$: sisi miring adalah diameter, dan pusatnya titik tengah sisi miring (segitiga $3$-$4$-$5$ memiliki $R=2{,}5$). Untuk segitiga bersisi $13$, $14$, $15$, sudutnya $53{,}13^\circ$, $59{,}49^\circ$, dan $67{,}38^\circ$ dan $\frac{13}{\sin53{,}13^\circ}=16{,}25$, sehingga $R=8{,}125$. Pusat lingkaran ini, pusat lingkaran luar, adalah salah satu dari empat titik penting klasik segitiga (lihat [titik-titik penting segitiga](https://nunada.my.id/artikel/segitiga/#centers)). Atur dua sudut dan satu sisi di bawah dan baca ketiga perbandingan, lingkaran, dan luasnya. *Lingkaran melalui $A$, $B$, dan $C$, dengan pusat $O$ dan jari-jari $R$. $BB'$ adalah diameter, sehingga sudut di $C$ siku-siku, dan sudut di $B'$ sama dengan sudut di $A$ (keduanya memandang tali busur $BC$ dari busur yang sama). Pada segitiga siku-siku $BCB'$: $\sin A=\frac{a}{2R}$.* ## Bagaimana memecahkan segitiga bila dua sudut dan satu sisi diketahui? **Bila dua sudut dan sembarang sisi diketahui (ASA atau AAS), segitiga itu sepenuhnya ditentukan: cari sudut ketiga dari jumlah sudut, lalu pakai aturan sinus untuk dua sisi lainnya.** Sudut ketiga gratis, karena ketiga sudut segitiga berjumlah $180^\circ$ (lihat [jumlah sudut](https://nunada.my.id/artikel/segitiga/#angle-sum)). Sesudah itu selalu ada sebuah sisi dengan sudut di depannya, yaitu pasangan yang diperlukan aturan itu. 1. **Sudut ketiga.** $C=180^\circ-A-B$. Bila ini tidak positif, tak ada segitiga. 2. **Perbandingan bersama.** Hitung $k=\frac{a}{\sin A}$ dari sisi dan sudut yang diberikan. 3. **Sisi lainnya.** $b=k\sin B$ dan $c=k\sin C$. 4. **Periksa.** Sisi terpanjang harus berada di depan sudut terbesar, dan ketiga perbandingan harus sama. **Contoh.** $A=40^\circ$, $B=65^\circ$, dan $a=12$. Maka $C=180^\circ-40^\circ-65^\circ=75^\circ$ dan $k=\frac{12}{\sin40^\circ}=18{,}6687$, sehingga $b=18{,}6687\sin65^\circ=16{,}92$ dan $c=18{,}6687\sin75^\circ=18{,}03$. Sudut terbesar, $75^\circ$, berada di depan sisi terpanjang, $18{,}03$, sebagaimana mestinya. Segitiga yang sama digambarkan oleh ASA: diberikan $A=40^\circ$, sisi $c=18{,}03$ di antara sudut $A$ dan $B$, dan $B=65^\circ$, langkah yang sama memberi sisi yang sama. Dua hal praktis. Simpan nilai penuh $k$ di kalkulator, dan pakai data yang diberikan, bukan hasil bulatan dari langkah sebelumnya, agar galat tidak menumpuk. Dan bila hanya sudut yang diketahui, segitiga tidak tertentu: setiap segitiga yang sebangun dengannya memiliki sudut yang sama, dan satu sisi menetapkan ukurannya. ## Mengapa dua sisi dan satu sudut kadang memberi dua segitiga, atau tak satu pun? **Dua sisi dan sudut di depan salah satunya (SSA) dapat memberi tak ada segitiga, satu, atau dua, karena sinus sudut yang tak diketahui punya dua jawaban di antara $0^\circ$ dan $180^\circ$, yaitu $B$ dan $180^\circ-B$, dan masing-masing menjadi segitiga hanya bila menyisakan ruang untuk sudut ketiga.** Misalkan $a$, $b$, dan $A$ diberikan. Aturan sinus memberi $\sin B=\frac{b\sin A}{a}$. Tiga hal dapat terjadi. - Bila $\frac{b\sin A}{a}>1$, tak ada sudut dengan sinus itu: **tidak ada segitiga**. Sisi $a$ terlalu pendek untuk mencapai. - Bila nilainya tepat $1$, $B=90^\circ$: **satu segitiga siku-siku**. - Selain itu ada dua sudut, $B_1=\arcsin\left(\frac{b\sin A}{a}\right)$ (yang lancip, satu-satunya yang dilaporkan kalkulator) dan $B_2=180^\circ-B_1$ (tumpul). Yang kedua menjadi segitiga hanya bila $A+B_2<180^\circ$. Gambarnya menunjukkan hal itu. Letakkan $A$ di titik asal dengan sinar ke kanan, dan $C$ pada jarak $b$ dari $A$ dengan sudut $A$. Titik sudut $B$ yang belum diketahui berada pada sinar dengan jarak $a$ dari $C$: itulah tempat lingkaran berjari-jari $a$ di sekitar $C$ memotong sinar. Lingkaran dan sinar dapat bertemu di $0$, $1$, atau $2$ titik, dan tinggi $C$ di atas sinar, $h=b\sin A$, menentukan yang mana. | Sudut $A$ | Sisi $a$ di depannya | Segitiga | |---|---|---| | lancip | $ab$ | satu | | siku-siku atau tumpul | $a\le b$ | tidak ada | **Contoh.** $a=3$, $b=5$, $A=30^\circ$. Tingginya $h=5\sin30^\circ=2{,}5$, dan $2{,}5<3<5$: dua segitiga. $\sin B=\frac{5\sin30^\circ}{3}=\frac56=0{,}8333$, sehingga $B_1=56{,}44^\circ$ dan $B_2=123{,}56^\circ$. Untuk $B_1$: $C=180^\circ-30^\circ-56{,}44^\circ=93{,}56^\circ$ dan $c=\frac{3\sin93{,}56^\circ}{\sin30^\circ}=5{,}99$. Untuk $B_2$: $C=26{,}44^\circ$ dan $c=2{,}67$. Keduanya cocok dengan data. Dengan $a=9$, $b=5$, dan $A=120^\circ$ (tumpul) hanya ada satu segitiga: $B=28{,}76^\circ$, $C=31{,}24^\circ$, $c=5{,}39$, sebab sudut $B$ kedua sebesar $151{,}24^\circ$ tidak menyisakan ruang di samping $120^\circ$. Dan $a=2$, $b=5$, $A=30^\circ$ lebih pendek daripada $h=2{,}5$: tidak ada segitiga. Ambiguitas itu persis persamaan $\sin B=c$ dalam [artikel tentang persamaan trigonometri](https://nunada.my.id/artikel/persamaan-trigonometri/#what-it-is): sinus invers mengembalikan satu sudut, dan yang lain harus dicari sendiri. Geser $a$ di bawah dan lihat lingkarannya. *Kasus ambigu dengan $A=30^\circ$, $b=5$, dan $a=3$. Titik sudut $C$ tetap. Titik sudut $B$ yang belum diketahui berada pada sinar dari $A$ dengan jarak $a=3$ dari $C$, yaitu di tempat lingkaran berjari-jari $3$ di sekitar $C$ memotong sinar: di dua titik, $B_1$ dan $B_2$, sehingga ada dua segitiga ($c\approx2{,}67$ dan $c\approx5{,}99$).* ## Bagaimana aturan sinus berhubungan dengan luas segitiga? **Luas segitiga adalah setengah hasil kali dua sisi dan sinus sudut apitnya, $K=\frac12ab\sin C$, dan jika digabung dengan aturan sinus memberi $K=\frac{abc}{4R}$.** Rumus pertama adalah rumus garis tinggi dengan tinggi ditulis $h=b\sin C$ alih-alih diukur: luas adalah $\frac12\times$ alas $a$ $\times$ tinggi $h$, dan tinggi dari $A$ adalah $b\sin C$. Ia berlaku untuk pasangan mana pun, $K=\frac12bc\sin A=\frac12ac\sin B=\frac12ab\sin C$, yang merupakan pemeriksaan yang baik untuk segitiga yang sudah terpecahkan. Ganti $\sin C$ dengan $\frac{c}{2R}$ (aturan sinus) dan ia menjadi $K=\frac12ab\cdot\frac{c}{2R}=\frac{abc}{4R}$, sehingga jari-jari lingkaran yang melalui titik-titik sudut adalah $R=\frac{abc}{4K}$. Untuk segitiga $13$, $14$, $15$ luasnya $84$ (lihat [luas segitiga](https://nunada.my.id/artikel/segitiga/#perimeter-and-area)), sehingga $R=\frac{13\cdot14\cdot15}{4\cdot84}=\frac{2730}{336}=8{,}125$, nilai yang sama seperti tadi. Dan $\frac12\cdot13\cdot14\cdot\sin67{,}38^\circ=84$ lagi. Bila dua sudut dan satu sisi diketahui (AAS) kita bahkan tak memerlukan sisi lainnya: $K=\frac{a^2\sin B\sin C}{2\sin A}$. Untuk $A=40^\circ$, $B=65^\circ$, $a=12$ ini adalah $\frac{144\cdot0{,}9063\cdot0{,}9659}{2\cdot0{,}6428}=98{,}06$, sama dengan $\frac12\cdot12\cdot16{,}92\cdot\sin75^\circ$. Begitulah sebidang tanah diukur dari garis dasar dan sudut. ## Bagaimana mengukur lebar sungai dengan aturan sinus? **Untuk mengukur jarak yang tak dapat dilalui, ukur garis dasar yang dapat dilalui dan dua sudut, dan aturan sinus mengerjakan sisanya; inilah triangulasi.** Sebuah pohon $T$ berdiri di tepi seberang. Di tepimu kamu menandai dua titik $P$ dan $Q$ yang berjarak $L$ yang diketahui, dan dari masing-masing kamu membaca sudut antara garis dasar dan garis pandang ke pohon, $\alpha$ di $P$ dan $\beta$ di $Q$. Ketiga sudut segitiga $PQT$ berjumlah $180^\circ$, sehingga sudut di pohon adalah $\gamma=180^\circ-\alpha-\beta$, dan aturan sinus memasangkan sisi $L$ dengan sudut $\gamma$: $$\frac{PT}{\sin\beta}=\frac{L}{\sin\gamma}\quad\Rightarrow\quad PT=\frac{L\sin\beta}{\sin(\alpha+\beta)},\qquad QT=\frac{L\sin\alpha}{\sin(\alpha+\beta)}.$$ (karena $\sin\gamma=\sin(180^\circ-\alpha-\beta)=\sin(\alpha+\beta)$). Lebar sungai adalah jarak tegak lurus dari $T$ ke garis dasar, $h=PT\sin\alpha$. **Contoh.** $L=100$ m, $\alpha=60^\circ$, dan $\beta=70^\circ$. Maka $\gamma=50^\circ$, $PT=\frac{100\sin70^\circ}{\sin50^\circ}=122{,}67$ m, $QT=\frac{100\sin60^\circ}{\sin50^\circ}=113{,}05$ m dan lebar sungai $h=122{,}67\sin60^\circ=106{,}23$ m. Tak seorang pun menyeberangi air. **Seberapa baik jawabannya?** Sudutnya dibaca dengan alat, dan setiap bacaan sedikit meleset. Bila tiap dari kedua sudut boleh salah $1^\circ$, lebar di atas dapat berada di mana pun dari $101{,}2$ m sampai $111{,}3$ m, sekitar $5\%$ ke tiap arah. Galatnya bergantung pada bentuk segitiga: dengan $\alpha=\beta=85^\circ$ garis pandang hampir sejajar, sudut di pohon hanya $10^\circ$ dan galat $1^\circ$ yang sama dapat mengubah jawaban sebesar $25\%$; dengan $\alpha=\beta=45^\circ$, sudut siku-siku di pohon, hanya $3{,}6\%$. Karena itu seorang juru ukur memilih garis dasar sehingga kedua garis pandang berpotongan pada sudut yang sehat, dekat $90^\circ$. Metode ini lebih tua dari alat mana pun: pengukuran bayangan oleh Thales memakai segitiga sebangun, seperti dalam [artikel tentang segitiga](https://nunada.my.id/artikel/segitiga/#congruence-similarity), dan triangulasi memakai sudut alih-alih bayangan. Coba garis dasar dan sudutmu sendiri di bawah. *Mengukur lebar sungai. Dua pengamat $P$ dan $Q$ berdiri berjarak $L$ di satu tepi dan membaca sudut $\alpha$ dan $\beta$ ke sebuah pohon $T$ di tepi seberang. Sudut di $T$ adalah $180^\circ-\alpha-\beta$, aturan sinus memberi $PT=\frac{L\sin\beta}{\sin(\alpha+\beta)}$, dan lebarnya $h=PT\sin\alpha$. (Digambar dengan $L=100$ m, $\alpha=60^\circ$, dan $\beta=70^\circ$, dengan $h\approx106$ m.)* ## Kapan memakai aturan sinus dan kapan aturan kosinus? **Pakai aturan sinus bila kita tahu sebuah sisi dan sudut di depannya (sebuah pasangan), dan aturan kosinus bila tidak.** Lihat apa ketiga ukuran yang diberikan: | Diketahui | Ada pasangan? | Mulai dengan | |---|---|---| | dua sudut dan satu sisi (ASA, AAS) | ya, setelah sudut ketiga | aturan sinus | | dua sisi dan sudut di depan salah satunya (SSA) | ya | aturan sinus (periksa kemungkinan dua) | | dua sisi dan sudut apitnya (SAS) | tidak | aturan kosinus untuk sisi ketiga | | tiga sisi (SSS) | tidak | aturan kosinus untuk sebuah sudut | [Aturan kosinus](https://nunada.my.id/artikel/aturan-kosinus/#what-it-says), $c^2=a^2+b^2-2ab\cos C$, adalah [teorema Pythagoras](https://nunada.my.id/artikel/teorema-pythagoras/#generalizations) dengan koreksi. Ia alat yang lebih aman untuk mencari sudut, karena arkus kosinus mengembalikan satu sudut di antara $0^\circ$ dan $180^\circ$ sehingga membedakan lancip dari tumpul, sedangkan arkus sinus tidak. Rencana yang umum untuk SAS: pakai aturan kosinus untuk sisi ketiga, lalu cari sudut yang lebih kecil dari dua sudut lainnya dengan aturan sinus, karena sudut yang lebih kecil selalu lancip dan arkus sinusnya lalu benar. ## Bagaimana memakai aturan sinus dalam program? **Program memecahkan AAS secara langsung dan harus memperlakukan SSA sebagai daftar: hitung $\sin B$, kembalikan kosong bila di atas $1$, dan selain itu coba $B$ maupun $180^\circ-B$.** Tiga hal. Ubah derajat ke radian sebelum memanggil `sin`. Jangan memanggil `asin` dengan nilai yang $1{,}0000000000000002$ karena pembulatan: beri margin kecil dan batasi. Dan simpan sudut kedua hanya bila sudut ketiga, $180^\circ-A-B$, positif. Program yang hanya mengembalikan $B$ lancip yang tunggal diam-diam kehilangan segitiga kedua. Program di bawah memecahkan $A=40^\circ$, $B=65^\circ$, $a=12$ (memberi $b=16{,}9196$ dan $c=18{,}0326$), lalu $a=3$, $b=5$, $A=30^\circ$ (dua segitiga, $B=56{,}44^\circ$ dan $B=123{,}56^\circ$), menghitung segitiga untuk $a=2$ dan untuk kasus tumpul $a=9$, $b=5$, $A=120^\circ$, dan akhirnya mencari lebar sungai $106{,}23$ m. ```python import math def solve_aas(A, B, a): """Two angles (degrees) and the side a opposite A: the sides and angles (a, b, c, A, B, C), or None.""" C = 180 - A - B if min(A, B, C, a) <= 0: return None # the angles leave nothing for the third k = a / math.sin(math.radians(A)) # the common ratio, 2R return a, k * math.sin(math.radians(B)), k * math.sin(math.radians(C)), A, B, C def solve_ssa(a, b, A): """Two sides and the angle A opposite a: a list with 0, 1 or 2 triangles (a, b, c, A, B, C).""" s = b * math.sin(math.radians(A)) / a # sin B if s > 1 + 1e-12: return [] # no angle has a sine above 1 B1 = math.degrees(math.asin(min(1.0, s))) # asin gives only the acute angle found = [] for B in sorted({B1, 180 - B1}): # the other angle with the same sine C = 180 - A - B if C > 1e-9: # it is a triangle only if something is left for C found.append((a, b, a * math.sin(math.radians(C)) / math.sin(math.radians(A)), A, B, C)) return found def river_width(L, alpha, beta): """Baseline L and the angles alpha, beta at its ends: the distance from the target to the baseline.""" gamma = 180 - alpha - beta pt = L * math.sin(math.radians(beta)) / math.sin(math.radians(gamma)) return pt * math.sin(math.radians(alpha)) print([round(x, 4) for x in solve_aas(40, 65, 12)]) # [12, 16.9196, 18.0326, 40, 65, 75] for t in solve_ssa(3, 5, 30): print(round(t[4], 2), round(t[5], 2), round(t[2], 2)) # 56.44 93.56 5.99, then 123.56 26.44 2.67 print(len(solve_ssa(2, 5, 30)), len(solve_ssa(9, 5, 120))) # 0 1 print(round(river_width(100, 60, 70), 2)) # 106.23 ``` ```javascript const rad = (d) => (d * Math.PI) / 180 const deg = (r) => (r * 180) / Math.PI function solveAas(A, B, a) { // two angles (degrees) and the side a opposite A: [a, b, c, A, B, C], or null const C = 180 - A - B if (Math.min(A, B, C, a) <= 0) return null // the angles leave nothing for the third const k = a / Math.sin(rad(A)) // the common ratio, 2R return [a, k * Math.sin(rad(B)), k * Math.sin(rad(C)), A, B, C] } function solveSsa(a, b, A) { // two sides and the angle A opposite a: a list with 0, 1 or 2 triangles const s = (b * Math.sin(rad(A))) / a // sin B if (s > 1 + 1e-12) return [] // no angle has a sine above 1 const B1 = deg(Math.asin(Math.min(1, s))) // asin gives only the acute angle const found = [] for (const B of [...new Set([B1, 180 - B1])].sort((p, q) => p - q)) { // the other angle with the same sine const C = 180 - A - B if (C > 1e-9) found.push([a, b, (a * Math.sin(rad(C))) / Math.sin(rad(A)), A, B, C]) // a triangle only if something is left for C } return found } function riverWidth(L, alpha, beta) { // baseline L and the angles alpha, beta at its ends: the distance from the target to the baseline const gamma = 180 - alpha - beta const pt = (L * Math.sin(rad(beta))) / Math.sin(rad(gamma)) return pt * Math.sin(rad(alpha)) } solveAas(40, 65, 12).map((x) => +x.toFixed(4)) // [12, 16.9196, 18.0326, 40, 65, 75] solveSsa(3, 5, 30).map((t) => [+t[4].toFixed(2), +t[5].toFixed(2), +t[2].toFixed(2)]) // [[56.44, 93.56, 5.99], [123.56, 26.44, 2.67]] ;[solveSsa(2, 5, 30).length, solveSsa(9, 5, 120).length] // [0, 1] +riverWidth(100, 60, 70).toFixed(2) // 106.23 ``` ```cpp #include #include #include using namespace std; const double PI = 3.14159265358979323846; double rad(double d) { return d * PI / 180.0; } double deg(double r) { return r * 180.0 / PI; } double Bs[2], Cs[2], cs[2]; // the triangles of the last solveSsa call // Two sides and the angle A opposite a: fills Bs, Cs, cs and returns how many triangles (0, 1 or 2). int solveSsa(double a, double b, double A) { double s = b * sin(rad(A)) / a; // sin B if (s > 1 + 1e-12) return 0; // no angle has a sine above 1 if (s > 1) s = 1; double B1 = deg(asin(s)); // asin gives only the acute angle int count = 0; for (int i = 0; i < 2; i++) { double B = i == 0 ? B1 : 180 - B1; // the other angle with the same sine if (i == 1 && fabs(B - B1) < 1e-9) continue; double C = 180 - A - B; if (C > 1e-9) { // a triangle only if something is left for C Bs[count] = B; Cs[count] = C; cs[count] = a * sin(rad(C)) / sin(rad(A)); count++; } } return count; } double riverWidth(double L, double alpha, double beta) { double gamma = 180 - alpha - beta; double pt = L * sin(rad(beta)) / sin(rad(gamma)); return pt * sin(rad(alpha)); } int main() { double A = 40, B = 65, a = 12; // two angles and a side double C = 180 - A - B; double k = a / sin(rad(A)); // the common ratio, 2R printf("%.4f %.4f %.0f\n", k * sin(rad(B)), k * sin(rad(C)), C); int n = solveSsa(3, 5, 30); for (int i = 0; i < n; i++) printf("%.2f %.2f %.2f\n", Bs[i], Cs[i], cs[i]); int none = solveSsa(2, 5, 30); int obtuse = solveSsa(9, 5, 120); printf("%d %d\n", none, obtuse); printf("%.2f\n", riverWidth(100, 60, 70)); return 0; } /* output: 16.9196 18.0326 75 56.44 93.56 5.99 123.56 26.44 2.67 0 1 106.23 */ ``` ## Dari mana aturan sinus berasal? **Aturan sinus tumbuh dari astronomi, dinyatakan dalam bentuk bidangnya oleh para matematikawan yang menulis dalam bahasa Arab, dan menjadi alat kerja para juru ukur yang mengukur seluruh negeri.** - **Abad ke-10 sampai ke-13.** Para matematikawan yang menulis dalam bahasa Arab, di antaranya Abu al-Wafa, al-Jayyani, dan al-Tusi, menyatakan dan membuktikan aturan sinus, pertama untuk segitiga pada bola (diperlukan untuk astronomi dan untuk arah Mekah) lalu untuk segitiga bidang. Risalah al-Tusi tentang segi empat adalah sumber paling terkenal untuk bentuk bidangnya. - **1464.** Regiomontanus menulis De triangulis omnimodis (dicetak tahun 1533), buku Eropa pertama yang memperlakukan segitiga, dengan aturan sinus, sebagai pokok bahasan tersendiri dan bukan sebagai bab astronomi. - **1533.** Gemma Frisius menguraikan triangulasi, menetapkan posisi sebuah titik dari garis dasar yang diukur dan dua sudut. - **1617.** Willebrord Snellius mengukur satu derajat meridian dengan rantai segitiga, pengukuran Bumi pertama dengan triangulasi, dalam Eratosthenes Batavus. - **Mulai 1802.** Survei Trigonometri Agung India, dimulai oleh William Lambton, membawa rantai segitiga melintasi anak benua dari selatan sampai Himalaya, dengan sudut dibaca oleh alat dan sisi dihitung dengan aturan sinus. Pada 1856 ia mengumumkan tinggi Puncak XV, yang kemudian disebut Everest, sekitar $8{,}8$ km. ## Apa kesalahan umum pada aturan sinus? **Kesalahan paling umum pada aturan sinus adalah sembilan hal berikut, masing-masing dengan pernyataan yang benar.** | Kesalahan | Yang benar | |---|---| | ❌ $\frac{a}{\sin B}=\frac{b}{\sin A}$ (sisi dengan sudut yang salah) | Tiap sisi berpasangan dengan sudut di depannya: $\frac{a}{\sin A}=\frac{b}{\sin B}$. | | ❌ $\frac{a}{A}=\frac{b}{B}$ (sudutnya sendiri) | Sisi sebanding dengan sinus sudut, bukan dengan sudutnya. | | ❌ Hanya mengambil $B=\arcsin\left(\frac{b\sin A}{a}\right)$ lalu berhenti | Sudut lainnya adalah $180^\circ-B$, dan ia dapat memberi segitiga kedua. | | ❌ Menyimpan $B=180^\circ-B_1$ tanpa memeriksa | Ia segitiga hanya bila $A+B_2<180^\circ$. | | ❌ Melanjutkan ketika $\sin B$ lebih dari $1$ | Tak ada sudut dengan sinus seperti itu: tidak ada segitiga. | | ❌ Memakai aturan sinus untuk SAS atau SSS | Tak ada pasangan sisi–sudut yang diketahui: pakai aturan kosinus dulu. | | ❌ Sisi terpanjang berada di depan sudut terkecil | Ia berada di depan sudut terbesar. | | ❌ Membulatkan $k$ atau $b$ lalu memakainya untuk mencari $c$ | Pakai data yang diberikan dan simpan ketelitian penuh sampai akhir. | | ❌ Kalkulator mode radian dengan data derajat | Atur ke derajat (atau ubah), kalau tidak setiap sinus salah. | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: aturan sinus sekilas - **Aturannya:** $\frac{a}{\sin A}=\frac{b}{\sin B}=\frac{c}{\sin C}$, dengan tiap sisi di depan sudutnya; benar untuk setiap segitiga, karena $\sin(180^\circ-x)=\sin x$. - **Mengapa:** garis tinggi $h=b\sin A=a\sin B$; nilai bersamanya adalah diameter $2R$ lingkaran yang melalui titik-titik sudut. - **ASA dan AAS:** $C=180^\circ-A-B$, lalu $k=\frac{a}{\sin A}$, $b=k\sin B$, $c=k\sin C$; satu segitiga. - **SSA:** $\sin B=\frac{b\sin A}{a}$ punya dua jawaban, $B$ dan $180^\circ-B$; dengan $h=b\sin A$ dan $A$ lancip: $ab$ satu, selain itu tidak ada. - **Luas:** $K=\frac12ab\sin C=\frac{abc}{4R}$; dengan AAS, $K=\frac{a^2\sin B\sin C}{2\sin A}$. - **Survei:** garis dasar $L$ dan sudut $\alpha$, $\beta$ memberi $PT=\frac{L\sin\beta}{\sin(\alpha+\beta)}$ dan lebar $h=PT\sin\alpha$; garis pandang yang berpotongan dekat sudut siku-siku paling stabil. - **Aturan mana:** sisi dengan sudut di depannya, pakai sinus; SAS dan SSS, pakai kosinus lebih dulu. ## Glosarium: istilah penting - **Aturan sinus**: Aturan bahwa pada setiap segitiga tiap sisi dibagi sinus sudut di depannya memberi bilangan yang sama, yaitu diameter lingkaran yang melalui ketiga titik sudut. - **Sudut di depan**: Sudut yang berseberangan dengan sebuah sisi, yang titik sudutnya bukan ujung sisi itu; sisi a berada di depan sudut A. - **Lingkaran luar**: Lingkaran yang melalui ketiga titik sudut sebuah segitiga; jari-jarinya R memenuhi a per sin A sama dengan 2R. - **ASA dan AAS**: Kasus ketika dua sudut dan satu sisi segitiga diketahui, yang menentukan tepat satu segitiga. - **Kasus ambigu (SSA)**: Kasus ketika dua sisi dan sudut di depan salah satunya diketahui, yang dapat cocok dengan tak ada segitiga, satu segitiga, atau dua segitiga. - **Sudut berpelurus**: Dua sudut yang berjumlah 180 derajat; keduanya memiliki sinus yang sama, itulah sebabnya aturan sinus dapat memberi dua jawaban. - **Garis dasar**: Jarak terukur antara dua titik pengamatan, yang dari sana jarak ke titik yang jauh dicari dengan dua sudut. - **Triangulasi**: Mencari posisi sebuah titik, atau jarak, dengan mengukur garis dasar dan sudut-sudut ke titik itu dan memecahkan segitiganya dengan aturan sinus. ## Pertanyaan yang sering diajukan ### Apa rumus aturan sinus? Pada segitiga dengan sisi a, b, c di depan sudut A, B, C, a per sin A sama dengan b per sin B sama dengan c per sin C. Tiap sisi dibagi sinus sudut di depannya adalah bilangan yang sama untuk ketiga sisi. ### Bagaimana membuktikan aturan sinus? Gambar garis tinggi dari satu titik sudut. Ia sama dengan b sin A dan juga a sin B, sehingga b sin A sama dengan a sin B, yang disusun ulang menjadi a per sin A sama dengan b per sin B. Mengulang dengan garis tinggi lain mencakup sisi ketiga. ### Apa arti nilai bersama pada aturan sinus? Ia adalah diameter lingkaran luar, lingkaran yang melalui ketiga titik sudut. Sebuah sisi dibagi sinus sudut di depannya sama dengan 2R, sehingga jari-jarinya R sama dengan a per 2 sin A. ### Kapan aturan sinus dapat dipakai? Ketika kita tahu sebuah sisi bersama sudut di depannya: dua sudut dan satu sisi, atau dua sisi dan sudut di depan salah satunya. Dengan dua sisi dan sudut apitnya, atau tiga sisi, pakai aturan kosinus lebih dulu. ### Bagaimana mencari penyelesaian kedua pada kasus ambigu? Kalkulator hanya memberi sudut lancip B untuk sin B. Sudut lainnya adalah 180 derajat dikurangi B. Ia menjadi segitiga kedua hanya bila A ditambah sudut itu kurang dari 180 derajat, dan sisi ketiga lalu mengikuti dari aturan sinus. ### Bagaimana mencari luas segitiga dengan sinus? Pakai setengah kali dua sisi kali sinus sudut apitnya: setengah a b sin C. Dengan aturan sinus ini juga sama dengan a b c per 4R, dengan R jari-jari lingkaran luar. ### Apakah aturan sinus berlaku untuk segitiga tumpul? Ya, untuk setiap segitiga. Sinus sudut tumpul positif dan sama dengan sinus pelurusnya, 180 derajat dikurangi sudut itu, yang dipakai bukti garis tinggi ketika kaki garis tinggi jatuh di luar sisi. ### Bagaimana mengukur lebar sungai dengan aturan sinus? Ukur garis dasar L di tepimu dan sudut alfa dan beta ke sebuah titik di tepi seberang. Jarak dari satu ujung adalah L sin beta per sin dari alfa ditambah beta, dan mengalikan dengan sin alfa memberi lebarnya. --- # Graphs of Trigonometric Functions: All Six, and How to Sketch Them Source: https://nunada.my.id/articles/trigonometric-graphs/ Updated: 2026-10-27 ## Quick answer **Each trigonometric function has a graph read off the unit circle: sine and cosine are waves between $-1$ and $1$ that repeat every $360^\circ$, tangent and cotangent repeat every $180^\circ$ with vertical asymptotes, and secant and cosecant are U-shaped branches that never lie between $-1$ and $1$.** The equation $y=a\,f(b(x-c))+d$ stretches the graph by $a$, divides the period by $b$, shifts it right by $c$ and up by $d$, and a sketch needs only the period, the shift and five key points. ### Key takeaways - All six graphs come from one picture, the unit circle: the point at the angle $\theta$ gives $\sin\theta$ and $\cos\theta$, and the ray through it cuts the lines $x=1$ and $y=1$ at lengths $\tan\theta$, $\sec\theta$, $\cot\theta$ and $\csc\theta$. The asymptotes appear where the ray is parallel to one of those lines. - The tangent has vertical asymptotes at $x=90^\circ+180^\circ n$, where $\cos x=0$, and repeats every $180^\circ$, not $360^\circ$, because half a turn changes the signs of the sine and the cosine together. It has no amplitude: its range is every real number. - Secant, cosecant and cotangent are drawn from the cosine, sine and tangent by taking reciprocals: an asymptote wherever the base is $0$, a tip wherever the base is $1$ or $-1$, and values that never fall between $-1$ and $1$ for secant and cosecant. - In $y=a\,f(b(x-c))+d$ the period is the parent period divided by $|b|$, the shift is $c$, and $d$ lifts the graph. If the equation is written $y=a\,f(bx-B)+d$, the shift is $\frac{B}{b}$, not $B$: the most common error with these graphs. - A wave is read from its picture in three numbers: $d=\frac{\max+\min}{2}$, $a=\frac{\max-\min}{2}$, and the period $P$ from two successive peaks, with $b=\frac{360^\circ}{P}$; a cosine is then shifted by the $x$ of a peak, and a sine by a quarter of a period less. - Two waves of the same frequency add up to one wave; waves of different frequencies add up to a wave that is not a sine, repeating every $\frac{360^\circ}{\gcd}$ if the frequencies are whole numbers and never if their ratio is irrational. A sine wave of known period is fitted to measurements by least squares, which is a linear problem in $\sin$, $\cos$ and a constant. ## How does the unit circle give the graphs of all six trigonometric functions? **On the unit circle all six functions of an angle $\theta$ are lengths you can see: sine and cosine are the height and the width of the point, the tangent is the height at which the ray through the point meets the line $x=1$, and the cotangent is the distance at which it meets the line $y=1$.** Put the point $P$ at the angle $\theta$ on the circle of radius $1$ (see [the unit circle](https://nunada.my.id/articles/basic-trigonometry/#unit-circle)). Extend the ray from the centre through $P$ until it meets the vertical line $x=1$. By similar triangles the height of the meeting point is $\frac{\sin\theta}{\cos\theta}=\tan\theta$, and the length of the ray up to it is $\frac{1}{\cos\theta}=\sec\theta$. Do the same with the horizontal line $y=1$: the meeting point is at $x=\cot\theta$ and the ray has length $\csc\theta$. A graph is what you get by letting $\theta$ turn and plotting one of these lengths against the angle. Because all six come from one picture, their features can be read from it. The ray is parallel to the line $x=1$ when $\theta=90^\circ$, so it never meets it, and $\tan\theta$ and $\sec\theta$ do not exist there. The ray is parallel to the line $y=1$ when $\theta=0^\circ$ and $180^\circ$, and $\cot\theta$ and $\csc\theta$ do not exist. Those gaps are the **vertical asymptotes**. The sine and the cosine are shadows of a segment of length $1$, so they never exceed $1$, but the lines $x=1$ and $y=1$ are infinitely long, so the tangent and the cotangent can be any number. *The six functions of $\theta$ as lengths on the unit circle: $\sin\theta$ and $\cos\theta$ are the height and the width of the point; the ray through the point meets the line $x=1$ at the height $\tan\theta$, and its length up to that line is $\sec\theta$; it meets the line $y=1$ at the distance $\cot\theta$ along it, and its length up to that line is $\csc\theta$. Here $\theta=35^\circ$.* ## Why does the tangent graph have vertical asymptotes and repeat every 180°? **The graph of $y=\tan x$ has a vertical asymptote at every $x=90^\circ+180^\circ n$, because $\tan x=\frac{\sin x}{\cos x}$ and the cosine is zero there; between two asymptotes it rises from far below to far above, and the whole picture repeats every $180^\circ$.** Follow one branch, from $-90^\circ$ to $90^\circ$. At $0^\circ$ the sine is $0$, so $\tan0^\circ=0$. As $x$ grows towards $90^\circ$ the sine approaches $1$ and the cosine approaches $0$ from the positive side, so the quotient grows without limit: the graph shoots up along the asymptote. Just after $90^\circ$ the cosine is a small negative number while the sine is still near $1$, so the tangent comes in from far below, passes through $0$ at $180^\circ$, and the next branch begins. The period is $180^\circ$ and not $360^\circ$ because half a turn sends the point $(\cos x,\sin x)$ to $(-\cos x,-\sin x)$: both signs change and the quotient does not notice, $\tan(x+180^\circ)=\tan x$. The other facts follow from the quotient. $\tan45^\circ=1$, since the sine and cosine are equal. $\tan(-x)=-\tan x$, so the graph is unchanged by a half turn about the origin. The tangent never has a highest or lowest point and rises on every branch, so its range is all real numbers and it has no amplitude. Its slope at $0$ is $1$ when $x$ is in radians, which is why $\tan x\approx x$ for small angles (the derivative is $\sec^2x$, see [the derivatives of the other four functions](https://nunada.my.id/articles/derivatives-of-trigonometric-functions/#other-four)). In radians the asymptotes are at $\frac{\pi}{2}+\pi n$ and the period is $\pi$. *The graph of $y=\tan x$. It is undefined at $-90^\circ$, $90^\circ$, $270^\circ$, and so on (dashed lines: the vertical asymptotes), rises from far below to far above between two of them, passes through $(0^\circ,0)$ and $(45^\circ,1)$, and is the same picture again $180^\circ$ later.* ## How do you draw secant, cosecant and cotangent from cosine, sine and tangent? **To draw the secant, cosecant or cotangent, draw the cosine, sine or tangent faintly first and take reciprocals: an asymptote wherever the base function is $0$, a tip wherever it is $1$ or $-1$, and in between a curve that is far from the axis, because $\frac{1}{y}$ is large when $y$ is small.** For the secant, with $\sec x=\frac{1}{\cos x}$: 1. Sketch $y=\cos x$ lightly. 2. Draw a dashed vertical asymptote at every zero of the cosine: $90^\circ$, $270^\circ$, and so on. 3. Mark the points where the cosine is $1$ or $-1$ (its peaks and troughs). The secant has the same value there: $(0^\circ,1)$, $(180^\circ,-1)$, $(360^\circ,1)$. 4. From each of these points draw a U-shaped branch that runs away from the axis towards the two nearest asymptotes: opening upwards where the cosine is positive and downwards where it is negative. 5. Check: the secant has the same sign as the cosine, and it never takes a value between $-1$ and $1$. The cosecant is the same with the sine: asymptotes at $0^\circ$, $180^\circ$, $360^\circ$, tips at $(90^\circ,1)$ and $(270^\circ,-1)$. The cotangent is $\frac{1}{\tan x}=\frac{\cos x}{\sin x}$: asymptotes where the tangent is $0$ (at $180^\circ n$), zeros where the tangent is undefined ($90^\circ+180^\circ n$), and it falls from far above to far below on every branch. It is the tangent reflected and shifted: $\cot x=-\tan(x-90^\circ)$. *The secant (solid) drawn from the cosine (dashed). Where $\cos x=0$ the secant has asymptotes, at $90^\circ$ and $270^\circ$; where $\cos x$ is $1$ or $-1$ the secant touches the same height ($0^\circ$, $180^\circ$, $360^\circ$); and it never lies between $-1$ and $1$.* ## What are the period, domain, range and symmetry of each of the six graphs? **The six graphs differ in four things you can read from the table: the period ($360^\circ$ for sine, cosine, secant and cosecant and $180^\circ$ for tangent and cotangent), the places where the function does not exist, the range, and where it is zero.** In the table $n$ is any whole number; the radian values of the periods are in brackets. Printed from the same data the checker compared with a scan of the graphs. | Function | Period | Domain | Range | Zeros | Asymptotes | |---|---|---|---|---|---| | $y=\sin x$ | $360^\circ$ ($2\pi$) | all real numbers | $-1\le y\le1$ | $x=180^\circ\,n$ | none | | $y=\cos x$ | $360^\circ$ ($2\pi$) | all real numbers | $-1\le y\le1$ | $x=90^\circ+180^\circ\,n$ | none | | $y=\tan x$ | $180^\circ$ ($\pi$) | $x\ne 90^\circ+180^\circ\,n$ | all real numbers | $x=180^\circ\,n$ | $x=90^\circ+180^\circ\,n$ | | $y=\csc x$ | $360^\circ$ ($2\pi$) | $x\ne 180^\circ\,n$ | $y\le-1$ or $y\ge1$ | none | $x=180^\circ\,n$ | | $y=\sec x$ | $360^\circ$ ($2\pi$) | $x\ne 90^\circ+180^\circ\,n$ | $y\le-1$ or $y\ge1$ | none | $x=90^\circ+180^\circ\,n$ | | $y=\cot x$ | $180^\circ$ ($\pi$) | $x\ne 180^\circ\,n$ | all real numbers | $x=90^\circ+180^\circ\,n$ | $x=180^\circ\,n$ | **Symmetry.** Cosine and secant are even: $\cos(-x)=\cos x$, so the graph is its own mirror image in the $y$-axis. Sine, tangent, cosecant and cotangent are odd: $f(-x)=-f(x)$, so a half turn about the origin leaves the graph unchanged. Pick a function below, move the point along its graph, and read all of this in degrees or in radians. ## How do a, b, c and d change the graph of any trigonometric function? **Any of the six graphs can be stretched and moved with $y=a\,f(b(x-c))+d$: $a$ stretches it vertically (and flips it if $a$ is negative), $b$ squeezes it horizontally so that the period is the parent's period divided by $|b|$, $c$ moves it to the right by $c$, and $d$ lifts it by $d$.** The four numbers act on different things, so they can be read off one at a time: - **$a$, vertical stretch.** For a sine or cosine, $|a|$ is the amplitude, the distance from the midline to a peak. Tangent, cotangent, secant and cosecant have no amplitude (they are unbounded or have no peaks); $a$ stretches them, and for the secant and cosecant the tips of the U-shapes are at $d\pm|a|$. - **$b$, horizontal squeeze.** The period is $\frac{360^\circ}{|b|}$ for sine, cosine, secant and cosecant and $\frac{180^\circ}{|b|}$ for tangent and cotangent (in radians $\frac{2\pi}{|b|}$ and $\frac{\pi}{|b|}$). The asymptotes of a tangent are $\frac{180^\circ}{|b|}$ apart. A negative $b$ mirrors the graph in the $y$-axis; use $\sin(-u)=-\sin u$ and $\cos(-u)=\cos u$ to make $b$ positive first. - **$c$, shift.** The graph moves right by $c$ (left if $c$ is negative): every special point of the parent, at $u=b(x-c)$, moves to $x=c+\frac{u}{b}$. The asymptotes of a tangent are at $x=c+\frac{90^\circ+180^\circ n}{b}$. - **$d$, lift.** The whole graph moves up by $d$; the midline of a wave is $y=d$. The vertical asymptotes do not move. **Bx minus B.** Equations are often written $y=a\,f(bx-B)+d$. Factor out $b$: $bx-B=b\left(x-\frac{B}{b}\right)$, so the shift is $\frac{B}{b}$, not $B$. For $y=\sin(2x-60^\circ)$ the graph moves $30^\circ$ to the right, not $60^\circ$. For example $y=\tan2x$ has period $90^\circ$ and asymptotes at $\pm45^\circ$, $\pm135^\circ$, and $y=2\cos\frac{x}{2}-1$ has amplitude $2$, midline $y=-1$ and period $720^\circ$. Try all four numbers on any of the six functions below. ## How do you sketch y = a sin(bx − B) + d by hand, and a tangent too? **To sketch a sine or cosine graph, find the period and the start of one cycle, mark five points a quarter of a period apart, give them the heights midline, peak, midline, trough, midline, and join them with a smooth wave.** For $y=a\sin(bx-B)+d$: 1. **Period.** $P=\frac{360^\circ}{b}$. 2. **Start.** The cycle starts where $bx-B=0$, so at $x=\frac{B}{b}$. 3. **Five points.** $x=\frac{B}{b},\ \frac{B}{b}+\frac{P}{4},\ \frac{B}{b}+\frac{P}{2},\ \frac{B}{b}+\frac{3P}{4},\ \frac{B}{b}+P$. 4. **Heights.** For a positive $a$ and a sine: $d,\ d+a,\ d,\ d-a,\ d$. (A cosine starts at the peak: $d+a,\ d,\ d-a,\ d,\ d+a$. A negative $a$ swaps peak and trough.) 5. **Join** the points with a smooth curve, flat at the peaks and troughs and steepest at the midline, and repeat the cycle in both directions. **Example.** $y=3\sin(2x-60^\circ)+1$. The period is $\frac{360^\circ}{2}=180^\circ$, the cycle starts at $x=\frac{60^\circ}{2}=30^\circ$, the quarter points are $30^\circ,\ 75^\circ,\ 120^\circ,\ 165^\circ,\ 210^\circ$ and the heights are $1,\ 4,\ 1,\ -2,\ 1$. *The graph of $y=3\sin(2x-60^\circ)+1$. One cycle starts where $2x-60^\circ=0$, that is at $x=30^\circ$, lasts $180^\circ$, and is drawn through five points a quarter of a period apart, at the heights $1,\ 4,\ 1,\ -2,\ 1$. The dashed curve is the parent $\sin x$.* **A tangent is sketched from its asymptotes and three points.** For $y=a\tan(b(x-c))+d$ the period is $\frac{180^\circ}{|b|}$; put two neighbouring asymptotes at $x=c\pm\frac{90^\circ}{b}$, the graph crosses the line $y=d$ halfway between them at $x=c$, and a quarter of the way in from each asymptote, at $x=c\pm\frac{45^\circ}{b}$, it is at $y=d\pm a$ (because $\tan45^\circ=1$). Then draw the branch through these three points rising towards both asymptotes, and repeat it. For $y=2\tan\frac{x}{2}$: the period is $360^\circ$, the asymptotes are at $\pm180^\circ$, the crossing is at the origin and the points $(\pm90^\circ,\pm2)$ guide the curve. *The graph of $y=2\tan\frac{x}{2}$: the period is $\frac{180^\circ}{1/2}=360^\circ$, the asymptotes are at $x=\pm180^\circ$, the graph crosses at $0^\circ$, and at a quarter of the way to an asymptote, $x=\pm90^\circ$, it is at $y=\pm2$ (because $\tan45^\circ=1$ and $a=2$).* ## How do you find the equation of a trigonometric graph from its picture? **To write the equation of a sine or cosine graph, read the midline and the amplitude from its highest and lowest values, the period from two successive peaks, and the shift from the position of a peak.** 1. **Midline and amplitude.** $d=\frac{\max+\min}{2}$ and $a=\frac{\max-\min}{2}$. 2. **Period.** $P$ is the distance between two successive peaks (or twice the distance from a peak to the next trough). Then $b=\frac{360^\circ}{P}$, or $\frac{2\pi}{P}$ when $x$ is a time and the argument is in radians. 3. **Shift.** Choose the cosine and let $c$ be the $x$ of a peak, since $\cos0=1$. Or choose the sine and let $c$ be the $x$ of a peak minus $\frac{P}{4}$. 4. **Check** the equation at one more point. **A tide.** In the picture the water is highest, $2.9$ m, at $3$ h and at $15.4$ h, and lowest, $0.7$ m. Then $d=1.8$, $a=1.1$, $P=15.4-3=12.4$ h and $y=1.1\cos\left(\frac{2\pi}{12.4}(t-3)\right)+1.8$; as a sine it is $y=1.1\sin\left(\frac{2\pi}{12.4}(t+0.1)\right)+1.8$. **The mains.** The PLN supply is called $220$ V, but that is its effective value; the wave reaches $220\sqrt2\approx311$ V. Peaks of $311.1$ V at $5$ ms and troughs at $15$ ms give $P=20$ ms (that is $50$ Hz) and $v=311.1\sin\left(\frac{2\pi}{20}t\right)$ with $t$ in milliseconds. There is never only one right answer: a cosine can be a sine with another shift, adding a whole period to $c$ changes nothing, and a negative $a$ with a shift of half a period gives the same graph. *A tide (illustrative numbers): the water is highest, $2.9$ m, at $3$ h and again at $15.4$ h, and lowest, $0.7$ m. The midline is $\frac{2.9+0.7}{2}=1.8$ m, the amplitude $1.1$ m, the period $15.4-3=12.4$ h, so $y=1.1\cos\left(\frac{2\pi}{12.4}(t-3)\right)+1.8$.* ## What happens when you add two sine waves, and is the sum still a sine wave? **Two sine waves of the same frequency add up to one sine wave, but waves of different frequencies add up to a graph that is not a sine wave; it repeats only if the ratio of the frequencies is a ratio of whole numbers.** Write $b$ for the number of cycles in $360^\circ$, so that $\sin bx$ has period $\frac{360^\circ}{b}$. - **Same frequency.** $A\sin bx+B\cos bx=R\sin(bx+\varphi)$ with $R=\sqrt{A^2+B^2}$, one wave of the same period (see [the single-wave form](https://nunada.my.id/articles/trigonometric-identities/#product-and-sum)). Two waves of amplitudes $A_1$, $A_2$ with a phase difference $\varphi$ give a wave of amplitude $R=\sqrt{A_1^2+A_2^2+2A_1A_2\cos\varphi}$: between $|A_1-A_2|$ (opposite) and $A_1+A_2$ (in step). - **Whole-number frequencies.** $\sin2x+\sin3x$ repeats when both have finished whole cycles together: the period is $\frac{360^\circ}{\gcd(2,3)}=360^\circ$. For $\sin4x+\sin6x$ it is $\frac{360^\circ}{2}=180^\circ$. The shape is not a sine wave. - **Irrational ratio.** $\sin x+\sin\sqrt2\,x$ never repeats exactly, because no stretch of $x$ holds a whole number of cycles of both. It comes close to repeating again and again, but it has no period. - **Close frequencies: beats.** $\sin b_1x+\sin b_2x=2\cos\frac{b_1-b_2}{2}x\,\sin\frac{b_1+b_2}{2}x$ (a product-to-sum formula): a fast wave at the average frequency whose height swells and fades $|b_1-b_2|$ times in $360^\circ$. Two guitar strings at $440$ Hz and $442$ Hz are heard to swell $2$ times a second, and tuning by ear means slowing the beats to nothing. Choose two frequencies below and see the period of the sum, or the lack of one. *The sum $\sin10x+\sin11x$ over $0^\circ$ to $360^\circ$ (solid) is a fast wave whose height swells and fades inside the envelope $\pm2\cos\frac{x}{2}$ (dashed): $\sin10x+\sin11x=2\cos\frac{x}{2}\,\sin10.5x$. The loudness of two close notes does this, and the swelling is called a beat.* ## How do you fit a sine wave to measurements? **To fit a sine wave to measurements, choose the period from what you know about the cause, and then the other numbers come from a linear least-squares problem: $y\approx A\sin bx+B\cos bx+D$ with $b=\frac{360^\circ}{P}$.** The unknown shift would make the problem hard, but the sum formula hides it in the products: $a\sin(b(x-c))=(a\cos bc)\sin bx-(a\sin bc)\cos bx$, so with $A=a\cos bc$ and $B=-a\sin bc$ the equation is linear in $A$, $B$ and $D$. Least squares chooses them so that the sum of the squared errors, the vertical distances from each point to the wave, is as small as possible; that is a $3\times3$ linear system. Then $$a=\sqrt{A^2+B^2},\qquad d=D,\qquad c=-\frac{\operatorname{atan2}(B,A)}{b},$$ and $c$ can be moved into one period by adding the period. **Example.** Twelve monthly mean temperatures (illustrative) and the period $12$ months give $a\approx9.77\ ^\circ$C, $d\approx13.45\ ^\circ$C, $c\approx4.09$ months, so the warmest point is at $x=c+\frac{P}{4}\approx7.09$, early in the seventh month. The measure of fit is $R^2=1-\frac{\text{squared errors}}{\text{squared spread of the data}}$: here $0.996$, so the wave explains $99.6\%$ of the variation. When the period is not known, try many periods and keep the best $R^2$: a wave of $0.6$ times the right period explains only about $30\%$ of this data. A high $R^2$ says the wave describes these measurements, not that the cause is periodic. *Twelve monthly mean temperatures (illustrative, in $^\circ$C) and the least-squares wave of period $12$ months through them: $y\approx9.7716\sin\left(\frac{2\pi}{12}(x-4.0942)\right)+13.45$, with $R^2\approx0.9959$. The dashed line is the mean level.* ## How do you draw and fit trigonometric graphs in a program? **A program draws a tangent or secant by treating the asymptotes as gaps: it evaluates the function on a grid, writes nothing where the function does not exist or is huge, and starts a new line after every gap.** Three details matter. The cosine of $90^\circ$ is not exactly $0$ on a computer ($6\times10^{-17}$), so test `abs(cos) < 1e-12` rather than `== 0` and the value $1.6\times10^{16}$ does not appear as a point on the graph. Convert degrees to radians. And never join two points on either side of an asymptote, however close, since the line between them is not part of the graph. The programs print the tangent near $90^\circ$ (rising to $572.96$ at $89.9^\circ$, then undefined, then falling from $-572.96$) and then fit a wave of period $12$ to the twelve temperatures by solving the three normal equations with Gaussian elimination, printing the amplitude, the shift, the mean level and $R^2$. ```python import math def tan_deg(x): """tan of x degrees, or None where it does not exist (cos x = 0).""" c = math.cos(math.radians(x)) return None if abs(c) < 1e-12 else round(math.sin(math.radians(x)) / c, 2) print([tan_deg(x) for x in (89, 89.9, 90, 90.1, 91)]) # [57.29, 572.96, None, -572.96, -57.29] def sinusoid_fit(xs, ys, period): """Least squares y ~ A sin(wx) + B cos(wx) + D, w = 2 pi / period; returns a, c, d, r2 for a sin(w (x - c)) + d.""" w = 2 * math.pi / period M = [[0.0] * 3 for _ in range(3)] # the normal equations M [A, B, D] = v v = [0.0] * 3 for x, y in zip(xs, ys): row = [math.sin(w * x), math.cos(w * x), 1.0] for i in range(3): v[i] += row[i] * y for j in range(3): M[i][j] += row[i] * row[j] for col in range(3): # Gaussian elimination with a pivot piv = max(range(col, 3), key=lambda r: abs(M[r][col])) M[col], M[piv] = M[piv], M[col] v[col], v[piv] = v[piv], v[col] for r in range(col + 1, 3): f = M[r][col] / M[col][col] for j in range(col, 3): M[r][j] -= f * M[col][j] v[r] -= f * v[col] sol = [0.0] * 3 for i in (2, 1, 0): sol[i] = (v[i] - sum(M[i][j] * sol[j] for j in range(i + 1, 3))) / M[i][i] A, B, D = sol a = math.hypot(A, B) c = (-math.atan2(B, A) / w) % period # A sin + B cos = a sin(w (x - c)) mean = sum(ys) / len(ys) res = sum((y - (A * math.sin(w * x) + B * math.cos(w * x) + D)) ** 2 for x, y in zip(xs, ys)) tot = sum((y - mean) ** 2 for y in ys) return a, c, D, 1 - res / tot months = list(range(1, 13)) temp = [4.1, 5.0, 8.6, 12.9, 17.5, 21.0, 23.4, 22.8, 19.1, 13.9, 8.2, 4.9] a, c, d, r2 = sinusoid_fit(months, temp, 12) print(round(a, 2), round(c, 2), round(d, 2), round(r2, 4)) # 9.77 4.09 13.45 0.9959 ``` ```javascript const rad = (d) => (d * Math.PI) / 180 function tanDeg(x) { // tan of x degrees, or null where it does not exist (cos x = 0) const c = Math.cos(rad(x)) return Math.abs(c) < 1e-12 ? null : +(Math.sin(rad(x)) / c).toFixed(2) } ;[89, 89.9, 90, 90.1, 91].map(tanDeg) // [57.29, 572.96, null, -572.96, -57.29] function sinusoidFit(xs, ys, period) { // least squares y ~ A sin(wx) + B cos(wx) + D, w = 2 pi / period; returns [a, c, d, r2] for a sin(w (x - c)) + d const w = (2 * Math.PI) / period const M = [[0, 0, 0], [0, 0, 0], [0, 0, 0]] // the normal equations M [A, B, D] = v const v = [0, 0, 0] xs.forEach((x, k) => { const row = [Math.sin(w * x), Math.cos(w * x), 1] for (let i = 0; i < 3; i++) { v[i] += row[i] * ys[k] for (let j = 0; j < 3; j++) M[i][j] += row[i] * row[j] } }) for (let col = 0; col < 3; col++) { // Gaussian elimination with a pivot let piv = col for (let r = col + 1; r < 3; r++) if (Math.abs(M[r][col]) > Math.abs(M[piv][col])) piv = r ;[M[col], M[piv]] = [M[piv], M[col]] ;[v[col], v[piv]] = [v[piv], v[col]] for (let r = col + 1; r < 3; r++) { const f = M[r][col] / M[col][col] for (let j = col; j < 3; j++) M[r][j] -= f * M[col][j] v[r] -= f * v[col] } } const sol = [0, 0, 0] for (let i = 2; i >= 0; i--) { let s = v[i] for (let j = i + 1; j < 3; j++) s -= M[i][j] * sol[j] sol[i] = s / M[i][i] } const [A, B, D] = sol const a = Math.hypot(A, B) const c = (((-Math.atan2(B, A) / w) % period) + period) % period // A sin + B cos = a sin(w (x - c)) const mean = ys.reduce((s, y) => s + y, 0) / ys.length let res = 0, tot = 0 xs.forEach((x, k) => { res += (ys[k] - (A * Math.sin(w * x) + B * Math.cos(w * x) + D)) ** 2 tot += (ys[k] - mean) ** 2 }) return [a, c, D, 1 - res / tot] } const months = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] const temp = [4.1, 5.0, 8.6, 12.9, 17.5, 21.0, 23.4, 22.8, 19.1, 13.9, 8.2, 4.9] const [a, c, d, r2] = sinusoidFit(months, temp, 12) ;[+a.toFixed(2), +c.toFixed(2), +d.toFixed(2), +r2.toFixed(4)] // [9.77, 4.09, 13.45, 0.9959] ``` ```cpp #include #include #include using namespace std; const double PI = 3.14159265358979323846; double xs[12], ys[12]; double M[9], v[3], sol[3]; // the normal equations M [A, B, D] = v double tanDeg(double x) { return sin(x * PI / 180) / cos(x * PI / 180); } // the angle of the point (x, y), from -PI to PI, in any quadrant (what atan2 does) double angleOf(double y, double x) { if (x > 0) return atan(y / x); if (x < 0) return atan(y / x) + (y >= 0 ? PI : -PI); return y >= 0 ? PI / 2 : -PI / 2; } int main() { double test[5] = {89, 89.9, 90.1, 91, 45}; for (int i = 0; i < 4; i++) printf("%.2f ", tanDeg(test[i])); printf("\n"); double temp[12] = {4.1, 5.0, 8.6, 12.9, 17.5, 21.0, 23.4, 22.8, 19.1, 13.9, 8.2, 4.9}; double period = 12; double w = 2 * PI / period; for (int i = 0; i < 12; i++) { xs[i] = i + 1; ys[i] = temp[i]; } for (int i = 0; i < 9; i++) M[i] = 0; for (int i = 0; i < 3; i++) v[i] = 0; for (int k = 0; k < 12; k++) { double row[3]; row[0] = sin(w * xs[k]); row[1] = cos(w * xs[k]); row[2] = 1; for (int i = 0; i < 3; i++) { v[i] += row[i] * ys[k]; for (int j = 0; j < 3; j++) M[i * 3 + j] += row[i] * row[j]; } } for (int col = 0; col < 3; col++) { // Gaussian elimination with a pivot int piv = col; for (int r = col + 1; r < 3; r++) if (fabs(M[r * 3 + col]) > fabs(M[piv * 3 + col])) piv = r; for (int j = 0; j < 3; j++) { double t = M[col * 3 + j]; M[col * 3 + j] = M[piv * 3 + j]; M[piv * 3 + j] = t; } double t2 = v[col]; v[col] = v[piv]; v[piv] = t2; for (int r = col + 1; r < 3; r++) { double f = M[r * 3 + col] / M[col * 3 + col]; for (int j = col; j < 3; j++) M[r * 3 + j] -= f * M[col * 3 + j]; v[r] -= f * v[col]; } } for (int i = 2; i >= 0; i--) { double s = v[i]; for (int j = i + 1; j < 3; j++) s -= M[i * 3 + j] * sol[j]; sol[i] = s / M[i * 3 + i]; } double A = sol[0], B = sol[1], D = sol[2]; double a = sqrt(A * A + B * B); double c = -angleOf(B, A) / w; c = c - period * floor(c / period); // into one period double mean = 0; for (int k = 0; k < 12; k++) mean += ys[k] / 12; double res = 0, tot = 0; for (int k = 0; k < 12; k++) { double fit = A * sin(w * xs[k]) + B * cos(w * xs[k]) + D; res += (ys[k] - fit) * (ys[k] - fit); tot += (ys[k] - mean) * (ys[k] - mean); } printf("%.2f %.2f %.2f %.4f\n", a, c, D, 1 - res / tot); return 0; } /* output: 57.29 572.96 -572.96 -57.29 9.77 4.09 13.45 0.9959 */ ``` ## Where do the graphs of the trigonometric functions come from? **Graphs of the trigonometric functions came late: the functions began as lengths in a circle, and only when a quantity was plotted against another did the wave appear.** - **About 1350.** Nicole Oresme drew a quantity that changes, such as a speed over time, as a line whose height shows its size at each moment, an early forerunner of the graph. - **1630s.** Roberval drew the sine curve as a companion of the cycloid and found the area under one arch. It is among the first sine waves drawn as a curve. - **1748.** Euler's Introductio treats sine and cosine as functions of a number, with angles in radians, so that $\sin x$ can be graphed against $x$ and differentiated. - **1822.** Fourier's Théorie analytique de la chaleur shows that a periodic function can be written as a sum of sine and cosine waves, which is why adding waves, as in this article, describes sounds, tides and signals. - **1863.** Helmholtz's Die Lehre von den Tonempfindungen describes a pure tone as a sine wave and a musical note as a sum of them. - **Late 1800s.** Alternating-current power systems made the sine wave of voltage a daily object, with the mains frequency fixed at $50$ or $60$ Hz. ## What are the common mistakes with trigonometric graphs? **The most common mistakes with trigonometric graphs are the nine below, each with the correct statement.** | Mistake | Correct | |---|---| | ❌ The tangent graph is a wave between $-1$ and $1$ | It has no highest or lowest point: it rises from far below to far above between asymptotes. | | ❌ Join the branches of $\tan x$ through the asymptote | The function does not exist at $90^\circ$: lift the pen, and draw the dashed asymptote. | | ❌ The period of $\tan x$ is $360^\circ$ | It is $180^\circ$, since half a turn changes the signs of sine and cosine together. | | ❌ The period of $\sin bx$ is $360^\circ b$ | It is $\frac{360^\circ}{b}$: a larger $b$ squeezes the wave. | | ❌ $y=\sin(2x-60^\circ)$ is shifted $60^\circ$ to the right | Factor out the $2$: $\sin\left(2(x-30^\circ)\right)$, so the shift is $30^\circ$. | | ❌ The amplitude of $3\tan x$ is $3$ | A tangent has no amplitude: $3$ only stretches it. | | ❌ Draw $\sec x$ dipping between $-1$ and $1$ | $\sec x=\frac{1}{\cos x}$ always has $|\sec x|\ge1$: its U-shapes touch $1$ and $-1$ and no lower. | | ❌ $\sin2x+\sin3x$ has period $2\times3$ or $360^\circ\cdot6$ | It repeats every $\frac{360^\circ}{\gcd(2,3)}=360^\circ$; the sum of waves of different frequencies is not even a sine wave. | | ❌ Plot $\sin x$ for $x$ up to $360$ with the calculator in radian mode | $360$ radians is about $57$ turns. Match the unit of the axis and the mode of the program. | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: trigonometric graphs at a glance - **From the circle:** sine and cosine are the height and width of the point; tangent, cotangent, secant and cosecant are the lengths cut by the ray on the lines $x=1$ and $y=1$. - **Tangent:** asymptotes at $90^\circ+180^\circ n$, period $180^\circ$, odd, no amplitude, through $(45^\circ,1)$. - **Reciprocals:** asymptotes where the base is $0$, tips where it is $\pm1$, $|\sec x|\ge1$, $|\csc x|\ge1$; $\cot x=-\tan(x-90^\circ)$. - **Transformations:** $y=a\,f(b(x-c))+d$; period $\frac{360^\circ}{|b|}$ (or $\frac{180^\circ}{|b|}$), shift $c$, lift $d$; in $bx-B$ the shift is $\frac{B}{b}$. - **Sketching:** period, start $\frac{B}{b}$, five points a quarter of a period apart, heights $d,\ d+a,\ d,\ d-a,\ d$; a tangent from its asymptotes and the points at $\pm45^\circ$. - **Reading:** $d=\frac{\max+\min}{2}$, $a=\frac{\max-\min}{2}$, $P$ from two peaks, cosine shifted by a peak. - **Adding:** same frequency, one wave; whole-number frequencies, period $\frac{360^\circ}{\gcd}$; irrational ratio, no period; close frequencies beat. - **Fitting:** a known period makes $y\approx A\sin bx+B\cos bx+D$ linear; $R^2$ measures the fit. ## Glossary: key terms - **Vertical asymptote**: A vertical line that a graph approaches without ever touching, at an x where the function does not exist, such as x = 90 degrees for the tangent. - **Period**: The smallest positive length after which a graph repeats exactly: 360 degrees for the sine and 180 degrees for the tangent. - **Amplitude**: The distance from the midline of a sine or cosine wave to its highest point, equal to the absolute value of a in a sin(bx) plus d. - **Midline**: The horizontal line halfway between the highest and the lowest value of a wave, y equal to d. - **Phase shift**: The distance c that a graph y = a f(b(x - c)) + d is moved to the right compared with the parent; for f(bx - B) it is B divided by b. - **Sinusoid**: A graph of the form a sin(b(x - c)) + d; sine and cosine waves of any amplitude, period and shift are all sinusoids. - **Frequency**: The number of cycles per unit: the reciprocal of the period, so a period of 20 milliseconds is 50 cycles per second, 50 hertz. - **Beat**: The slow swelling and fading of the sum of two waves of nearby frequencies, repeating as often as the difference of the frequencies. - **Least squares**: A way to fit a curve to measurements by choosing the numbers that make the sum of the squared vertical distances to the points as small as possible. ## Frequently asked questions ### What does the graph of tan x look like? It is a series of rising branches separated by vertical asymptotes at 90 degrees plus 180 degrees times n. Each branch passes through the x-axis, goes through the point at 45 degrees with height 1, and runs from far below to far above. ### What is the period of tangent and cotangent? Both repeat every 180 degrees, or pi radians, not 360. Half a turn changes the sign of both sine and cosine, so their quotient stays the same. For tan of b x the period is 180 degrees divided by b. ### How do you graph secant and cosecant? Draw cosine or sine lightly. Put asymptotes where it is zero, mark the points where it is 1 or minus 1, and draw U-shaped branches from those points to the asymptotes. The graph never lies between minus 1 and 1. ### What is the phase shift of y = sin(2x − π/3)? Factor out the 2: sin of 2 times x minus pi over 6. The graph is shifted pi over 6 radians, 30 degrees, to the right, not pi over 3. The shift is B divided by b. ### How do you find the equation of a sine graph from its picture? Take the midline as the average of the highest and lowest values and the amplitude as half their difference. Measure the period between two peaks, set b to 360 degrees over the period, and shift a cosine by the x of a peak. ### Is the sum of two sine waves a sine wave? Only if they have the same frequency, when the sum is one sine wave. With different frequencies the sum is not a sine wave; it repeats if the frequencies are whole numbers, and never repeats if their ratio is irrational. ### How do you fit a sine wave to data? Choose the period, then fit y as A sin plus B cos plus D by least squares, which is linear. The amplitude is the square root of A squared plus B squared, and the fit quality is R squared. Try several periods if unsure. ### What is the range of secant and cosecant? All numbers that are at least 1 or at most minus 1, with nothing in between. They are the reciprocals of cosine and sine, which never leave the interval from minus 1 to 1, so the reciprocals never enter it. --- # Grafik Fungsi Trigonometri: Keenam Fungsi dan Cara Membuatnya Source: https://nunada.my.id/artikel/grafik-fungsi-trigonometri/ Updated: 2026-10-27 ## Jawaban singkat **Keenam fungsi trigonometri memiliki grafik yang dibaca dari lingkaran satuan: sinus dan kosinus adalah gelombang di antara $-1$ dan $1$ yang berulang setiap $360^\circ$, tangen dan kotangen berulang setiap $180^\circ$ dengan asimtot tegak, dan sekan serta kosekan adalah cabang berbentuk U yang tak pernah berada di antara $-1$ dan $1$.** Persamaan $y=a\,f(b(x-c))+d$ meregangkan grafik dengan $a$, membagi periode dengan $b$, menggesernya ke kanan sejauh $c$ dan ke atas sejauh $d$, dan sketsa hanya memerlukan periode, pergeseran, dan lima titik yang berjarak seperempat periode. ### Poin penting - Keenam grafik berasal dari satu gambar, lingkaran satuan: titik pada sudut $\theta$ memberi $\sin\theta$ dan $\cos\theta$, dan sinar melaluinya memotong garis $x=1$ dan $y=1$ pada panjang $\tan\theta$, $\sec\theta$, $\cot\theta$, dan $\csc\theta$. Asimtot muncul di tempat sinar sejajar dengan salah satu garis itu. - Tangen memiliki asimtot tegak di $x=90^\circ+180^\circ n$, tempat $\cos x=0$, dan berulang setiap $180^\circ$, bukan $360^\circ$, karena setengah putaran mengubah tanda sinus dan kosinus bersamaan. Ia tak punya amplitudo: daerah hasilnya semua bilangan real. - Sekan, kosekan, dan kotangen digambar dari kosinus, sinus, dan tangen dengan mengambil kebalikan: asimtot di mana pun dasarnya $0$, ujung di mana pun dasarnya $1$ atau $-1$, dan nilai yang tak pernah jatuh di antara $-1$ dan $1$ untuk sekan dan kosekan. - Pada $y=a\,f(b(x-c))+d$ periodenya adalah periode induk dibagi $|b|$, pergeserannya $c$, dan $d$ mengangkat grafik. Bila persamaan ditulis $y=a\,f(bx-B)+d$, pergeserannya $\frac{B}{b}$, bukan $B$: kesalahan paling umum pada grafik ini. - Gelombang dibaca dari gambarnya dalam tiga bilangan: $d=\frac{\text{maks}+\text{min}}{2}$, $a=\frac{\text{maks}-\text{min}}{2}$, dan periode $P$ dari dua puncak berurutan, dengan $b=\frac{360^\circ}{P}$; kosinus lalu digeser sebesar $x$ sebuah puncak, dan sinus seperempat periode lebih sedikit. - Dua gelombang berfrekuensi sama menjumlah menjadi satu gelombang; gelombang berfrekuensi berbeda menjumlah menjadi gelombang yang bukan sinus, berulang setiap $\frac{360^\circ}{\text{fpb}}$ bila frekuensinya bilangan bulat dan tak pernah bila perbandingannya irasional. Gelombang sinus berperiode diketahui dicocokkan dengan pengukuran lewat kuadrat terkecil, yang merupakan masalah linear dalam $\sin$, $\cos$, dan sebuah konstanta. ## Bagaimana lingkaran satuan memberi grafik keenam fungsi trigonometri? **Pada lingkaran satuan keenam fungsi sebuah sudut $\theta$ adalah panjang yang dapat dilihat: sinus dan kosinus adalah tinggi dan lebar titik, tangen adalah tinggi tempat sinar melalui titik itu memotong garis $x=1$, dan kotangen adalah jarak tempat ia memotong garis $y=1$.** Letakkan titik $P$ pada sudut $\theta$ di lingkaran berjari-jari $1$ (lihat [lingkaran satuan](https://nunada.my.id/artikel/trigonometri-dasar/#unit-circle)). Perpanjang sinar dari pusat melalui $P$ sampai memotong garis tegak $x=1$. Dengan segitiga sebangun tinggi titik potongnya $\frac{\sin\theta}{\cos\theta}=\tan\theta$, dan panjang sinar sampai ke sana $\frac{1}{\cos\theta}=\sec\theta$. Lakukan hal yang sama dengan garis mendatar $y=1$: titik potongnya di $x=\cot\theta$ dan sinar itu panjangnya $\csc\theta$. Grafik adalah apa yang diperoleh dengan memutar $\theta$ dan menggambar salah satu panjang itu terhadap sudutnya. Karena keenamnya berasal dari satu gambar, ciri-cirinya dapat dibaca darinya. Sinar sejajar dengan garis $x=1$ ketika $\theta=90^\circ$, sehingga tak pernah memotongnya, dan $\tan\theta$ serta $\sec\theta$ tidak ada di sana. Sinar sejajar dengan garis $y=1$ ketika $\theta=0^\circ$ dan $180^\circ$, dan $\cot\theta$ serta $\csc\theta$ tidak ada. Celah-celah itu adalah **asimtot tegak**. Sinus dan kosinus adalah bayangan ruas sepanjang $1$, sehingga tak pernah melebihi $1$, tetapi garis $x=1$ dan $y=1$ panjangnya tak berhingga, sehingga tangen dan kotangen dapat bernilai berapa pun. *Keenam fungsi $\theta$ sebagai panjang pada lingkaran satuan: $\sin\theta$ dan $\cos\theta$ adalah tinggi dan lebar titik; sinar melalui titik itu memotong garis $x=1$ pada tinggi $\tan\theta$, dan panjangnya sampai garis itu adalah $\sec\theta$; ia memotong garis $y=1$ pada jarak $\cot\theta$ di sepanjangnya, dan panjangnya sampai garis itu adalah $\csc\theta$. Di sini $\theta=35^\circ$.* ## Mengapa grafik tangen memiliki asimtot tegak dan berulang setiap 180°? **Grafik $y=\tan x$ memiliki asimtot tegak di setiap $x=90^\circ+180^\circ n$, karena $\tan x=\frac{\sin x}{\cos x}$ dan kosinus bernilai nol di sana; di antara dua asimtot ia naik dari jauh di bawah ke jauh di atas, dan seluruh gambarnya berulang setiap $180^\circ$.** Ikuti satu cabang, dari $-90^\circ$ sampai $90^\circ$. Pada $0^\circ$ sinusnya $0$, sehingga $\tan0^\circ=0$. Ketika $x$ membesar menuju $90^\circ$ sinus mendekati $1$ dan kosinus mendekati $0$ dari sisi positif, sehingga hasil bagi membesar tanpa batas: grafik melesat naik sepanjang asimtot. Tepat setelah $90^\circ$ kosinus adalah bilangan negatif kecil sementara sinus masih dekat $1$, sehingga tangen datang dari jauh di bawah, melewati $0$ pada $180^\circ$, dan cabang berikutnya dimulai. Periodenya $180^\circ$ dan bukan $360^\circ$ karena setengah putaran mengirim titik $(\cos x,\sin x)$ ke $(-\cos x,-\sin x)$: kedua tanda berubah dan hasil bagi tidak terpengaruh, $\tan(x+180^\circ)=\tan x$. Fakta lain mengikuti dari hasil bagi itu. $\tan45^\circ=1$, karena sinus dan kosinusnya sama. $\tan(-x)=-\tan x$, sehingga grafik tidak berubah oleh setengah putaran terhadap titik asal. Tangen tak pernah memiliki titik tertinggi atau terendah dan naik pada setiap cabang, sehingga daerah hasilnya semua bilangan real dan ia tak punya amplitudo. Gradiennya di $0$ adalah $1$ bila $x$ dalam radian, itulah sebabnya $\tan x\approx x$ untuk sudut kecil (turunannya $\sec^2x$, lihat [turunan keempat fungsi lainnya](https://nunada.my.id/artikel/turunan-fungsi-trigonometri/#other-four)). Dalam radian asimtotnya di $\frac{\pi}{2}+\pi n$ dan periodenya $\pi$. *Grafik $y=\tan x$. Ia tak terdefinisi di $-90^\circ$, $90^\circ$, $270^\circ$, dan seterusnya (garis putus-putus: asimtot tegak), naik dari jauh di bawah ke jauh di atas di antara dua asimtot, melalui $(0^\circ,0)$ dan $(45^\circ,1)$, dan menjadi gambar yang sama lagi $180^\circ$ kemudian.* ## Bagaimana menggambar sekan, kosekan, dan kotangen dari kosinus, sinus, dan tangen? **Untuk menggambar sekan, kosekan, atau kotangen, gambar dulu kosinus, sinus, atau tangen secara samar lalu ambil kebalikannya: asimtot di mana pun fungsi dasarnya $0$, ujung di mana pun ia $1$ atau $-1$, dan di antaranya kurva yang jauh dari sumbu, karena $\frac{1}{y}$ besar bila $y$ kecil.** Untuk sekan, dengan $\sec x=\frac{1}{\cos x}$: 1. Sketsa $y=\cos x$ dengan samar. 2. Gambar asimtot tegak putus-putus di setiap nol kosinus: $90^\circ$, $270^\circ$, dan seterusnya. 3. Tandai titik tempat kosinus bernilai $1$ atau $-1$ (puncak dan lembahnya). Sekan bernilai sama di sana: $(0^\circ,1)$, $(180^\circ,-1)$, $(360^\circ,1)$. 4. Dari tiap titik itu gambar cabang berbentuk U yang menjauh dari sumbu menuju dua asimtot terdekat: membuka ke atas di tempat kosinus positif dan ke bawah di tempat kosinus negatif. 5. Periksa: sekan bertanda sama dengan kosinus, dan tak pernah bernilai di antara $-1$ dan $1$. Kosekan sama dengan memakai sinus: asimtot di $0^\circ$, $180^\circ$, $360^\circ$, ujung di $(90^\circ,1)$ dan $(270^\circ,-1)$. Kotangen adalah $\frac{1}{\tan x}=\frac{\cos x}{\sin x}$: asimtot di tempat tangen $0$ (di $180^\circ n$), nol di tempat tangen tak terdefinisi ($90^\circ+180^\circ n$), dan ia turun dari jauh di atas ke jauh di bawah pada setiap cabang. Ia adalah tangen yang dicerminkan dan digeser: $\cot x=-\tan(x-90^\circ)$. *Sekan (garis penuh) digambar dari kosinus (garis putus-putus). Di tempat $\cos x=0$ sekan punya asimtot, di $90^\circ$ dan $270^\circ$; di tempat $\cos x$ bernilai $1$ atau $-1$ sekan menyentuh tinggi yang sama ($0^\circ$, $180^\circ$, $360^\circ$); dan ia tak pernah berada di antara $-1$ dan $1$.* ## Apa periode, daerah asal, daerah hasil, dan simetri tiap keenam grafik? **Keenam grafik berbeda dalam empat hal yang dapat dibaca dari tabel: periode ($360^\circ$ untuk sinus, kosinus, sekan, dan kosekan dan $180^\circ$ untuk tangen dan kotangen), tempat fungsi tidak ada, daerah hasil, dan tempat fungsi bernilai nol.** Dalam tabel $n$ adalah bilangan bulat apa saja; nilai radian periode ada di dalam tanda kurung. Dicetak dari data yang sama yang dibandingkan pengecek dengan pemindaian grafik. | Fungsi | Periode | Daerah asal | Daerah hasil | Nol | Asimtot | |---|---|---|---|---|---| | $y=\sin x$ | $360^\circ$ ($2\pi$) | semua bilangan real | $-1\le y\le1$ | $x=180^\circ\,n$ | tidak ada | | $y=\cos x$ | $360^\circ$ ($2\pi$) | semua bilangan real | $-1\le y\le1$ | $x=90^\circ+180^\circ\,n$ | tidak ada | | $y=\tan x$ | $180^\circ$ ($\pi$) | $x\ne 90^\circ+180^\circ\,n$ | semua bilangan real | $x=180^\circ\,n$ | $x=90^\circ+180^\circ\,n$ | | $y=\csc x$ | $360^\circ$ ($2\pi$) | $x\ne 180^\circ\,n$ | $y\le-1$ atau $y\ge1$ | tidak ada | $x=180^\circ\,n$ | | $y=\sec x$ | $360^\circ$ ($2\pi$) | $x\ne 90^\circ+180^\circ\,n$ | $y\le-1$ atau $y\ge1$ | tidak ada | $x=90^\circ+180^\circ\,n$ | | $y=\cot x$ | $180^\circ$ ($\pi$) | $x\ne 180^\circ\,n$ | semua bilangan real | $x=90^\circ+180^\circ\,n$ | $x=180^\circ\,n$ | **Simetri.** Kosinus dan sekan genap: $\cos(-x)=\cos x$, sehingga grafik adalah bayangan cerminnya sendiri terhadap sumbu-$y$. Sinus, tangen, kosekan, dan kotangen ganjil: $f(-x)=-f(x)$, sehingga setengah putaran terhadap titik asal tidak mengubah grafik. Pilih sebuah fungsi di bawah, geser titik di sepanjang grafiknya, dan baca semuanya dalam derajat atau radian. ## Bagaimana a, b, c, dan d mengubah grafik fungsi trigonometri apa pun? **Setiap keenam grafik dapat diregangkan dan digeser dengan $y=a\,f(b(x-c))+d$: $a$ meregangkannya secara vertikal (dan membaliknya bila $a$ negatif), $b$ merapatkannya secara horizontal sehingga periodenya adalah periode induk dibagi $|b|$, $c$ menggesernya ke kanan sejauh $c$, dan $d$ mengangkatnya sejauh $d$.** Keempat bilangan itu bekerja pada hal yang berbeda, sehingga dapat dibaca satu per satu: - **$a$, regangan vertikal.** Untuk sinus atau kosinus, $|a|$ adalah amplitudo, jarak dari garis tengah ke puncak. Tangen, kotangen, sekan, dan kosekan tak punya amplitudo (tak terbatas atau tak punya puncak); $a$ meregangkannya, dan untuk sekan dan kosekan ujung bentuk U ada di $d\pm|a|$. - **$b$, perapatan horizontal.** Periodenya $\frac{360^\circ}{|b|}$ untuk sinus, kosinus, sekan, dan kosekan dan $\frac{180^\circ}{|b|}$ untuk tangen dan kotangen (dalam radian $\frac{2\pi}{|b|}$ dan $\frac{\pi}{|b|}$). Asimtot tangen berjarak $\frac{180^\circ}{|b|}$. $b$ negatif mencerminkan grafik terhadap sumbu-$y$; pakai $\sin(-u)=-\sin u$ dan $\cos(-u)=\cos u$ untuk membuat $b$ positif lebih dulu. - **$c$, pergeseran.** Grafik bergeser ke kanan sejauh $c$ (ke kiri bila $c$ negatif): setiap titik istimewa induk, di $u=b(x-c)$, pindah ke $x=c+\frac{u}{b}$. Asimtot tangen ada di $x=c+\frac{90^\circ+180^\circ n}{b}$. - **$d$, pengangkatan.** Seluruh grafik naik sejauh $d$; garis tengah gelombang adalah $y=d$. Asimtot tegak tidak bergerak. **Bentuk bx dikurangi B.** Persamaan sering ditulis $y=a\,f(bx-B)+d$. Keluarkan $b$: $bx-B=b\left(x-\frac{B}{b}\right)$, jadi pergeserannya $\frac{B}{b}$, bukan $B$. Untuk $y=\sin(2x-60^\circ)$ grafik bergeser $30^\circ$ ke kanan, bukan $60^\circ$. Misalnya $y=\tan2x$ berperiode $90^\circ$ dan berasimtot di $\pm45^\circ$, $\pm135^\circ$, dan $y=2\cos\frac{x}{2}-1$ beramplitudo $2$, bergaris tengah $y=-1$, dan berperiode $720^\circ$. Coba keempat bilangan pada salah satu dari keenam fungsi di bawah. ## Bagaimana membuat sketsa y = a sin(bx − B) + d dengan tangan, dan tangen juga? **Untuk membuat sketsa grafik sinus atau kosinus, cari periode dan awal satu siklus, tandai lima titik yang berjarak seperempat periode, beri tinggi garis tengah, puncak, garis tengah, lembah, garis tengah, lalu hubungkan dengan gelombang mulus.** Untuk $y=a\sin(bx-B)+d$: 1. **Periode.** $P=\frac{360^\circ}{b}$. 2. **Awal.** Siklus dimulai di tempat $bx-B=0$, yaitu di $x=\frac{B}{b}$. 3. **Lima titik.** $x=\frac{B}{b},\ \frac{B}{b}+\frac{P}{4},\ \frac{B}{b}+\frac{P}{2},\ \frac{B}{b}+\frac{3P}{4},\ \frac{B}{b}+P$. 4. **Tinggi.** Untuk $a$ positif dan sinus: $d,\ d+a,\ d,\ d-a,\ d$. (Kosinus dimulai dari puncak: $d+a,\ d,\ d-a,\ d,\ d+a$. $a$ negatif menukar puncak dan lembah.) 5. **Hubungkan** titik-titik itu dengan kurva mulus, mendatar di puncak dan lembah dan paling curam di garis tengah, lalu ulangi siklusnya ke dua arah. **Contoh.** $y=3\sin(2x-60^\circ)+1$. Periodenya $\frac{360^\circ}{2}=180^\circ$, siklus dimulai di $x=\frac{60^\circ}{2}=30^\circ$, titik seperempatnya $30^\circ,\ 75^\circ,\ 120^\circ,\ 165^\circ,\ 210^\circ$ dan tingginya $1,\ 4,\ 1,\ -2,\ 1$. *Grafik $y=3\sin(2x-60^\circ)+1$. Satu siklus dimulai di tempat $2x-60^\circ=0$, yaitu di $x=30^\circ$, panjangnya $180^\circ$, dan digambar melalui lima titik yang berjarak seperempat periode, pada tinggi $1,\ 4,\ 1,\ -2,\ 1$. Kurva putus-putus adalah induknya $\sin x$.* **Tangen dibuat sketsanya dari asimtot dan tiga titik.** Untuk $y=a\tan(b(x-c))+d$ periodenya $\frac{180^\circ}{|b|}$; letakkan dua asimtot bersebelahan di $x=c\pm\frac{90^\circ}{b}$, grafik memotong garis $y=d$ di tengah-tengah keduanya pada $x=c$, dan pada seperempat jalan dari tiap asimtot, di $x=c\pm\frac{45^\circ}{b}$, ia berada di $y=d\pm a$ (karena $\tan45^\circ=1$). Lalu gambar cabang melalui ketiga titik itu yang naik menuju kedua asimtot, dan ulangi. Untuk $y=2\tan\frac{x}{2}$: periodenya $360^\circ$, asimtotnya di $\pm180^\circ$, perpotongannya di titik asal dan titik $(\pm90^\circ,\pm2)$ memandu kurvanya. *Grafik $y=2\tan\frac{x}{2}$: periodenya $\frac{180^\circ}{1/2}=360^\circ$, asimtotnya di $x=\pm180^\circ$, grafik memotong di $0^\circ$, dan pada seperempat jalan menuju asimtot, $x=\pm90^\circ$, ia berada di $y=\pm2$ (karena $\tan45^\circ=1$ dan $a=2$).* ## Bagaimana mencari persamaan sebuah grafik trigonometri dari gambarnya? **Untuk menulis persamaan grafik sinus atau kosinus, baca garis tengah dan amplitudo dari nilai tertinggi dan terendahnya, periode dari dua puncak berurutan, dan pergeseran dari letak sebuah puncak.** 1. **Garis tengah dan amplitudo.** $d=\frac{\text{maks}+\text{min}}{2}$ dan $a=\frac{\text{maks}-\text{min}}{2}$. 2. **Periode.** $P$ adalah jarak antara dua puncak berurutan (atau dua kali jarak dari puncak ke lembah berikutnya). Lalu $b=\frac{360^\circ}{P}$, atau $\frac{2\pi}{P}$ bila $x$ adalah waktu dan argumennya dalam radian. 3. **Pergeseran.** Pilih kosinus dan misalkan $c$ adalah $x$ sebuah puncak, karena $\cos0=1$. Atau pilih sinus dan misalkan $c$ adalah $x$ sebuah puncak dikurangi $\frac{P}{4}$. 4. **Periksa** persamaan itu pada satu titik lain. **Pasang surut.** Pada gambar air tertinggi, $2{,}9$ m, pada jam $3$ dan jam $15{,}4$, dan terendah $0{,}7$ m. Maka $d=1{,}8$, $a=1{,}1$, $P=15{,}4-3=12{,}4$ jam dan $y=1{,}1\cos\left(\frac{2\pi}{12{,}4}(t-3)\right)+1{,}8$; sebagai sinus $y=1{,}1\sin\left(\frac{2\pi}{12{,}4}(t+0{,}1)\right)+1{,}8$. **Listrik PLN.** Pasokan PLN disebut $220$ V, tetapi itu nilai efektifnya; gelombangnya mencapai $220\sqrt2\approx311$ V. Puncak $311{,}1$ V pada $5$ ms dan lembah pada $15$ ms memberi $P=20$ ms (yaitu $50$ Hz) dan $v=311{,}1\sin\left(\frac{2\pi}{20}t\right)$ dengan $t$ dalam milidetik. Tak pernah hanya ada satu jawaban benar: kosinus dapat menjadi sinus dengan pergeseran lain, menambah satu periode penuh pada $c$ tidak mengubah apa-apa, dan $a$ negatif dengan pergeseran setengah periode memberi grafik yang sama. *Pasang surut (angka ilustrasi): air tertinggi, $2{,}9$ m, pada jam $3$ dan lagi pada jam $15{,}4$, dan terendah $0{,}7$ m. Garis tengahnya $\frac{2{,}9+0{,}7}{2}=1{,}8$ m, amplitudonya $1{,}1$ m, periodenya $15{,}4-3=12{,}4$ jam, jadi $y=1{,}1\cos\left(\frac{2\pi}{12{,}4}(t-3)\right)+1{,}8$.* ## Apa yang terjadi bila dua gelombang sinus dijumlahkan, dan apakah jumlahnya masih gelombang sinus? **Dua gelombang sinus berfrekuensi sama menjumlah menjadi satu gelombang sinus, tetapi gelombang berfrekuensi berbeda menjumlah menjadi grafik yang bukan gelombang sinus; ia berulang hanya bila perbandingan frekuensinya adalah perbandingan bilangan bulat.** Tulis $b$ untuk banyaknya siklus dalam $360^\circ$, sehingga $\sin bx$ berperiode $\frac{360^\circ}{b}$. - **Frekuensi sama.** $A\sin bx+B\cos bx=R\sin(bx+\varphi)$ dengan $R=\sqrt{A^2+B^2}$, satu gelombang berperiode sama (lihat [bentuk satu gelombang](https://nunada.my.id/artikel/identitas-trigonometri/#product-and-sum)). Dua gelombang beramplitudo $A_1$, $A_2$ dengan beda fase $\varphi$ memberi gelombang beramplitudo $R=\sqrt{A_1^2+A_2^2+2A_1A_2\cos\varphi}$: di antara $|A_1-A_2|$ (berlawanan) dan $A_1+A_2$ (searah). - **Frekuensi bilangan bulat.** $\sin2x+\sin3x$ berulang ketika keduanya telah menyelesaikan siklus utuh bersamaan: periodenya $\frac{360^\circ}{\gcd(2,3)}=360^\circ$. Untuk $\sin4x+\sin6x$ periodenya $\frac{360^\circ}{2}=180^\circ$. Bentuknya bukan gelombang sinus. - **Perbandingan irasional.** $\sin x+\sin\sqrt2\,x$ tak pernah berulang tepat, karena tak ada bentangan $x$ yang memuat bilangan bulat siklus keduanya. Ia berulang-ulang hampir berulang, tetapi tak punya periode. - **Frekuensi berdekatan: layangan.** $\sin b_1x+\sin b_2x=2\cos\frac{b_1-b_2}{2}x\,\sin\frac{b_1+b_2}{2}x$ (rumus hasil kali menjadi jumlah): gelombang cepat pada frekuensi rata-rata yang tingginya membesar dan mengecil $|b_1-b_2|$ kali dalam $360^\circ$. Dua senar gitar $440$ Hz dan $442$ Hz terdengar membesar $2$ kali per detik, dan menyetem dengan telinga berarti memperlambat layangan sampai hilang. Pilih dua frekuensi di bawah dan lihat periode jumlahnya, atau tiadanya periode. *Jumlah $\sin10x+\sin11x$ pada $0^\circ$ sampai $360^\circ$ (garis penuh) adalah gelombang cepat yang tingginya membesar dan mengecil di dalam selubung $\pm2\cos\frac{x}{2}$ (garis putus-putus): $\sin10x+\sin11x=2\cos\frac{x}{2}\,\sin10{,}5x$. Kerasnya dua nada berdekatan berbuat begini, dan pembesaran itu disebut layangan.* ## Bagaimana mencocokkan gelombang sinus dengan pengukuran? **Untuk mencocokkan gelombang sinus dengan pengukuran, pilih periode dari apa yang diketahui tentang penyebabnya, lalu bilangan lainnya berasal dari masalah kuadrat terkecil linear: $y\approx A\sin bx+B\cos bx+D$ dengan $b=\frac{360^\circ}{P}$.** Pergeseran yang tak diketahui akan membuat masalahnya sulit, tetapi rumus jumlah menyembunyikannya dalam hasil kali: $a\sin(b(x-c))=(a\cos bc)\sin bx-(a\sin bc)\cos bx$, sehingga dengan $A=a\cos bc$ dan $B=-a\sin bc$ persamaannya linear dalam $A$, $B$, dan $D$. Kuadrat terkecil memilihnya sehingga jumlah kuadrat galat, jarak tegak dari tiap titik ke gelombang, sekecil mungkin; itu sistem linear $3\times3$. Lalu $$a=\sqrt{A^2+B^2},\qquad d=D,\qquad c=-\frac{\operatorname{atan2}(B,A)}{b},$$ dan $c$ dapat dipindahkan ke satu periode dengan menambahkan periode. **Contoh.** Dua belas suhu rata-rata bulanan (ilustrasi) dan periode $12$ bulan memberi $a\approx9{,}77\ ^\circ$C, $d\approx13{,}45\ ^\circ$C, $c\approx4{,}09$ bulan, sehingga titik terhangat di $x=c+\frac{P}{4}\approx7{,}09$, awal bulan ketujuh. Ukuran kecocokannya $R^2=1-\frac{\text{kuadrat galat}}{\text{kuadrat sebaran data}}$: di sini $0{,}996$, sehingga gelombang menjelaskan $99{,}6\%$ variasi. Bila periode tidak diketahui, coba banyak periode dan simpan $R^2$ terbaik: gelombang berperiode $0{,}6$ kali periode yang benar hanya menjelaskan sekitar $30\%$ data ini. $R^2$ tinggi mengatakan gelombang menggambarkan pengukuran ini, bukan bahwa penyebabnya periodik. *Dua belas suhu rata-rata bulanan (ilustrasi, dalam $^\circ$C) dan gelombang kuadrat terkecil berperiode $12$ bulan yang melalui titik-titiknya: $y\approx9{,}7716\sin\left(\frac{2\pi}{12}(x-4{,}0942)\right)+13{,}45$, dengan $R^2\approx0{,}9959$. Garis putus-putus adalah tingkat rata-rata.* ## Bagaimana menggambar dan mencocokkan grafik trigonometri dalam program? **Program menggambar tangen atau sekan dengan memperlakukan asimtot sebagai celah: ia menghitung fungsi pada kisi, tidak menulis apa-apa di tempat fungsi tidak ada atau sangat besar, dan memulai garis baru setelah tiap celah.** Tiga hal penting. Kosinus $90^\circ$ tidak tepat $0$ pada komputer ($6\times10^{-17}$), jadi ujilah `abs(cos) < 1e-12` alih-alih `== 0` dan nilai $1{,}6\times10^{16}$ tidak muncul sebagai titik pada grafik. Ubah derajat ke radian. Dan jangan pernah menghubungkan dua titik di kedua sisi asimtot, sedekat apa pun, karena garis di antaranya bukan bagian grafik. Program mencetak tangen di dekat $90^\circ$ (naik ke $572{,}96$ pada $89{,}9^\circ$, lalu tak terdefinisi, lalu turun dari $-572{,}96$) dan kemudian mencocokkan gelombang berperiode $12$ dengan dua belas suhu dengan menyelesaikan tiga persamaan normal memakai eliminasi Gauss, mencetak amplitudo, pergeseran, tingkat rata-rata, dan $R^2$. ```python import math def tan_deg(x): """tan of x degrees, or None where it does not exist (cos x = 0).""" c = math.cos(math.radians(x)) return None if abs(c) < 1e-12 else round(math.sin(math.radians(x)) / c, 2) print([tan_deg(x) for x in (89, 89.9, 90, 90.1, 91)]) # [57.29, 572.96, None, -572.96, -57.29] def sinusoid_fit(xs, ys, period): """Least squares y ~ A sin(wx) + B cos(wx) + D, w = 2 pi / period; returns a, c, d, r2 for a sin(w (x - c)) + d.""" w = 2 * math.pi / period M = [[0.0] * 3 for _ in range(3)] # the normal equations M [A, B, D] = v v = [0.0] * 3 for x, y in zip(xs, ys): row = [math.sin(w * x), math.cos(w * x), 1.0] for i in range(3): v[i] += row[i] * y for j in range(3): M[i][j] += row[i] * row[j] for col in range(3): # Gaussian elimination with a pivot piv = max(range(col, 3), key=lambda r: abs(M[r][col])) M[col], M[piv] = M[piv], M[col] v[col], v[piv] = v[piv], v[col] for r in range(col + 1, 3): f = M[r][col] / M[col][col] for j in range(col, 3): M[r][j] -= f * M[col][j] v[r] -= f * v[col] sol = [0.0] * 3 for i in (2, 1, 0): sol[i] = (v[i] - sum(M[i][j] * sol[j] for j in range(i + 1, 3))) / M[i][i] A, B, D = sol a = math.hypot(A, B) c = (-math.atan2(B, A) / w) % period # A sin + B cos = a sin(w (x - c)) mean = sum(ys) / len(ys) res = sum((y - (A * math.sin(w * x) + B * math.cos(w * x) + D)) ** 2 for x, y in zip(xs, ys)) tot = sum((y - mean) ** 2 for y in ys) return a, c, D, 1 - res / tot months = list(range(1, 13)) temp = [4.1, 5.0, 8.6, 12.9, 17.5, 21.0, 23.4, 22.8, 19.1, 13.9, 8.2, 4.9] a, c, d, r2 = sinusoid_fit(months, temp, 12) print(round(a, 2), round(c, 2), round(d, 2), round(r2, 4)) # 9.77 4.09 13.45 0.9959 ``` ```javascript const rad = (d) => (d * Math.PI) / 180 function tanDeg(x) { // tan of x degrees, or null where it does not exist (cos x = 0) const c = Math.cos(rad(x)) return Math.abs(c) < 1e-12 ? null : +(Math.sin(rad(x)) / c).toFixed(2) } ;[89, 89.9, 90, 90.1, 91].map(tanDeg) // [57.29, 572.96, null, -572.96, -57.29] function sinusoidFit(xs, ys, period) { // least squares y ~ A sin(wx) + B cos(wx) + D, w = 2 pi / period; returns [a, c, d, r2] for a sin(w (x - c)) + d const w = (2 * Math.PI) / period const M = [[0, 0, 0], [0, 0, 0], [0, 0, 0]] // the normal equations M [A, B, D] = v const v = [0, 0, 0] xs.forEach((x, k) => { const row = [Math.sin(w * x), Math.cos(w * x), 1] for (let i = 0; i < 3; i++) { v[i] += row[i] * ys[k] for (let j = 0; j < 3; j++) M[i][j] += row[i] * row[j] } }) for (let col = 0; col < 3; col++) { // Gaussian elimination with a pivot let piv = col for (let r = col + 1; r < 3; r++) if (Math.abs(M[r][col]) > Math.abs(M[piv][col])) piv = r ;[M[col], M[piv]] = [M[piv], M[col]] ;[v[col], v[piv]] = [v[piv], v[col]] for (let r = col + 1; r < 3; r++) { const f = M[r][col] / M[col][col] for (let j = col; j < 3; j++) M[r][j] -= f * M[col][j] v[r] -= f * v[col] } } const sol = [0, 0, 0] for (let i = 2; i >= 0; i--) { let s = v[i] for (let j = i + 1; j < 3; j++) s -= M[i][j] * sol[j] sol[i] = s / M[i][i] } const [A, B, D] = sol const a = Math.hypot(A, B) const c = (((-Math.atan2(B, A) / w) % period) + period) % period // A sin + B cos = a sin(w (x - c)) const mean = ys.reduce((s, y) => s + y, 0) / ys.length let res = 0, tot = 0 xs.forEach((x, k) => { res += (ys[k] - (A * Math.sin(w * x) + B * Math.cos(w * x) + D)) ** 2 tot += (ys[k] - mean) ** 2 }) return [a, c, D, 1 - res / tot] } const months = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] const temp = [4.1, 5.0, 8.6, 12.9, 17.5, 21.0, 23.4, 22.8, 19.1, 13.9, 8.2, 4.9] const [a, c, d, r2] = sinusoidFit(months, temp, 12) ;[+a.toFixed(2), +c.toFixed(2), +d.toFixed(2), +r2.toFixed(4)] // [9.77, 4.09, 13.45, 0.9959] ``` ```cpp #include #include #include using namespace std; const double PI = 3.14159265358979323846; double xs[12], ys[12]; double M[9], v[3], sol[3]; // the normal equations M [A, B, D] = v double tanDeg(double x) { return sin(x * PI / 180) / cos(x * PI / 180); } // the angle of the point (x, y), from -PI to PI, in any quadrant (what atan2 does) double angleOf(double y, double x) { if (x > 0) return atan(y / x); if (x < 0) return atan(y / x) + (y >= 0 ? PI : -PI); return y >= 0 ? PI / 2 : -PI / 2; } int main() { double test[5] = {89, 89.9, 90.1, 91, 45}; for (int i = 0; i < 4; i++) printf("%.2f ", tanDeg(test[i])); printf("\n"); double temp[12] = {4.1, 5.0, 8.6, 12.9, 17.5, 21.0, 23.4, 22.8, 19.1, 13.9, 8.2, 4.9}; double period = 12; double w = 2 * PI / period; for (int i = 0; i < 12; i++) { xs[i] = i + 1; ys[i] = temp[i]; } for (int i = 0; i < 9; i++) M[i] = 0; for (int i = 0; i < 3; i++) v[i] = 0; for (int k = 0; k < 12; k++) { double row[3]; row[0] = sin(w * xs[k]); row[1] = cos(w * xs[k]); row[2] = 1; for (int i = 0; i < 3; i++) { v[i] += row[i] * ys[k]; for (int j = 0; j < 3; j++) M[i * 3 + j] += row[i] * row[j]; } } for (int col = 0; col < 3; col++) { // Gaussian elimination with a pivot int piv = col; for (int r = col + 1; r < 3; r++) if (fabs(M[r * 3 + col]) > fabs(M[piv * 3 + col])) piv = r; for (int j = 0; j < 3; j++) { double t = M[col * 3 + j]; M[col * 3 + j] = M[piv * 3 + j]; M[piv * 3 + j] = t; } double t2 = v[col]; v[col] = v[piv]; v[piv] = t2; for (int r = col + 1; r < 3; r++) { double f = M[r * 3 + col] / M[col * 3 + col]; for (int j = col; j < 3; j++) M[r * 3 + j] -= f * M[col * 3 + j]; v[r] -= f * v[col]; } } for (int i = 2; i >= 0; i--) { double s = v[i]; for (int j = i + 1; j < 3; j++) s -= M[i * 3 + j] * sol[j]; sol[i] = s / M[i * 3 + i]; } double A = sol[0], B = sol[1], D = sol[2]; double a = sqrt(A * A + B * B); double c = -angleOf(B, A) / w; c = c - period * floor(c / period); // into one period double mean = 0; for (int k = 0; k < 12; k++) mean += ys[k] / 12; double res = 0, tot = 0; for (int k = 0; k < 12; k++) { double fit = A * sin(w * xs[k]) + B * cos(w * xs[k]) + D; res += (ys[k] - fit) * (ys[k] - fit); tot += (ys[k] - mean) * (ys[k] - mean); } printf("%.2f %.2f %.2f %.4f\n", a, c, D, 1 - res / tot); return 0; } /* output: 57.29 572.96 -572.96 -57.29 9.77 4.09 13.45 0.9959 */ ``` ## Dari mana grafik fungsi trigonometri berasal? **Grafik fungsi trigonometri muncul terlambat: fungsinya bermula sebagai panjang dalam lingkaran, dan hanya ketika sebuah besaran digambar terhadap besaran lain gelombangnya muncul.** - **Sekitar 1350.** Nicole Oresme menggambar besaran yang berubah, seperti kecepatan terhadap waktu, sebagai garis yang tingginya menunjukkan besarnya pada tiap saat, pendahulu awal grafik. - **1630-an.** Roberval menggambar kurva sinus sebagai pendamping sikloid dan menemukan luas di bawah satu lengkungannya. Ini termasuk gelombang sinus pertama yang digambar sebagai kurva. - **1748.** Introductio karya Euler memperlakukan sinus dan kosinus sebagai fungsi bilangan, dengan sudut dalam radian, sehingga $\sin x$ dapat digambar terhadap $x$ dan diturunkan. - **1822.** Théorie analytique de la chaleur karya Fourier menunjukkan bahwa fungsi periodik dapat ditulis sebagai jumlah gelombang sinus dan kosinus, itulah sebabnya menjumlahkan gelombang, seperti dalam artikel ini, menggambarkan bunyi, pasang surut, dan sinyal. - **1863.** Die Lehre von den Tonempfindungen karya Helmholtz menggambarkan nada murni sebagai gelombang sinus dan nada musik sebagai jumlahnya. - **Akhir 1800-an.** Sistem tenaga arus bolak-balik menjadikan gelombang sinus tegangan sebagai benda sehari-hari, dengan frekuensi listrik tetap $50$ atau $60$ Hz. ## Apa kesalahan umum pada grafik trigonometri? **Kesalahan paling umum pada grafik trigonometri adalah sembilan hal berikut, masing-masing dengan pernyataan yang benar.** | Kesalahan | Yang benar | |---|---| | ❌ Grafik tangen adalah gelombang di antara $-1$ dan $1$ | Ia tak punya titik tertinggi atau terendah: ia naik dari jauh di bawah ke jauh di atas di antara asimtot. | | ❌ Menyambung cabang $\tan x$ melewati asimtot | Fungsinya tidak ada di $90^\circ$: angkat pena, dan gambar asimtot putus-putus. | | ❌ Periode $\tan x$ adalah $360^\circ$ | Periodenya $180^\circ$, karena setengah putaran mengubah tanda sinus dan kosinus bersamaan. | | ❌ Periode $\sin bx$ adalah $360^\circ b$ | Periodenya $\frac{360^\circ}{b}$: $b$ yang lebih besar merapatkan gelombang. | | ❌ $y=\sin(2x-60^\circ)$ bergeser $60^\circ$ ke kanan | Keluarkan $2$: $\sin\left(2(x-30^\circ)\right)$, jadi pergeserannya $30^\circ$. | | ❌ Amplitudo $3\tan x$ adalah $3$ | Tangen tak punya amplitudo: $3$ hanya meregangkannya. | | ❌ Menggambar $\sec x$ menukik di antara $-1$ dan $1$ | $\sec x=\frac{1}{\cos x}$ selalu memiliki $|\sec x|\ge1$: bentuk U-nya menyentuh $1$ dan $-1$ dan tidak lebih rendah. | | ❌ $\sin2x+\sin3x$ berperiode $2\times3$ atau $360^\circ\cdot6$ | Ia berulang setiap $\frac{360^\circ}{\gcd(2,3)}=360^\circ$; jumlah gelombang berfrekuensi berbeda bahkan bukan gelombang sinus. | | ❌ Menggambar $\sin x$ untuk $x$ sampai $360$ dengan kalkulator mode radian | $360$ radian sekitar $57$ putaran. Samakan satuan sumbu dan mode program. | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: grafik trigonometri sekilas - **Dari lingkaran:** sinus dan kosinus adalah tinggi dan lebar titik; tangen, kotangen, sekan, dan kosekan adalah panjang yang dipotong sinar pada garis $x=1$ dan $y=1$. - **Tangen:** asimtot di $90^\circ+180^\circ n$, periode $180^\circ$, ganjil, tanpa amplitudo, melalui $(45^\circ,1)$. - **Kebalikan:** asimtot di tempat dasarnya $0$, ujung di tempat ia $\pm1$, $|\sec x|\ge1$, $|\csc x|\ge1$; $\cot x=-\tan(x-90^\circ)$. - **Transformasi:** $y=a\,f(b(x-c))+d$; periode $\frac{360^\circ}{|b|}$ (atau $\frac{180^\circ}{|b|}$), pergeseran $c$, pengangkatan $d$; pada $bx-B$ pergeserannya $\frac{B}{b}$. - **Sketsa:** periode, awal $\frac{B}{b}$, lima titik berjarak seperempat periode, tinggi $d,\ d+a,\ d,\ d-a,\ d$; tangen dari asimtotnya dan titik di $\pm45^\circ$. - **Membaca:** $d=\frac{\text{maks}+\text{min}}{2}$, $a=\frac{\text{maks}-\text{min}}{2}$, $P$ dari dua puncak, kosinus digeser oleh sebuah puncak. - **Menjumlahkan:** frekuensi sama, satu gelombang; frekuensi bilangan bulat, periode $\frac{360^\circ}{\text{fpb}}$; perbandingan irasional, tanpa periode; frekuensi berdekatan berlayang. - **Mencocokkan:** periode yang diketahui membuat $y\approx A\sin bx+B\cos bx+D$ linear; $R^2$ mengukur kecocokan. ## Glosarium: istilah penting - **Asimtot tegak**: Garis tegak yang didekati grafik tanpa pernah menyentuhnya, di x tempat fungsi tidak ada, seperti x = 90 derajat untuk tangen. - **Periode**: Panjang positif terkecil yang setelahnya grafik berulang tepat: 360 derajat untuk sinus dan 180 derajat untuk tangen. - **Amplitudo**: Jarak dari garis tengah gelombang sinus atau kosinus ke titik tertingginya, sama dengan nilai mutlak a pada a sin(bx) ditambah d. - **Garis tengah**: Garis mendatar di tengah-tengah nilai tertinggi dan terendah sebuah gelombang, y sama dengan d. - **Pergeseran fase**: Jarak c yang digeserkan ke kanan grafik y = a f(b(x - c)) + d dibandingkan induknya; untuk f(bx - B) nilainya B dibagi b. - **Sinusoida**: Grafik berbentuk a sin(b(x - c)) + d; gelombang sinus dan kosinus dengan amplitudo, periode, dan pergeseran apa pun semuanya sinusoida. - **Frekuensi**: Banyaknya siklus per satuan: kebalikan periode, sehingga periode 20 milidetik adalah 50 siklus per detik, 50 hertz. - **Layangan**: Pembesaran dan pengecilan lambat jumlah dua gelombang berfrekuensi berdekatan, berulang sesering selisih frekuensinya. - **Kuadrat terkecil**: Cara mencocokkan kurva dengan pengukuran dengan memilih bilangan yang membuat jumlah kuadrat jarak tegak ke titik-titik sekecil mungkin. ## Pertanyaan yang sering diajukan ### Seperti apa grafik tan x? Ia adalah rangkaian cabang yang naik dan dipisahkan asimtot tegak di 90 derajat ditambah 180 derajat kali n. Tiap cabang melewati sumbu-x, melalui titik pada 45 derajat dengan tinggi 1, dan berjalan dari jauh di bawah ke jauh di atas. ### Berapa periode tangen dan kotangen? Keduanya berulang setiap 180 derajat, atau pi radian, bukan 360. Setengah putaran mengubah tanda sinus dan kosinus sekaligus, sehingga hasil baginya tetap. Untuk tan b x periodenya 180 derajat dibagi b. ### Bagaimana menggambar grafik sekan dan kosekan? Gambar kosinus atau sinus dengan samar. Letakkan asimtot di tempat ia nol, tandai titik tempat ia 1 atau minus 1, dan gambar cabang berbentuk U dari titik itu ke asimtot. Grafiknya tak pernah berada di antara minus 1 dan 1. ### Berapa pergeseran fase y = sin(2x − π/3)? Keluarkan 2: sin dari 2 kali x dikurangi pi per 6. Grafik bergeser pi per 6 radian, 30 derajat, ke kanan, bukan pi per 3. Pergeserannya B dibagi b. ### Bagaimana mencari persamaan grafik sinus dari gambarnya? Ambil garis tengah sebagai rata-rata nilai tertinggi dan terendah dan amplitudo sebagai setengah selisihnya. Ukur periode antara dua puncak, jadikan b sama dengan 360 derajat per periode, dan geser kosinus sebesar x sebuah puncak. ### Apakah jumlah dua gelombang sinus adalah gelombang sinus? Hanya bila frekuensinya sama, ketika jumlahnya satu gelombang sinus. Dengan frekuensi berbeda jumlahnya bukan gelombang sinus; ia berulang bila frekuensinya bilangan bulat, dan tak pernah berulang bila perbandingannya irasional. ### Bagaimana mencocokkan gelombang sinus dengan data? Pilih periodenya, lalu cocokkan y sebagai A sin ditambah B cos ditambah D dengan kuadrat terkecil, yang linear. Amplitudonya akar dari A kuadrat ditambah B kuadrat, dan mutu kecocokan adalah R kuadrat. Coba beberapa periode bila ragu. ### Berapa daerah hasil sekan dan kosekan? Semua bilangan yang paling sedikit 1 atau paling banyak minus 1, tanpa apa pun di antaranya. Keduanya kebalikan kosinus dan sinus, yang tak pernah keluar dari selang minus 1 sampai 1, sehingga kebalikannya tak pernah memasukinya. --- # Trigonometric Equations: How to Solve sin x = c and Harder Ones Source: https://nunada.my.id/articles/trigonometric-equations/ Updated: 2026-10-26 ## Quick answer **To solve a trigonometric equation, reduce it to basic equations such as $\sin u=c$, solve each with its two families of angles plus whole turns, and keep the solutions inside the interval asked for.** A multiple angle, as in $\sin2x=\frac12$, gives more solutions per turn, not fewer. Solve an equation quadratic in $\sin x$ as a quadratic first and discard roots beyond $\pm1$. Factor instead of dividing by a function that can be zero, and after squaring check every answer in the original equation. ### Key takeaways - A trigonometric equation has infinitely many solutions unless an interval is given, because the functions repeat: $\sin x=\frac12$ is solved by $30^\circ+360^\circ n$ and $150^\circ+360^\circ n$ for every whole number $n$, and the interval decides which values of $n$ are used. - For $\sin(kx+b)=c$, solve for the angle $u=kx+b$ over an interval $k$ times as long, then subtract $b$ and divide by $k$. That is why $\sin2x=\frac12$ has four solutions in $[0^\circ,360^\circ)$: in one turn there are $2k$ of them. - An equation quadratic in $\sin x$, $\cos x$ or $\tan x$ is solved by substituting $u$, solving for $u$ and then solving the basic equations. For sine and cosine a root outside $-1\le u\le1$ gives no angle: $\cos^2x=4$ has two roots $u$ and no solution $x$. - Never divide by a function that can be zero. In $\sin2x=\cos x$, dividing by $\cos x$ loses $90^\circ$ and $270^\circ$; moving everything to one side and factoring, $\cos x\,(2\sin x-1)=0$, finds all four solutions. - Squaring, or multiplying by an expression that can be zero, can add false roots. Squaring $\sin x+\cos x=1$ gives four candidates ($0^\circ$, $90^\circ$, $180^\circ$, $270^\circ$) and only two of them satisfy the original equation, so every candidate is checked. - When $x$ itself is mixed with a trigonometric function, as in $\cos x=x$, no formula gives the answer. Graph it, bracket a sign change, and use bisection (one more binary digit per step) or Newton's method (roughly twice as many correct digits per step), with $x$ in radians. ## What is a trigonometric equation, and why does it have infinitely many solutions? **A trigonometric equation is an equation in which the unknown is the angle inside one or more trigonometric functions, such as $\sin x=\frac12$ or $2\cos^2x=\cos x$; because the functions repeat, a solution is never alone.** If $x$ solves $\sin x=\frac12$ then so does $x+360^\circ$, and so does $x-360^\circ$, since a full turn brings the point on the unit circle back to the same place. Sine and cosine repeat every $360^\circ$ (that is $2\pi$ radians), and tangent every $180^\circ$ ($\pi$ radians). So the answer to an equation is either **a family** with a whole number $n$ in it, or **a list** of the solutions inside an interval that the question names. This is what separates an equation from an identity (see [the article on identities](https://nunada.my.id/articles/trigonometric-identities/#identity-or-equation)): an identity is true for every angle, while an equation is true for some, and solving it means finding them all. The basic cases, $\sin x=c$, $\cos x=c$ and $\tan x=c$, are in [the article on basic trigonometry](https://nunada.my.id/articles/basic-trigonometry/#equations). Here is what comes after them: how to list solutions in an interval, equations with multiple angles, quadratic ones, ones that need an identity, why some steps lose solutions or add false ones, and what to do when no formula exists. Angles are in degrees below, as they are in the other trigonometry articles, except in the last sections, where an equation mixes the unknown with a plain number and radians are the only choice. To use radians elsewhere, replace $360^\circ$ by $2\pi$ and $180^\circ$ by $\pi$. *The line $y=\frac12$ cuts the graph of $\sin x$ at every point of the form $30^\circ+360^\circ n$ and $150^\circ+360^\circ n$. Three turns are drawn here and show six of them; on the whole number line there are infinitely many.* ## How do you pick the solutions that lie in a given interval? **To list the solutions in an interval, write the general solution with a whole number $n$, put it into the inequality that describes the interval, and keep the whole numbers $n$ that fit.** The interval then chooses the members of each family, and nothing is guessed. For $\sin x=\frac12$ with $-180^\circ\le x<540^\circ$ the two families are $30^\circ+360^\circ n$ and $150^\circ+360^\circ n$: | $n$ | $30^\circ+360^\circ n$ | in the interval? | $150^\circ+360^\circ n$ | in the interval? | |---|---|---|---|---| | $-1$ | $-330^\circ$ | no | $-210^\circ$ | no | | $0$ | $30^\circ$ | yes | $150^\circ$ | yes | | $1$ | $390^\circ$ | yes | $510^\circ$ | yes | | $2$ | $750^\circ$ | no | $870^\circ$ | no | So $x=30^\circ,\ 150^\circ,\ 390^\circ,\ 510^\circ$. For $\tan x=\sqrt3$ with $-360^\circ\le x\le360^\circ$ there is only one family, $60^\circ+180^\circ n$, and $-360\le60+180n\le360$ means $-2.33\le n\le1.67$, so $n=-2,-1,0,1$ and $x=-300^\circ,\ -120^\circ,\ 60^\circ,\ 240^\circ$. You can also predict how many there will be. An interval that is $L$ degrees long holds $\frac{L}{360}$ turns, and for $|c|<1$ each turn contains two solutions of $\sin x=c$ and two of $\cos x=c$, while each $180^\circ$ contains one solution of $\tan x=c$. At the ends of the range, $c=\pm1$ for sine and cosine, the two families coincide and there is only one solution per turn: the wave touches the line instead of crossing it. In radians the same interval $0\le x<2\pi$ has $\sin x=\frac12$ solved by $\frac{\pi}{6}$ and $\frac{5\pi}{6}$. ## How do you solve an equation like sin 2x = 1/2, where the angle is a multiple of x? **To solve $\sin(kx+b)=c$ with $k>0$, solve the basic equation for the whole angle $u=kx+b$ over an interval that is $k$ times as long, then subtract $b$ and divide by $k$.** The step that people skip is the first one: when $x$ runs from $0^\circ$ to $360^\circ$, the angle $u=2x$ runs from $0^\circ$ to $720^\circ$, two full turns, so there are twice as many solutions. **Example.** $\sin2x=\frac12$ for $0^\circ\le x<360^\circ$. Put $u=2x$, so $0^\circ\le u<720^\circ$. Then $\sin u=\frac12$ gives $u=30^\circ,\ 150^\circ,\ 390^\circ,\ 510^\circ$ and, halving, $x=15^\circ,\ 75^\circ,\ 195^\circ,\ 255^\circ$. Four solutions, not two. Solving only $2x=30^\circ$ and $2x=150^\circ$ would find the first two and miss the second turn. **With a shift.** $\cos(3x-30^\circ)=\frac12$ for $0^\circ\le x<360^\circ$. Put $u=3x-30^\circ$, so $-30^\circ\le u<1050^\circ$. Then $\cos u=\frac12$ gives $u=60^\circ,\ 300^\circ,\ 420^\circ,\ 660^\circ,\ 780^\circ,\ 1020^\circ$ (the value $-60^\circ$ is below the range), and $x=\frac{u+30^\circ}{3}=30^\circ,\ 110^\circ,\ 150^\circ,\ 230^\circ,\ 270^\circ,\ 350^\circ$. The count follows a rule: **in one turn there are $2k$ solutions** ($k$ of them when $c=\pm1$ for sine and cosine), and they repeat every $\frac{360^\circ}{k}$, or $\frac{180^\circ}{k}$ for tangent. If $k$ is negative, use $\sin(-u)=-\sin u$ and $\cos(-u)=\cos u$ to make it positive first. Try other values of $k$, $b$ and $c$ below, and read off the general solution. *The equation $\sin2x=\frac12$ on $0^\circ\le x<360^\circ$. The wave $\sin2x$ (solid) turns twice as fast as $\sin x$ (dashed), so the line meets it four times, at $15^\circ$, $75^\circ$, $195^\circ$ and $255^\circ$, and not twice as for $\sin x=\frac12$.* ## How do you solve an equation that is quadratic in sin x, cos x or tan x? **An equation that is quadratic in one trigonometric function is solved by writing $u$ for that function, solving the quadratic in $u$, and then solving a basic equation for each root, keeping a root only if some angle can reach it.** For sine and cosine the roots must lie between $-1$ and $1$; for tangent every root is allowed. 1. Replace the function by $u$: $2\sin^2x-\sin x-1=0$ becomes $2u^2-u-1=0$. 2. Solve for $u$ by factoring or the quadratic formula: $(2u+1)(u-1)=0$, so $u=-\frac12$ or $u=1$. 3. Discard any root with $|u|>1$ when $u$ is a sine or a cosine. 4. For each root left, solve $\sin x=u$: $\sin x=-\frac12$ gives $210^\circ$ and $330^\circ$, and $\sin x=1$ gives $90^\circ$. 5. List all the angles: $x=90^\circ,\ 210^\circ,\ 330^\circ$. Notice that there are three solutions and not four. The root $u=1$ is the highest value the sine reaches, so it is reached once per turn, as in the picture: the curve touches the axis there. *The graph of $2\sin^2x-\sin x-1$ on $0^\circ\le x<360^\circ$ meets the axis at three points. At $210^\circ$ and $330^\circ$ (where $\sin x=-\frac12$) it crosses, and at $90^\circ$ (where $\sin x=1$) it only touches from below, because $\sin x$ never goes beyond $1$: a root $u=1$ gives one angle, not two.* **When a root is outside the range.** $\sin^2x-\sin x-2=0$ factors as $(\sin x-2)(\sin x+1)=0$. The root $\sin x=2$ is impossible, because no angle has a sine above $1$, and $\sin x=-1$ gives $x=270^\circ$. So the single solution is $270^\circ$. In the same way $\cos^2x=4$ has the roots $\cos x=2$ and $\cos x=-2$ and no solution at all. With tangent there is no such limit: $\tan^2x=3$ gives $\tan x=\pm\sqrt3$ and $x=60^\circ,\ 120^\circ,\ 240^\circ,\ 300^\circ$. Set the coefficients below to see the roots $u$, which of them an angle can reach, and the graph of the left side. ## Why should you never divide both sides by sin x or cos x? **Dividing both sides by $\sin x$ or $\cos x$ is only valid at the angles where that function is not zero, and the angles where it is zero may be solutions, which the division silently throws away.** The safe move is the one from algebra: bring everything to one side and factor. Take $\sin2x=\cos x$ on $0^\circ\le x<360^\circ$. | Dividing | Factoring | |---|---| | $2\sin x\cos x=\cos x$ | $2\sin x\cos x-\cos x=0$ | | divide by $\cos x$: $2\sin x=1$ | $\cos x\,(2\sin x-1)=0$ | | $x=30^\circ,\ 150^\circ$ | $\cos x=0$ gives $90^\circ,\ 270^\circ$; $\sin x=\frac12$ gives $30^\circ,\ 150^\circ$ | | **2 solutions, two lost** | **4 solutions** | The lost angles, $90^\circ$ and $270^\circ$, are exactly the ones where $\cos x=0$, the thing that was divided by. The same happens with $\tan x=2\sin x$: writing $\tan x=\frac{\sin x}{\cos x}$ and then cancelling $\sin x$ loses $0^\circ$ and $180^\circ$, while $\sin x\,(1-2\cos x)=0$ after multiplying by $\cos x$ finds $\sin x=0$ and $\cos x=\frac12$ and so $0^\circ,\ 60^\circ,\ 180^\circ,\ 300^\circ$. If you do want to divide, first solve the case where the divisor is zero on its own, then divide and solve the rest. ## Which identity should you use to turn a hard equation into an easy one? **Use the identity that leaves a single trigonometric function of a single angle, because that is the form you already know how to solve.** What you see in the equation tells you which one. | What the equation has | The identity | Example | |---|---|---| | the same function of $x$ and $2x$ | $\sin2x=2\sin x\cos x$ | $\sin2x=\cos x$ | | $\cos2x$ together with $\cos x$ | $\cos2x=2\cos^2x-1$ | $\cos2x=\cos x$ | | squares of sine and cosine together | $\cos^2x=1-\sin^2x$ | $2\cos^2x+3\sin x=3$ | | a difference of two sines or cosines | sum-to-product | $\sin3x=\sin x$ | | a product $\sin x\cos x$ | $\sin x\cos x=\frac12\sin2x$ | $\sin x\cos x=\frac14$ | | a tangent beside a sine | $\tan x=\frac{\sin x}{\cos x}$, then factor | $\tan x=2\sin x$ | | $a\sin x+b\cos x$ | one wave $R\sin(x+\varphi)$ | $3\sin x+4\cos x=2.5$ | The formulas themselves are derived in [the article on the double-angle formulas](https://nunada.my.id/articles/trigonometric-identities/#double-and-half). **A worked example:** $\sin3x=\sin x$. Move everything to one side, $\sin3x-\sin x=0$, and use the sum-to-product formula, $\sin3x-\sin x=2\cos2x\,\sin x$. A product is zero when a factor is, so $\sin x=0$, giving $0^\circ,\ 180^\circ$, or $\cos2x=0$, giving $2x=90^\circ+180^\circ n$ and $x=45^\circ,\ 135^\circ,\ 225^\circ,\ 315^\circ$. Six solutions. Another route, with the triple-angle formula, reaches the same six but with more algebra, which is why the choice of identity matters. Below are eleven equations solved one line at a time, each line with the reason for it. Their graphs show both sides and where they meet. ## How do you solve a sin x + b cos x = c? **To solve $a\sin x+b\cos x=c$, write the left side as one wave $R\sin(x+\varphi)$ with $R=\sqrt{a^2+b^2}$ and $\varphi=\operatorname{atan2}(b,a)$; the equation becomes $\sin(x+\varphi)=\frac{c}{R}$, a basic one.** This works exactly when $|c|\le R$, because $R$ is the highest value the wave reaches. The conversion is derived in [the article on product-to-sum formulas and the single wave](https://nunada.my.id/articles/trigonometric-identities/#product-and-sum). **Example.** $\sqrt3\sin x+\cos x=1$. Here $R=\sqrt{3+1}=2$ and $\varphi=\operatorname{atan2}(1,\sqrt3)=30^\circ$, so $2\sin(x+30^\circ)=1$, that is $\sin(x+30^\circ)=\frac12$. Then $x+30^\circ=30^\circ$ or $150^\circ$ (plus $360^\circ n$), so $x=0^\circ$ or $x=120^\circ$. Check the second: $\sqrt3\sin120^\circ+\cos120^\circ=\frac32-\frac12=1$. With less friendly numbers the steps are the same: $3\sin x+4\cos x=2.5$ has $R=5$, $\varphi\approx53.13^\circ$ and the solutions $96.87^\circ$ and $336.87^\circ$. If $c$ is bigger than $R$ there is no solution: $3\sin x+4\cos x=6$ is impossible, since the left side never exceeds $5$. There are two other ways. **Squaring** (isolate one term, square, use $\sin^2x+\cos^2x=1$) always works but adds false roots, covered next. **The half-angle substitution** $t=\tan\frac{x}{2}$ turns $\sin x$ into $\frac{2t}{1+t^2}$ and $\cos x$ into $\frac{1-t^2}{1+t^2}$ and the equation into a quadratic in $t$; it loses $x=180^\circ$, where $\tan\frac{x}{2}$ does not exist, so that angle has to be tried separately. The single wave needs neither check, which is why it is the first choice. ## Why do some answers fail when you check them, and how do you avoid false roots? **A false (extraneous) root is an answer that the steps produce but that does not satisfy the original equation; it appears whenever a step is not reversible, such as squaring, and the cure is to check every candidate in the original equation.** Squaring turns $A=B$ into $A^2=B^2$, which is also true when $A=-B$. Multiplying by an expression that can be zero has the same effect. **Example.** Solve $\sin x+\cos x=1$ on $0^\circ\le x<360^\circ$. Squaring gives $\sin^2x+2\sin x\cos x+\cos^2x=1$, which is $1+\sin2x=1$, so $\sin2x=0$ and $2x=0^\circ,\ 180^\circ,\ 360^\circ,\ 540^\circ$, that is $x=0^\circ,\ 90^\circ,\ 180^\circ,\ 270^\circ$. Now check each in the original: at $0^\circ$ the sum is $0+1=1$ (true), at $90^\circ$ it is $1+0=1$ (true), at $180^\circ$ it is $0-1=-1$ (false) and at $270^\circ$ it is $-1+0=-1$ (false). The solutions are $0^\circ$ and $90^\circ$; the other two solve $\sin x+\cos x=-1$, the equation that squaring also contains. Doing it with the single wave, $\sqrt2\sin(x+45^\circ)=1$, gives $x+45^\circ=45^\circ$ or $135^\circ$ and the same two answers with nothing to check. **Undefined angles are false roots too.** $\tan x\cos x=1$ simplifies to $\sin x=1$, which suggests $x=90^\circ$. But $\tan90^\circ$ does not exist, so $90^\circ$ is not a solution, and the equation has none at all. The same care applies to anything with $\tan$, $\sec$, $\csc$, $\cot$, a denominator or a square root: list the angles the original equation forbids before you start, and cross them off at the end. | The step | What can happen | What to do | |---|---|---| | square both sides | adds roots (the case $A=-B$) | check each candidate | | multiply by an expression with $x$ | adds roots where it is zero | check each candidate | | divide by an expression with $x$ | loses roots where it is zero | solve that case separately | | a function that is undefined somewhere | the angle is not allowed | cross it off | Finally, an equation with no real solution may still have complex ones: $\sin x=2$ has none among real angles, but with Euler's formula one finds $x=\frac{\pi}{2}\pm i\ln(2+\sqrt3)$, where $\ln(2+\sqrt3)\approx1.317$. *Squaring $\sin x+\cos x=1$ gives $(\sin x+\cos x)^2=1$, which is true when the sum is $1$ or $-1$. The graph of $\sin x+\cos x$ meets the line $y=1$ at $0^\circ$ and $90^\circ$ (solutions) and the line $y=-1$ at $180^\circ$ and $270^\circ$ (hollow dots: false roots of the original equation).* ## What if no formula works? Solving cos x = x with graphs, bisection and Newton's method **When the unknown appears both as a plain number and inside a trigonometric function, as in $\cos x=x$, no algebra gives the answer, so you graph the equation, trap a root between two points where the sign changes, and close in with bisection or Newton's method.** Now $x$ is a number, not an angle in degrees, and it has to be in **radians**: $\cos x=x$ has a root at $0.7391$, and a calculator in degree mode would answer a different question. 1. **Graph it.** Draw $y=\cos x$ and $y=x$, or $f(x)=\cos x-x$ and look where it crosses zero. This shows how many roots there are (one here, because $\cos x$ falls while $x$ rises) and roughly where. 2. **Bracket it.** Find $a0$ and $f(1)=-0.46<0$. A continuous function that changes sign must be zero somewhere in between. 3. **Bisection.** Look at the midpoint and keep the half in which the sign still changes. The interval halves every step, so the error after $n$ steps is at most $\frac{b-a}{2^n}$: one more binary digit, about $0.3$ of a decimal digit, per step. Forty steps give twelve decimals. It is slow but cannot fail. 4. **Newton's method.** From a guess $x$, follow the tangent line to the axis: $x_{n+1}=x_n-\frac{f(x_n)}{f'(x_n)}$, here with $f'(x)=-\sin x-1$. Near a root it roughly doubles the number of correct digits each step (see [the article on Newton's method](https://nunada.my.id/articles/newtons-method/#convergence)) but it needs a good start and can fail (see [where it goes wrong](https://nunada.my.id/articles/newtons-method/#failures)). The table shows both on $\cos x=x$, bisection on $[0,1]$ and Newton from $x_0=1$; the root is $0.7390851332$. | Step | Bisection: midpoint | Newton's method: $x$ | |---|---|---| | 1 | 0.5000000000 | 0.7503638678 | | 2 | 0.7500000000 | 0.7391128909 | | 3 | 0.6250000000 | 0.7390851334 | | 4 | 0.6875000000 | 0.7390851332 | | 5 | 0.7187500000 | 0.7390851332 | | 6 | 0.7343750000 | 0.7390851332 | Pressing the cosine key again and again on a calculator in radian mode does converge to the same number, because $x_{n+1}=\cos x_n$ shrinks the distance to the root by a factor of about $\sin0.739\approx0.67$ each time, which is slow compared with Newton. Pick another equation below, or step through each method. *Bisection on $f(x)=\cos x-x$ with $x$ in radians. The interval $[0,1]$ has $f(0)>0>f(1)$; the midpoints $0.5$, $0.75$ and $0.625$ (numbered $1$, $2$, $3$) each keep the half where $f$ changes sign, and the root $0.7391$ stays inside every one of them.* ## How do you solve trigonometric equations in a program? **A program solves $\sin(kx+b)=c$ by the same steps as on paper: take the principal angle with `asin`, add its mirror image, step through the whole numbers $n$ and keep the $x$ that fall in the interval.** Three details matter. `asin` and `acos` return only one angle (`asin` between $-90^\circ$ and $90^\circ$), so the second family is yours to add. Roots that coincide, as at $c=1$, must not be listed twice, and floating-point errors such as $89.99999999$ make equality tests unreliable, so round before comparing. And a value beyond $\pm1$ makes `asin` fail, so test for it first. The programs below solve four equations from this article, $\sin x=\frac12$, $\sin2x=\frac12$, $\sin x=2$ (no solution) and $2\sin^2x-\sin x-1=0$ through its roots $u=-\frac12$ and $u=1$, and then solve $\cos x=x$ by bisection on $[0,1]$ until the interval is shorter than $10^{-12}$, which takes $40$ steps and gives $0.7390851332$. ```python import math def solve(fn, k, b, c, lo=0.0, hi=360.0): """Every x in [lo, hi) with fn(k*x + b) = c, in degrees (k > 0), for fn = 'sin' or 'cos'.""" if abs(c) > 1: return [] # no angle has a sine or cosine beyond 1 alpha = math.degrees(math.asin(c) if fn == 'sin' else math.acos(c)) mirrors = [alpha, 180 - alpha] if fn == 'sin' else [alpha, -alpha] found = set() for u0 in mirrors: # k*x + b = u0 + 360 n n = math.floor((k * lo + b - u0) / 360) - 1 # start a turn early, filter below while True: x = (u0 + 360 * n - b) / k if x >= hi: break if x >= lo: found.add(round(x, 9)) n += 1 return sorted(found) print(solve('sin', 1, 0, 0.5)) # [30.0, 150.0] print(solve('sin', 2, 0, 0.5)) # [15.0, 75.0, 195.0, 255.0] print(solve('cos', 3, 0, 0.5, 0, 120)) # [20.0, 100.0] print(solve('sin', 1, 0, 2)) # [] # 2 sin^2 x - sin x - 1 = 0: a quadratic in u = sin x a, b, c = 2, -1, -1 d = b * b - 4 * a * c for u in [(-b - math.sqrt(d)) / (2 * a), (-b + math.sqrt(d)) / (2 * a)]: print(u, solve('sin', 1, 0, u)) # -0.5 [210.0, 330.0], then 1.0 [90.0] def bisect(f, lo, hi, tol=1e-12): """Halve [lo, hi] until it is shorter than tol; f(lo) and f(hi) must have opposite signs.""" steps = 0 while hi - lo > tol: mid = (lo + hi) / 2 if f(lo) * f(mid) <= 0: hi = mid else: lo = mid steps += 1 return (lo + hi) / 2, steps root, steps = bisect(lambda x: math.cos(x) - x, 0, 1) print(round(root, 10), steps) # 0.7390851332 40 x = 1.0 # Newton: x - f(x)/f'(x) with f = cos x - x for _ in range(4): x -= (math.cos(x) - x) / (-math.sin(x) - 1) print(round(x, 10)) # 0.7390851332 ``` ```javascript function solve(fn, k, b, c, lo = 0, hi = 360) { // every x in [lo, hi) with fn(k*x + b) = c, in degrees (k > 0), for fn = 'sin' or 'cos' if (Math.abs(c) > 1) return [] // no angle has a sine or cosine beyond 1 const alpha = ((fn === 'sin' ? Math.asin(c) : Math.acos(c)) * 180) / Math.PI const mirrors = fn === 'sin' ? [alpha, 180 - alpha] : [alpha, -alpha] const found = new Set() for (const u0 of mirrors) { // k*x + b = u0 + 360 n for (let n = Math.floor((k * lo + b - u0) / 360) - 1; ; n++) { // start a turn early, filter below const x = (u0 + 360 * n - b) / k if (x >= hi) break if (x >= lo) found.add(Math.round(x * 1e9) / 1e9) } } return [...found].sort((p, q) => p - q) } solve('sin', 1, 0, 0.5) // [30, 150] solve('sin', 2, 0, 0.5) // [15, 75, 195, 255] solve('cos', 3, 0, 0.5, 0, 120) // [20, 100] solve('sin', 1, 0, 2) // [] // 2 sin^2 x - sin x - 1 = 0: a quadratic in u = sin x const [a, b, c] = [2, -1, -1] const d = b * b - 4 * a * c ;[(-b - Math.sqrt(d)) / (2 * a), (-b + Math.sqrt(d)) / (2 * a)].map((u) => [u, solve('sin', 1, 0, u)]) // [[-0.5, [210, 330]], [1, [90]]] function bisect(f, lo, hi, tol = 1e-12) { // halve [lo, hi] until it is shorter than tol; f(lo) and f(hi) must have opposite signs let steps = 0 while (hi - lo > tol) { const mid = (lo + hi) / 2 if (f(lo) * f(mid) <= 0) hi = mid else lo = mid steps++ } return [(lo + hi) / 2, steps] } const [root, steps] = bisect((x) => Math.cos(x) - x, 0, 1) ;[+root.toFixed(10), steps] // [0.7390851332, 40] let x = 1 // Newton: x - f(x)/f'(x) with f = cos x - x for (let i = 0; i < 4; i++) x -= (Math.cos(x) - x) / (-Math.sin(x) - 1) +x.toFixed(10) // 0.7390851332 ``` ```cpp #include #include #include using namespace std; const double PI = 3.14159265358979323846; double found[64]; // the solutions of the last call // Every x in [lo, hi) with sin(k x + b) = c (degrees, k > 0), sorted, in found[]; returns how many. int solveSin(double k, double b, double c, double lo, double hi) { int count = 0; if (fabs(c) > 1) return 0; // no angle has a sine beyond 1 double alpha = asin(c) * 180.0 / PI; for (int mirror = 0; mirror < 2; mirror++) { double u0 = mirror == 0 ? alpha : 180.0 - alpha; // k x + b = u0 + 360 n int n = (int)floor((k * lo + b - u0) / 360.0) - 1; while (count < 60) { double x = (u0 + 360.0 * n - b) / k; if (x >= hi) break; if (x >= lo) { int seen = 0; for (int i = 0; i < count; i++) if (fabs(found[i] - x) < 1e-9) seen = 1; if (seen == 0) { found[count] = x; count++; } } n++; } } for (int i = 1; i < count; i++) { // insertion sort double v = found[i]; int j = i - 1; while (j >= 0 && found[j] > v) { found[j + 1] = found[j]; j--; } found[j + 1] = v; } return count; } void show(int count) { if (count == 0) printf("none"); for (int i = 0; i < count; i++) { if (i > 0) printf(" "); printf("%.1f", found[i]); } printf("\n"); } double f(double x) { return cos(x) - x; } int main() { show(solveSin(1, 0, 0.5, 0, 360)); show(solveSin(2, 0, 0.5, 0, 360)); show(solveSin(1, 0, 2, 0, 360)); // 2 sin^2 x - sin x - 1 = 0: a quadratic in u = sin x double a = 2, b = -1, c = -1; double d = b * b - 4 * a * c; show(solveSin(1, 0, (-b - sqrt(d)) / (2 * a), 0, 360)); show(solveSin(1, 0, (-b + sqrt(d)) / (2 * a), 0, 360)); // cos x = x by bisection on [0, 1] double lo = 0, hi = 1; int steps = 0; while (hi - lo > 1e-12) { double mid = (lo + hi) / 2; if (f(lo) * f(mid) <= 0) hi = mid; else lo = mid; steps++; } printf("%.10f %d\n", (lo + hi) / 2, steps); return 0; } /* output: 30.0 150.0 15.0 75.0 195.0 255.0 none 210.0 330.0 90.0 0.7390851332 40 */ ``` ## Where do trigonometric equations come from? **Trigonometric equations began as table look-ups run backwards in astronomy, and the one that mattered most, Kepler's equation, is exactly the kind with no formula.** - **About 150 AD.** Ptolemy's Almagest gives a table of chords of a circle. Finding the angle for a given chord means reading the table backwards and interpolating between two entries, which is solving $\sin x=c$ numerically. - **About 500 AD.** Aryabhata's sine table has 24 values, one for every $3.75^\circ$, and such a table can be read forwards, from angle to sine, or backwards, from sine to angle, which is solving $\sin x=c$ by look-up. - **1609.** Kepler's Astronomia nova contains the equation $M=E-e\sin E$ that links the time since a planet passed its nearest point ($M$) to its position ($E$). No formula solves it for $E$ in terms of $M$, so it has been solved ever since by iteration. - **1687.** Newton's Principia gives an iterative method for Kepler's problem, a forerunner of the method that carries his name. - **1824.** Bessel writes $E$ as a series of the functions that now carry his name, a different answer to the same equation. - **Today.** Calculators and libraries return the principal value of `asin`, `acos` and `atan` and leave the other families to the user; equations such as $\cos x=x$ go to bisection or Newton's method. ## What are the common mistakes when solving trigonometric equations? **The most common mistakes when solving trigonometric equations are the nine below, each with the correct step.** | Mistake | Correct | |---|---| | ❌ $\sin x=\frac12\Rightarrow x=30^\circ$ and stop | There is a second family: $150^\circ+360^\circ n$. A calculator gives the principal value only. | | ❌ $\tan x=1\Rightarrow x=45^\circ+360^\circ n$ | Tangent repeats every $180^\circ$: $x=45^\circ+180^\circ n$, so $225^\circ$ counts too. | | ❌ $\sin2x=\frac12$: solve $2x=30^\circ,150^\circ$ and halve, finding only $15^\circ,75^\circ$ | $2x$ runs over $0^\circ$ to $720^\circ$, so there are four solutions: $15^\circ,\ 75^\circ,\ 195^\circ,\ 255^\circ$. | | ❌ Divide both sides of $\sin2x=\cos x$ by $\cos x$ | Factor instead: $\cos x\,(2\sin x-1)=0$, which also finds $90^\circ$ and $270^\circ$. | | ❌ Accept $\sin x=2$ or $\cos x=-3$ as a step to continue from | No angle has such a sine or cosine: no solution from that root. | | ❌ Square both sides and keep every answer | Check each candidate in the original equation: $\sin x+\cos x=1$ keeps $0^\circ,90^\circ$ and drops $180^\circ,270^\circ$. | | ❌ $\sin x\cos x=\frac14\Rightarrow\sin x=\frac14$ or $\cos x=\frac14$ | Only a product equal to $0$ splits into factors. Here $\frac12\sin2x=\frac14$, so $\sin2x=\frac12$. | | ❌ $\sin^2x=\frac14\Rightarrow\sin x=\frac12$ | Take both roots: $\sin x=\pm\frac12$, giving $30^\circ,150^\circ,210^\circ,330^\circ$. | | ❌ Solve $\cos x=x$ with $x$ in degrees | $x$ is a plain number mixed with a cosine, so it is in radians: the root is $0.7391$. | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: trigonometric equations at a glance - **Many solutions:** the functions repeat ($360^\circ$ for sine and cosine, $180^\circ$ for tangent), so an answer is a family with a whole number $n$ or a list inside an interval. - **Interval:** put the family into the inequality and keep the whole numbers $n$ that fit; about two solutions per turn for $\sin x=c$ and $\cos x=c$, one per $180^\circ$ for $\tan x=c$. - **Multiple angle:** $\sin(kx+b)=c$: solve for $u=kx+b$ over a $k$ times longer interval, then $x=\frac{u-b}{k}$; $2k$ solutions per turn. - **Quadratic:** substitute $u$, solve, discard $|u|>1$ for sine and cosine, solve the basic equations; a root $u=\pm1$ gives one angle. - **Dividing:** never by a function that can be zero; move everything to one side and factor. - **Identities:** use the one that leaves a single function of a single angle; $a\sin x+b\cos x=R\sin(x+\varphi)$ needs $|c|\le R$. - **False roots:** squaring and multiplying can add them, undefined angles are not solutions; check every candidate in the original. - **No formula:** $\cos x=x$: graph, bracket, bisection (one binary digit per step) or Newton ($x-\frac{f}{f'}$), with $x$ in radians. ## Glossary: key terms - **Trigonometric equation**: An equation whose unknown is the angle inside one or more trigonometric functions, true for some angles and not for others. - **General solution**: The family of all solutions of a trigonometric equation, written with a whole number n, such as 30 degrees plus 360 degrees times n. - **Principal value**: The one angle that an inverse function such as arcsine returns, from which the other solution families are built. - **Multiple-angle equation**: An equation such as sin 2x = 1/2 in which the function is applied to a multiple of the unknown, so that it has 2k solutions per turn. - **Quadratic in a trigonometric function**: An equation of the form a u squared plus b u plus c equal to zero, where u is sin x, cos x or tan x, solved by substituting u. - **Extraneous root**: An answer produced by the steps of a solution, such as squaring, that does not satisfy the original equation. - **Lost solution**: A solution that disappears because a step, such as dividing by an expression that can be zero, is not valid at that angle. - **Bisection**: A way to find a root by repeatedly halving an interval on which a continuous function changes sign, keeping the half that still does. - **Bracket**: Two points at which a continuous function has opposite signs, which guarantees a root between them. ## Frequently asked questions ### How many solutions does a trigonometric equation have? Infinitely many if no interval is given, because the functions repeat. In one turn, sin x equals c and cos x equals c each have two solutions when c is strictly between minus 1 and 1, and tan x equals c has one for every 180 degrees. ### How do you solve sin 2x = 1/2 for x between 0 and 360 degrees? Let u be 2x, which runs from 0 to 720 degrees. Then sin u equals one half at 30, 150, 390 and 510 degrees, so x is 15, 75, 195 and 255 degrees. There are four solutions, not two, because 2x goes round twice. ### Why do I lose solutions when I divide by cos x? Division by cos x is not allowed where cos x is zero, at 90 and 270 degrees, and those angles may be solutions. Move everything to one side and factor out cos x instead, which keeps the solutions where it is zero. ### How do you solve a quadratic trigonometric equation? Write u for sin x, cos x or tan x and solve the quadratic in u by factoring or the formula. For sine and cosine discard roots outside minus 1 to 1, then solve sin x equals each remaining root for the angles. ### How do you solve a sin x + b cos x = c? Rewrite the left side as R sin of x plus phi with R the square root of a squared plus b squared. Then sin of x plus phi equals c over R, which has solutions exactly when c is not larger than R in absolute value. ### Why do I get extra answers after squaring a trigonometric equation? Squaring turns A equals B into A squared equals B squared, which is also true when A equals minus B. The extra answers solve that other equation, so check each candidate in the original equation and cross out the ones that fail. ### Can sin x equal 2? Not for any real angle, because the sine of a real angle is never above 1. With complex numbers it can: sin x equals 2 at x equal to pi over 2 plus or minus i times the natural log of 2 plus root 3. ### How do you solve cos x = x? No formula gives it, so use a numerical method with x in radians. Bracket a sign change of cos x minus x, such as 0 to 1, then use bisection or Newton's method. The root is about 0.7391. --- # Persamaan Trigonometri: Menyelesaikan sin x = c dan Lainnya Source: https://nunada.my.id/artikel/persamaan-trigonometri/ Updated: 2026-10-26 ## Jawaban singkat **Untuk menyelesaikan persamaan trigonometri, ubah menjadi persamaan dasar seperti $\sin u=c$, selesaikan masing-masing dengan dua keluarga sudutnya ditambah putaran penuh, dan ambil penyelesaian dalam interval yang diminta.** Sudut kelipatan, seperti pada $\sin2x=\frac12$, memberi lebih banyak penyelesaian per putaran, bukan lebih sedikit. Selesaikan persamaan yang kuadrat dalam $\sin x$ lebih dulu sebagai kuadrat dan buang akar di luar $\pm1$. Faktorkan, jangan membagi dengan fungsi yang bisa nol, dan setelah mengkuadratkan periksa setiap jawaban pada persamaan semula. ### Poin penting - Persamaan trigonometri memiliki tak berhingga penyelesaian kecuali interval diberikan, karena fungsinya berulang: $\sin x=\frac12$ diselesaikan oleh $30^\circ+360^\circ n$ dan $150^\circ+360^\circ n$ untuk setiap bilangan bulat $n$, dan interval menentukan nilai $n$ yang dipakai. - Untuk $\sin(kx+b)=c$, selesaikan untuk sudut $u=kx+b$ pada interval yang $k$ kali lebih panjang, lalu kurangi $b$ dan bagi $k$. Itu sebabnya $\sin2x=\frac12$ punya empat penyelesaian di $[0^\circ,360^\circ)$: dalam satu putaran ada $2k$ penyelesaian. - Persamaan yang kuadrat dalam $\sin x$, $\cos x$, atau $\tan x$ diselesaikan dengan memisalkan $u$, mencari $u$, lalu menyelesaikan persamaan dasarnya. Untuk sinus dan kosinus, akar di luar $-1\le u\le1$ tidak memberi sudut: $\cos^2x=4$ punya dua akar $u$ dan tak punya penyelesaian $x$. - Jangan pernah membagi dengan fungsi yang bisa bernilai nol. Pada $\sin2x=\cos x$, membagi dengan $\cos x$ menghilangkan $90^\circ$ dan $270^\circ$; memindahkan semuanya ke satu ruas lalu memfaktorkan, $\cos x\,(2\sin x-1)=0$, menemukan keempat penyelesaiannya. - Mengkuadratkan, atau mengalikan dengan ekspresi yang bisa nol, dapat menambah akar palsu. Mengkuadratkan $\sin x+\cos x=1$ memberi empat kandidat ($0^\circ$, $90^\circ$, $180^\circ$, $270^\circ$) dan hanya dua yang memenuhi persamaan semula, jadi setiap kandidat diperiksa. - Bila $x$ sendiri bercampur dengan fungsi trigonometri, seperti pada $\cos x=x$, tak ada rumus yang memberi jawabannya. Gambar grafiknya, apit sebuah perubahan tanda, dan pakai bisection (satu angka biner lagi tiap langkah) atau metode Newton (kira-kira dua kali lipat angka benar tiap langkah), dengan $x$ dalam radian. ## Apa itu persamaan trigonometri, dan mengapa ia memiliki tak berhingga penyelesaian? **Persamaan trigonometri adalah persamaan yang bilangan tak diketahuinya adalah sudut di dalam satu atau lebih fungsi trigonometri, seperti $\sin x=\frac12$ atau $2\cos^2x=\cos x$; karena fungsinya berulang, sebuah penyelesaian tidak pernah sendirian.** Jika $x$ menyelesaikan $\sin x=\frac12$ maka $x+360^\circ$ juga, dan $x-360^\circ$ juga, karena satu putaran penuh membawa titik pada lingkaran satuan kembali ke tempat yang sama. Sinus dan kosinus berulang setiap $360^\circ$ (yaitu $2\pi$ radian), dan tangen setiap $180^\circ$ ($\pi$ radian). Jadi jawaban sebuah persamaan adalah **sebuah keluarga** yang memuat bilangan bulat $n$, atau **sebuah daftar** penyelesaian dalam interval yang disebut soal. Inilah yang membedakan persamaan dari identitas (lihat [artikel tentang identitas](https://nunada.my.id/artikel/identitas-trigonometri/#identity-or-equation)): identitas benar untuk setiap sudut, sedangkan persamaan benar untuk sebagian, dan menyelesaikannya berarti menemukan semuanya. Kasus dasar $\sin x=c$, $\cos x=c$, dan $\tan x=c$ ada di [artikel trigonometri dasar](https://nunada.my.id/artikel/trigonometri-dasar/#equations). Di sini yang datang sesudahnya: cara mendaftar penyelesaian dalam interval, persamaan dengan sudut kelipatan, persamaan kuadrat, persamaan yang memerlukan identitas, mengapa sebagian langkah menghilangkan penyelesaian atau menambah yang palsu, dan apa yang dilakukan bila tak ada rumus. Sudut di bawah ini dalam derajat, seperti pada artikel trigonometri lain, kecuali di bagian terakhir, ketika persamaan mencampur bilangan tak diketahui dengan bilangan biasa dan radian adalah satu-satunya pilihan. Untuk memakai radian di tempat lain, ganti $360^\circ$ dengan $2\pi$ dan $180^\circ$ dengan $\pi$. *Garis $y=\frac12$ memotong grafik $\sin x$ di setiap titik berbentuk $30^\circ+360^\circ n$ dan $150^\circ+360^\circ n$. Gambar ini memperlihatkan tiga putaran dan enam titik di antaranya; pada seluruh garis bilangan jumlahnya tak berhingga.* ## Bagaimana memilih penyelesaian yang berada dalam interval tertentu? **Untuk mendaftar penyelesaian dalam suatu interval, tulis penyelesaian umum dengan bilangan bulat $n$, masukkan ke pertidaksamaan yang menyatakan interval itu, dan ambil bilangan bulat $n$ yang cocok.** Interval-lah yang memilih anggota tiap keluarga, tanpa menebak. Untuk $\sin x=\frac12$ dengan $-180^\circ\le x<540^\circ$, kedua keluarganya adalah $30^\circ+360^\circ n$ dan $150^\circ+360^\circ n$: | $n$ | $30^\circ+360^\circ n$ | di dalam interval? | $150^\circ+360^\circ n$ | di dalam interval? | |---|---|---|---|---| | $-1$ | $-330^\circ$ | tidak | $-210^\circ$ | tidak | | $0$ | $30^\circ$ | ya | $150^\circ$ | ya | | $1$ | $390^\circ$ | ya | $510^\circ$ | ya | | $2$ | $750^\circ$ | tidak | $870^\circ$ | tidak | Jadi $x=30^\circ,\ 150^\circ,\ 390^\circ,\ 510^\circ$. Untuk $\tan x=\sqrt3$ dengan $-360^\circ\le x\le360^\circ$ hanya ada satu keluarga, $60^\circ+180^\circ n$, dan $-360\le60+180n\le360$ berarti $-2{,}33\le n\le1{,}67$, sehingga $n=-2,-1,0,1$ dan $x=-300^\circ,\ -120^\circ,\ 60^\circ,\ 240^\circ$. Kita juga dapat memperkirakan banyaknya. Interval sepanjang $L$ derajat memuat $\frac{L}{360}$ putaran, dan untuk $|c|<1$ setiap putaran memuat dua penyelesaian $\sin x=c$ dan dua penyelesaian $\cos x=c$, sedangkan setiap $180^\circ$ memuat satu penyelesaian $\tan x=c$. Di ujung jangkauan, $c=\pm1$ untuk sinus dan kosinus, kedua keluarga berimpit dan hanya ada satu penyelesaian per putaran: gelombang menyentuh garis, bukan memotongnya. Dalam radian, interval $0\le x<2\pi$ yang sama memberi $\sin x=\frac12$ dengan penyelesaian $\frac{\pi}{6}$ dan $\frac{5\pi}{6}$. ## Bagaimana menyelesaikan persamaan seperti sin 2x = 1/2, dengan sudut kelipatan x? **Untuk menyelesaikan $\sin(kx+b)=c$ dengan $k>0$, selesaikan persamaan dasar untuk seluruh sudut $u=kx+b$ pada interval yang $k$ kali lebih panjang, lalu kurangi $b$ dan bagi $k$.** Langkah yang sering dilewati adalah yang pertama: ketika $x$ berjalan dari $0^\circ$ sampai $360^\circ$, sudut $u=2x$ berjalan dari $0^\circ$ sampai $720^\circ$, dua putaran penuh, sehingga penyelesaiannya dua kali lebih banyak. **Contoh.** $\sin2x=\frac12$ untuk $0^\circ\le x<360^\circ$. Misalkan $u=2x$, sehingga $0^\circ\le u<720^\circ$. Maka $\sin u=\frac12$ memberi $u=30^\circ,\ 150^\circ,\ 390^\circ,\ 510^\circ$ dan, setelah dibagi dua, $x=15^\circ,\ 75^\circ,\ 195^\circ,\ 255^\circ$. Empat penyelesaian, bukan dua. Hanya menyelesaikan $2x=30^\circ$ dan $2x=150^\circ$ akan menemukan dua yang pertama dan melewatkan putaran kedua. **Dengan pergeseran.** $\cos(3x-30^\circ)=\frac12$ untuk $0^\circ\le x<360^\circ$. Misalkan $u=3x-30^\circ$, sehingga $-30^\circ\le u<1050^\circ$. Maka $\cos u=\frac12$ memberi $u=60^\circ,\ 300^\circ,\ 420^\circ,\ 660^\circ,\ 780^\circ,\ 1020^\circ$ (nilai $-60^\circ$ berada di bawah jangkauan), dan $x=\frac{u+30^\circ}{3}=30^\circ,\ 110^\circ,\ 150^\circ,\ 230^\circ,\ 270^\circ,\ 350^\circ$. Banyaknya mengikuti aturan: **dalam satu putaran ada $2k$ penyelesaian** ($k$ penyelesaian bila $c=\pm1$ untuk sinus dan kosinus), dan berulang setiap $\frac{360^\circ}{k}$, atau $\frac{180^\circ}{k}$ untuk tangen. Bila $k$ negatif, pakai $\sin(-u)=-\sin u$ dan $\cos(-u)=\cos u$ untuk membuatnya positif terlebih dulu. Coba nilai $k$, $b$, dan $c$ lain di bawah, dan baca penyelesaian umumnya. *Persamaan $\sin2x=\frac12$ pada $0^\circ\le x<360^\circ$. Gelombang $\sin2x$ (garis penuh) berputar dua kali lebih cepat daripada $\sin x$ (garis putus-putus), sehingga garis memotongnya empat kali, di $15^\circ$, $75^\circ$, $195^\circ$, dan $255^\circ$, bukan dua kali seperti pada $\sin x=\frac12$.* ## Bagaimana menyelesaikan persamaan yang kuadrat dalam sin x, cos x, atau tan x? **Persamaan yang kuadrat dalam satu fungsi trigonometri diselesaikan dengan menulis $u$ untuk fungsi itu, menyelesaikan kuadrat dalam $u$, lalu menyelesaikan satu persamaan dasar untuk setiap akar, dan hanya menyimpan akar yang dapat dicapai suatu sudut.** Untuk sinus dan kosinus akarnya harus di antara $-1$ dan $1$; untuk tangen setiap akar diperbolehkan. 1. Ganti fungsinya dengan $u$: $2\sin^2x-\sin x-1=0$ menjadi $2u^2-u-1=0$. 2. Cari $u$ dengan pemfaktoran atau rumus kuadrat: $(2u+1)(u-1)=0$, sehingga $u=-\frac12$ atau $u=1$. 3. Buang akar dengan $|u|>1$ bila $u$ adalah sinus atau kosinus. 4. Untuk setiap akar yang tersisa, selesaikan $\sin x=u$: $\sin x=-\frac12$ memberi $210^\circ$ dan $330^\circ$, dan $\sin x=1$ memberi $90^\circ$. 5. Daftar semua sudutnya: $x=90^\circ,\ 210^\circ,\ 330^\circ$. Perhatikan bahwa penyelesaiannya tiga, bukan empat. Akar $u=1$ adalah nilai tertinggi yang dicapai sinus, sehingga dicapai sekali per putaran, seperti pada gambar: kurvanya menyentuh sumbu di sana. *Grafik $2\sin^2x-\sin x-1$ pada $0^\circ\le x<360^\circ$ menyentuh sumbu di tiga titik. Di $210^\circ$ dan $330^\circ$ (tempat $\sin x=-\frac12$) ia memotong, dan di $90^\circ$ (tempat $\sin x=1$) ia hanya menyentuh dari bawah, karena $\sin x$ tidak pernah melewati $1$: akar $u=1$ memberi satu sudut, bukan dua.* **Bila akar berada di luar jangkauan.** $\sin^2x-\sin x-2=0$ difaktorkan menjadi $(\sin x-2)(\sin x+1)=0$. Akar $\sin x=2$ mustahil, karena tak ada sudut dengan sinus di atas $1$, dan $\sin x=-1$ memberi $x=270^\circ$. Jadi satu-satunya penyelesaian adalah $270^\circ$. Dengan cara yang sama $\cos^2x=4$ punya akar $\cos x=2$ dan $\cos x=-2$ dan sama sekali tak punya penyelesaian. Pada tangen tidak ada batas seperti itu: $\tan^2x=3$ memberi $\tan x=\pm\sqrt3$ dan $x=60^\circ,\ 120^\circ,\ 240^\circ,\ 300^\circ$. Atur koefisien di bawah untuk melihat akar $u$, mana yang dapat dicapai sebuah sudut, dan grafik ruas kirinya. ## Mengapa kita tidak boleh membagi kedua ruas dengan sin x atau cos x? **Membagi kedua ruas dengan $\sin x$ atau $\cos x$ hanya sah pada sudut yang fungsi itu tidak nol, dan sudut yang membuatnya nol bisa jadi penyelesaian, yang diam-diam dibuang oleh pembagian itu.** Langkah yang aman adalah langkah dari aljabar: bawa semuanya ke satu ruas lalu faktorkan. Ambil $\sin2x=\cos x$ pada $0^\circ\le x<360^\circ$. | Membagi | Memfaktorkan | |---|---| | $2\sin x\cos x=\cos x$ | $2\sin x\cos x-\cos x=0$ | | bagi dengan $\cos x$: $2\sin x=1$ | $\cos x\,(2\sin x-1)=0$ | | $x=30^\circ,\ 150^\circ$ | $\cos x=0$ memberi $90^\circ,\ 270^\circ$; $\sin x=\frac12$ memberi $30^\circ,\ 150^\circ$ | | **2 penyelesaian, dua hilang** | **4 penyelesaian** | Sudut yang hilang, $90^\circ$ dan $270^\circ$, tepat yang membuat $\cos x=0$, yaitu pembagi tadi. Hal yang sama terjadi pada $\tan x=2\sin x$: menulis $\tan x=\frac{\sin x}{\cos x}$ lalu mencoret $\sin x$ menghilangkan $0^\circ$ dan $180^\circ$, sedangkan $\sin x\,(1-2\cos x)=0$ setelah dikalikan $\cos x$ menemukan $\sin x=0$ dan $\cos x=\frac12$ sehingga $0^\circ,\ 60^\circ,\ 180^\circ,\ 300^\circ$. Bila memang ingin membagi, selesaikan dulu kasus ketika pembaginya nol secara terpisah, baru bagi dan selesaikan sisanya. ## Identitas mana yang dipakai untuk mengubah persamaan sulit menjadi mudah? **Pakailah identitas yang meninggalkan satu fungsi trigonometri dari satu sudut, karena itulah bentuk yang sudah kita tahu cara menyelesaikannya.** Apa yang tampak pada persamaan menunjukkan identitas mana. | Isi persamaan | Identitasnya | Contoh | |---|---|---| | fungsi yang sama dari $x$ dan $2x$ | $\sin2x=2\sin x\cos x$ | $\sin2x=\cos x$ | | $\cos2x$ bersama $\cos x$ | $\cos2x=2\cos^2x-1$ | $\cos2x=\cos x$ | | kuadrat sinus dan kosinus bersama | $\cos^2x=1-\sin^2x$ | $2\cos^2x+3\sin x=3$ | | selisih dua sinus atau kosinus | jumlah menjadi hasil kali | $\sin3x=\sin x$ | | hasil kali $\sin x\cos x$ | $\sin x\cos x=\frac12\sin2x$ | $\sin x\cos x=\frac14$ | | tangen di samping sinus | $\tan x=\frac{\sin x}{\cos x}$, lalu faktorkan | $\tan x=2\sin x$ | | $a\sin x+b\cos x$ | satu gelombang $R\sin(x+\varphi)$ | $3\sin x+4\cos x=2{,}5$ | Rumus-rumusnya diturunkan di [artikel tentang rumus sudut ganda](https://nunada.my.id/artikel/identitas-trigonometri/#double-and-half). **Contoh yang dikerjakan:** $\sin3x=\sin x$. Pindahkan semuanya ke satu ruas, $\sin3x-\sin x=0$, dan pakai rumus jumlah menjadi hasil kali, $\sin3x-\sin x=2\cos2x\,\sin x$. Hasil kali bernilai nol bila salah satu faktornya nol, jadi $\sin x=0$, memberi $0^\circ,\ 180^\circ$, atau $\cos2x=0$, memberi $2x=90^\circ+180^\circ n$ dan $x=45^\circ,\ 135^\circ,\ 225^\circ,\ 315^\circ$. Enam penyelesaian. Jalan lain, dengan rumus sudut rangkap tiga, mencapai enam yang sama tetapi dengan aljabar lebih banyak, itulah sebabnya pemilihan identitas penting. Di bawah ada sebelas persamaan yang diselesaikan satu baris demi satu baris, masing-masing baris dengan alasannya. Grafiknya memperlihatkan kedua ruas dan tempat keduanya bertemu. ## Bagaimana menyelesaikan a sin x + b cos x = c? **Untuk menyelesaikan $a\sin x+b\cos x=c$, tulis ruas kiri sebagai satu gelombang $R\sin(x+\varphi)$ dengan $R=\sqrt{a^2+b^2}$ dan $\varphi=\operatorname{atan2}(b,a)$; persamaannya menjadi $\sin(x+\varphi)=\frac{c}{R}$, persamaan dasar.** Ini berhasil tepat ketika $|c|\le R$, karena $R$ adalah nilai tertinggi yang dicapai gelombang. Pengubahannya diturunkan di [artikel tentang rumus hasil kali menjadi jumlah dan satu gelombang](https://nunada.my.id/artikel/identitas-trigonometri/#product-and-sum). **Contoh.** $\sqrt3\sin x+\cos x=1$. Di sini $R=\sqrt{3+1}=2$ dan $\varphi=\operatorname{atan2}(1,\sqrt3)=30^\circ$, sehingga $2\sin(x+30^\circ)=1$, yaitu $\sin(x+30^\circ)=\frac12$. Maka $x+30^\circ=30^\circ$ atau $150^\circ$ (ditambah $360^\circ n$), sehingga $x=0^\circ$ atau $x=120^\circ$. Periksa yang kedua: $\sqrt3\sin120^\circ+\cos120^\circ=\frac32-\frac12=1$. Dengan bilangan yang kurang ramah langkahnya sama: $3\sin x+4\cos x=2{,}5$ memiliki $R=5$, $\varphi\approx53{,}13^\circ$, dan penyelesaian $96{,}87^\circ$ dan $336{,}87^\circ$. Bila $c$ lebih besar dari $R$ tidak ada penyelesaian: $3\sin x+4\cos x=6$ mustahil, karena ruas kiri tidak pernah melebihi $5$. Ada dua cara lain. **Mengkuadratkan** (pisahkan satu suku, kuadratkan, pakai $\sin^2x+\cos^2x=1$) selalu berhasil tetapi menambah akar palsu, yang dibahas berikutnya. **Substitusi sudut paruh** $t=\tan\frac{x}{2}$ mengubah $\sin x$ menjadi $\frac{2t}{1+t^2}$ dan $\cos x$ menjadi $\frac{1-t^2}{1+t^2}$ dan persamaan menjadi kuadrat dalam $t$; ia menghilangkan $x=180^\circ$, tempat $\tan\frac{x}{2}$ tidak ada, sehingga sudut itu harus dicoba terpisah. Satu gelombang tidak memerlukan pemeriksaan tambahan apa pun, itulah sebabnya ia pilihan pertama. ## Mengapa sebagian jawaban gagal saat diperiksa, dan bagaimana menghindari akar palsu? **Akar palsu (extraneous) adalah jawaban yang dihasilkan langkah-langkah tetapi tidak memenuhi persamaan semula; ia muncul setiap kali ada langkah yang tidak dapat dibalik, seperti mengkuadratkan, dan obatnya adalah memeriksa setiap kandidat pada persamaan semula.** Mengkuadratkan mengubah $A=B$ menjadi $A^2=B^2$, yang juga benar bila $A=-B$. Mengalikan dengan ekspresi yang bisa nol berakibat sama. **Contoh.** Selesaikan $\sin x+\cos x=1$ pada $0^\circ\le x<360^\circ$. Mengkuadratkan memberi $\sin^2x+2\sin x\cos x+\cos^2x=1$, yaitu $1+\sin2x=1$, sehingga $\sin2x=0$ dan $2x=0^\circ,\ 180^\circ,\ 360^\circ,\ 540^\circ$, yaitu $x=0^\circ,\ 90^\circ,\ 180^\circ,\ 270^\circ$. Sekarang periksa masing-masing pada persamaan semula: pada $0^\circ$ jumlahnya $0+1=1$ (benar), pada $90^\circ$ jumlahnya $1+0=1$ (benar), pada $180^\circ$ jumlahnya $0-1=-1$ (salah), dan pada $270^\circ$ jumlahnya $-1+0=-1$ (salah). Penyelesaiannya $0^\circ$ dan $90^\circ$; dua lainnya menyelesaikan $\sin x+\cos x=-1$, persamaan yang juga terkandung dalam pengkuadratan. Dengan satu gelombang, $\sqrt2\sin(x+45^\circ)=1$, diperoleh $x+45^\circ=45^\circ$ atau $135^\circ$ dan dua jawaban yang sama tanpa ada yang perlu diperiksa. **Sudut yang tak terdefinisi juga akar palsu.** $\tan x\cos x=1$ menyederhana menjadi $\sin x=1$, yang menyarankan $x=90^\circ$. Tetapi $\tan90^\circ$ tidak ada, sehingga $90^\circ$ bukan penyelesaian, dan persamaan ini sama sekali tak punya penyelesaian. Kehati-hatian yang sama berlaku untuk apa pun yang memuat $\tan$, $\sec$, $\csc$, $\cot$, penyebut, atau akar kuadrat: daftar sudut yang dilarang persamaan semula sebelum mulai, dan coret di akhir. | Langkahnya | Yang dapat terjadi | Yang dilakukan | |---|---|---| | mengkuadratkan kedua ruas | menambah akar (kasus $A=-B$) | periksa tiap kandidat | | mengalikan dengan ekspresi yang memuat $x$ | menambah akar di tempat ia nol | periksa tiap kandidat | | membagi dengan ekspresi yang memuat $x$ | menghilangkan akar di tempat ia nol | selesaikan kasus itu terpisah | | fungsi yang tak terdefinisi di suatu tempat | sudut itu tidak diperbolehkan | coret | Terakhir, persamaan tanpa penyelesaian real masih bisa punya penyelesaian kompleks: $\sin x=2$ tak punya penyelesaian di antara sudut real, tetapi dengan rumus Euler diperoleh $x=\frac{\pi}{2}\pm i\ln(2+\sqrt3)$, dengan $\ln(2+\sqrt3)\approx1{,}317$. *Mengkuadratkan $\sin x+\cos x=1$ memberi $(\sin x+\cos x)^2=1$, yang benar bila jumlahnya $1$ atau $-1$. Grafik $\sin x+\cos x$ memotong garis $y=1$ di $0^\circ$ dan $90^\circ$ (penyelesaian) dan garis $y=-1$ di $180^\circ$ dan $270^\circ$ (titik kosong: akar palsu bagi persamaan semula).* ## Bagaimana jika tak ada rumus yang cocok? Menyelesaikan cos x = x dengan grafik, bisection, dan metode Newton **Bila bilangan tak diketahui muncul sebagai bilangan biasa sekaligus di dalam fungsi trigonometri, seperti pada $\cos x=x$, tak ada aljabar yang memberi jawabannya, sehingga kita menggambar grafiknya, mengurung akar di antara dua titik yang tandanya berubah, lalu mendekatinya dengan bisection atau metode Newton.** Sekarang $x$ adalah bilangan, bukan sudut dalam derajat, dan ia harus dalam **radian**: $\cos x=x$ punya akar di $0{,}7391$, dan kalkulator dengan mode derajat menjawab pertanyaan yang lain. 1. **Gambar grafiknya.** Gambar $y=\cos x$ dan $y=x$, atau $f(x)=\cos x-x$ dan lihat di mana ia memotong nol. Ini menunjukkan banyaknya akar (satu di sini, karena $\cos x$ turun sedangkan $x$ naik) dan kira-kira letaknya. 2. **Apit akarnya.** Cari $a0$ dan $f(1)=-0{,}46<0$. Fungsi kontinu yang berubah tanda pasti bernilai nol di suatu titik di antaranya. 3. **Bisection.** Lihat titik tengahnya dan simpan separuh yang tandanya masih berubah. Interval terbelah dua setiap langkah, sehingga galat setelah $n$ langkah paling banyak $\frac{b-a}{2^n}$: satu angka biner lagi, sekitar $0{,}3$ angka desimal, per langkah. Empat puluh langkah memberi dua belas desimal. Lambat tetapi tidak pernah gagal. 4. **Metode Newton.** Dari tebakan $x$, ikuti garis singgung sampai sumbu: $x_{n+1}=x_n-\frac{f(x_n)}{f'(x_n)}$, di sini dengan $f'(x)=-\sin x-1$. Dekat akar ia kira-kira menggandakan banyaknya angka benar tiap langkah (lihat [artikel tentang metode Newton](https://nunada.my.id/artikel/metode-newton/#convergence)) tetapi memerlukan awal yang baik dan dapat gagal (lihat [tempat ia salah](https://nunada.my.id/artikel/metode-newton/#failures)). Tabel memperlihatkan keduanya pada $\cos x=x$, bisection pada $[0,1]$ dan Newton dari $x_0=1$; akarnya $0{,}7390851332$. | Langkah | Bisection: titik tengah | Metode Newton: $x$ | |---|---|---| | 1 | 0,5000000000 | 0,7503638678 | | 2 | 0,7500000000 | 0,7391128909 | | 3 | 0,6250000000 | 0,7390851334 | | 4 | 0,6875000000 | 0,7390851332 | | 5 | 0,7187500000 | 0,7390851332 | | 6 | 0,7343750000 | 0,7390851332 | Menekan tombol kosinus berulang-ulang pada kalkulator mode radian memang menuju bilangan yang sama, karena $x_{n+1}=\cos x_n$ mengecilkan jarak ke akar dengan faktor sekitar $\sin0{,}739\approx0{,}67$ tiap kali, yang lambat dibandingkan Newton. Pilih persamaan lain di bawah, atau telusuri tiap metode langkah demi langkah. *Bisection pada $f(x)=\cos x-x$ dengan $x$ dalam radian. Interval $[0,1]$ memiliki $f(0)>0>f(1)$; titik tengah $0{,}5$, $0{,}75$, dan $0{,}625$ (bernomor $1$, $2$, $3$) masing-masing mempertahankan separuh yang tanda $f$-nya berubah, dan akar $0{,}7391$ tetap berada di dalam semuanya.* ## Bagaimana menyelesaikan persamaan trigonometri dalam program? **Program menyelesaikan $\sin(kx+b)=c$ dengan langkah yang sama seperti di kertas: ambil sudut pokok dengan `asin`, tambahkan bayangan cerminnya, telusuri bilangan bulat $n$, dan simpan $x$ yang jatuh dalam interval.** Tiga hal penting. `asin` dan `acos` hanya mengembalikan satu sudut (`asin` antara $-90^\circ$ dan $90^\circ$), sehingga keluarga kedua harus kita tambahkan sendiri. Akar yang berimpit, seperti pada $c=1$, tidak boleh didaftar dua kali, dan galat bilangan desimal seperti $89{,}99999999$ membuat uji kesamaan tidak andal, jadi bulatkan sebelum membandingkan. Dan nilai di luar $\pm1$ membuat `asin` gagal, jadi ujilah terlebih dulu. Program di bawah menyelesaikan empat persamaan dari artikel ini, $\sin x=\frac12$, $\sin2x=\frac12$, $\sin x=2$ (tanpa penyelesaian), dan $2\sin^2x-\sin x-1=0$ lewat akar $u=-\frac12$ dan $u=1$, lalu menyelesaikan $\cos x=x$ dengan bisection pada $[0,1]$ sampai interval lebih pendek dari $10^{-12}$, yang memerlukan $40$ langkah dan memberi $0{,}7390851332$. ```python import math def solve(fn, k, b, c, lo=0.0, hi=360.0): """Every x in [lo, hi) with fn(k*x + b) = c, in degrees (k > 0), for fn = 'sin' or 'cos'.""" if abs(c) > 1: return [] # no angle has a sine or cosine beyond 1 alpha = math.degrees(math.asin(c) if fn == 'sin' else math.acos(c)) mirrors = [alpha, 180 - alpha] if fn == 'sin' else [alpha, -alpha] found = set() for u0 in mirrors: # k*x + b = u0 + 360 n n = math.floor((k * lo + b - u0) / 360) - 1 # start a turn early, filter below while True: x = (u0 + 360 * n - b) / k if x >= hi: break if x >= lo: found.add(round(x, 9)) n += 1 return sorted(found) print(solve('sin', 1, 0, 0.5)) # [30.0, 150.0] print(solve('sin', 2, 0, 0.5)) # [15.0, 75.0, 195.0, 255.0] print(solve('cos', 3, 0, 0.5, 0, 120)) # [20.0, 100.0] print(solve('sin', 1, 0, 2)) # [] # 2 sin^2 x - sin x - 1 = 0: a quadratic in u = sin x a, b, c = 2, -1, -1 d = b * b - 4 * a * c for u in [(-b - math.sqrt(d)) / (2 * a), (-b + math.sqrt(d)) / (2 * a)]: print(u, solve('sin', 1, 0, u)) # -0.5 [210.0, 330.0], then 1.0 [90.0] def bisect(f, lo, hi, tol=1e-12): """Halve [lo, hi] until it is shorter than tol; f(lo) and f(hi) must have opposite signs.""" steps = 0 while hi - lo > tol: mid = (lo + hi) / 2 if f(lo) * f(mid) <= 0: hi = mid else: lo = mid steps += 1 return (lo + hi) / 2, steps root, steps = bisect(lambda x: math.cos(x) - x, 0, 1) print(round(root, 10), steps) # 0.7390851332 40 x = 1.0 # Newton: x - f(x)/f'(x) with f = cos x - x for _ in range(4): x -= (math.cos(x) - x) / (-math.sin(x) - 1) print(round(x, 10)) # 0.7390851332 ``` ```javascript function solve(fn, k, b, c, lo = 0, hi = 360) { // every x in [lo, hi) with fn(k*x + b) = c, in degrees (k > 0), for fn = 'sin' or 'cos' if (Math.abs(c) > 1) return [] // no angle has a sine or cosine beyond 1 const alpha = ((fn === 'sin' ? Math.asin(c) : Math.acos(c)) * 180) / Math.PI const mirrors = fn === 'sin' ? [alpha, 180 - alpha] : [alpha, -alpha] const found = new Set() for (const u0 of mirrors) { // k*x + b = u0 + 360 n for (let n = Math.floor((k * lo + b - u0) / 360) - 1; ; n++) { // start a turn early, filter below const x = (u0 + 360 * n - b) / k if (x >= hi) break if (x >= lo) found.add(Math.round(x * 1e9) / 1e9) } } return [...found].sort((p, q) => p - q) } solve('sin', 1, 0, 0.5) // [30, 150] solve('sin', 2, 0, 0.5) // [15, 75, 195, 255] solve('cos', 3, 0, 0.5, 0, 120) // [20, 100] solve('sin', 1, 0, 2) // [] // 2 sin^2 x - sin x - 1 = 0: a quadratic in u = sin x const [a, b, c] = [2, -1, -1] const d = b * b - 4 * a * c ;[(-b - Math.sqrt(d)) / (2 * a), (-b + Math.sqrt(d)) / (2 * a)].map((u) => [u, solve('sin', 1, 0, u)]) // [[-0.5, [210, 330]], [1, [90]]] function bisect(f, lo, hi, tol = 1e-12) { // halve [lo, hi] until it is shorter than tol; f(lo) and f(hi) must have opposite signs let steps = 0 while (hi - lo > tol) { const mid = (lo + hi) / 2 if (f(lo) * f(mid) <= 0) hi = mid else lo = mid steps++ } return [(lo + hi) / 2, steps] } const [root, steps] = bisect((x) => Math.cos(x) - x, 0, 1) ;[+root.toFixed(10), steps] // [0.7390851332, 40] let x = 1 // Newton: x - f(x)/f'(x) with f = cos x - x for (let i = 0; i < 4; i++) x -= (Math.cos(x) - x) / (-Math.sin(x) - 1) +x.toFixed(10) // 0.7390851332 ``` ```cpp #include #include #include using namespace std; const double PI = 3.14159265358979323846; double found[64]; // the solutions of the last call // Every x in [lo, hi) with sin(k x + b) = c (degrees, k > 0), sorted, in found[]; returns how many. int solveSin(double k, double b, double c, double lo, double hi) { int count = 0; if (fabs(c) > 1) return 0; // no angle has a sine beyond 1 double alpha = asin(c) * 180.0 / PI; for (int mirror = 0; mirror < 2; mirror++) { double u0 = mirror == 0 ? alpha : 180.0 - alpha; // k x + b = u0 + 360 n int n = (int)floor((k * lo + b - u0) / 360.0) - 1; while (count < 60) { double x = (u0 + 360.0 * n - b) / k; if (x >= hi) break; if (x >= lo) { int seen = 0; for (int i = 0; i < count; i++) if (fabs(found[i] - x) < 1e-9) seen = 1; if (seen == 0) { found[count] = x; count++; } } n++; } } for (int i = 1; i < count; i++) { // insertion sort double v = found[i]; int j = i - 1; while (j >= 0 && found[j] > v) { found[j + 1] = found[j]; j--; } found[j + 1] = v; } return count; } void show(int count) { if (count == 0) printf("none"); for (int i = 0; i < count; i++) { if (i > 0) printf(" "); printf("%.1f", found[i]); } printf("\n"); } double f(double x) { return cos(x) - x; } int main() { show(solveSin(1, 0, 0.5, 0, 360)); show(solveSin(2, 0, 0.5, 0, 360)); show(solveSin(1, 0, 2, 0, 360)); // 2 sin^2 x - sin x - 1 = 0: a quadratic in u = sin x double a = 2, b = -1, c = -1; double d = b * b - 4 * a * c; show(solveSin(1, 0, (-b - sqrt(d)) / (2 * a), 0, 360)); show(solveSin(1, 0, (-b + sqrt(d)) / (2 * a), 0, 360)); // cos x = x by bisection on [0, 1] double lo = 0, hi = 1; int steps = 0; while (hi - lo > 1e-12) { double mid = (lo + hi) / 2; if (f(lo) * f(mid) <= 0) hi = mid; else lo = mid; steps++; } printf("%.10f %d\n", (lo + hi) / 2, steps); return 0; } /* output: 30.0 150.0 15.0 75.0 195.0 255.0 none 210.0 330.0 90.0 0.7390851332 40 */ ``` ## Dari mana persamaan trigonometri berasal? **Persamaan trigonometri bermula sebagai pencarian tabel yang dijalankan terbalik dalam astronomi, dan yang paling penting, persamaan Kepler, persis jenis yang tidak punya rumus.** - **Sekitar 150 M.** Almagest Ptolemeus memuat tabel tali busur lingkaran. Mencari sudut untuk tali busur tertentu berarti membaca tabel itu terbalik dan menginterpolasi dua entri, yaitu menyelesaikan $\sin x=c$ secara numerik. - **Sekitar 500 M.** Tabel sinus Aryabhata memuat 24 nilai, satu untuk setiap $3{,}75^\circ$, dan tabel seperti itu dapat dibaca maju, dari sudut ke sinus, atau mundur, dari sinus ke sudut, yaitu menyelesaikan $\sin x=c$ dengan mencari di tabel. - **1609.** Astronomia nova karya Kepler memuat persamaan $M=E-e\sin E$ yang menghubungkan waktu sejak planet melewati titik terdekatnya ($M$) dengan posisinya ($E$). Tak ada rumus yang menyelesaikan $E$ dalam $M$, sehingga sejak itu persamaan ini diselesaikan dengan iterasi. - **1687.** Principia karya Newton memberi metode iteratif untuk soal Kepler, pendahulu metode yang kini memakai namanya. - **1824.** Bessel menulis $E$ sebagai deret fungsi yang kini memakai namanya, jawaban lain untuk persamaan yang sama. - **Sekarang.** Kalkulator dan pustaka mengembalikan nilai pokok `asin`, `acos`, dan `atan` dan menyerahkan keluarga lainnya kepada pengguna; persamaan seperti $\cos x=x$ diserahkan kepada bisection atau metode Newton. ## Apa kesalahan umum saat menyelesaikan persamaan trigonometri? **Kesalahan paling umum saat menyelesaikan persamaan trigonometri adalah sembilan hal berikut, masing-masing dengan langkah yang benar.** | Kesalahan | Yang benar | |---|---| | ❌ $\sin x=\frac12\Rightarrow x=30^\circ$ lalu berhenti | Ada keluarga kedua: $150^\circ+360^\circ n$. Kalkulator hanya memberi nilai pokok. | | ❌ $\tan x=1\Rightarrow x=45^\circ+360^\circ n$ | Tangen berulang setiap $180^\circ$: $x=45^\circ+180^\circ n$, jadi $225^\circ$ juga termasuk. | | ❌ $\sin2x=\frac12$: selesaikan $2x=30^\circ,150^\circ$ lalu bagi dua, hanya menemukan $15^\circ,75^\circ$ | $2x$ berjalan dari $0^\circ$ sampai $720^\circ$, jadi ada empat penyelesaian: $15^\circ,\ 75^\circ,\ 195^\circ,\ 255^\circ$. | | ❌ Membagi kedua ruas $\sin2x=\cos x$ dengan $\cos x$ | Faktorkan saja: $\cos x\,(2\sin x-1)=0$, yang juga menemukan $90^\circ$ dan $270^\circ$. | | ❌ Menerima $\sin x=2$ atau $\cos x=-3$ sebagai langkah untuk dilanjutkan | Tak ada sudut dengan sinus atau kosinus seperti itu: akar tersebut tidak memberi penyelesaian. | | ❌ Mengkuadratkan kedua ruas dan menyimpan semua jawaban | Periksa setiap kandidat pada persamaan semula: $\sin x+\cos x=1$ menyimpan $0^\circ,90^\circ$ dan membuang $180^\circ,270^\circ$. | | ❌ $\sin x\cos x=\frac14\Rightarrow\sin x=\frac14$ atau $\cos x=\frac14$ | Hanya hasil kali yang sama dengan $0$ yang terpecah menjadi faktor. Di sini $\frac12\sin2x=\frac14$, jadi $\sin2x=\frac12$. | | ❌ $\sin^2x=\frac14\Rightarrow\sin x=\frac12$ | Ambil kedua akar: $\sin x=\pm\frac12$, memberi $30^\circ,150^\circ,210^\circ,330^\circ$. | | ❌ Menyelesaikan $\cos x=x$ dengan $x$ dalam derajat | $x$ adalah bilangan biasa yang bercampur dengan kosinus, jadi dalam radian: akarnya $0{,}7391$. | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: persamaan trigonometri sekilas - **Banyak penyelesaian:** fungsinya berulang ($360^\circ$ untuk sinus dan kosinus, $180^\circ$ untuk tangen), sehingga jawabannya adalah keluarga dengan bilangan bulat $n$ atau daftar dalam sebuah interval. - **Interval:** masukkan keluarga ke pertidaksamaan dan ambil bilangan bulat $n$ yang cocok; kira-kira dua penyelesaian per putaran untuk $\sin x=c$ dan $\cos x=c$, satu per $180^\circ$ untuk $\tan x=c$. - **Sudut kelipatan:** $\sin(kx+b)=c$: selesaikan untuk $u=kx+b$ pada interval yang $k$ kali lebih panjang, lalu $x=\frac{u-b}{k}$; $2k$ penyelesaian per putaran. - **Kuadrat:** misalkan $u$, selesaikan, buang $|u|>1$ untuk sinus dan kosinus, selesaikan persamaan dasarnya; akar $u=\pm1$ memberi satu sudut. - **Membagi:** jangan pernah dengan fungsi yang bisa nol; pindahkan semuanya ke satu ruas lalu faktorkan. - **Identitas:** pakai yang meninggalkan satu fungsi dari satu sudut; $a\sin x+b\cos x=R\sin(x+\varphi)$ memerlukan $|c|\le R$. - **Akar palsu:** mengkuadratkan dan mengalikan dapat menambahnya, sudut tak terdefinisi bukan penyelesaian; periksa setiap kandidat pada persamaan semula. - **Tanpa rumus:** $\cos x=x$: gambar, apit, bisection (satu angka biner per langkah) atau Newton ($x-\frac{f}{f'}$), dengan $x$ dalam radian. ## Glosarium: istilah penting - **Persamaan trigonometri**: Persamaan yang bilangan tak diketahuinya adalah sudut di dalam satu atau lebih fungsi trigonometri, benar untuk sebagian sudut dan tidak untuk yang lain. - **Penyelesaian umum**: Keluarga semua penyelesaian sebuah persamaan trigonometri, ditulis dengan bilangan bulat n, seperti 30 derajat ditambah 360 derajat kali n. - **Nilai pokok**: Satu sudut yang dikembalikan fungsi invers seperti arcsin, yang darinya keluarga penyelesaian lain dibangun. - **Persamaan sudut kelipatan**: Persamaan seperti sin 2x = 1/2 dengan fungsi yang dikenakan pada kelipatan bilangan tak diketahui, sehingga memiliki 2k penyelesaian per putaran. - **Kuadrat dalam fungsi trigonometri**: Persamaan berbentuk a u kuadrat ditambah b u ditambah c sama dengan nol, dengan u adalah sin x, cos x, atau tan x, yang diselesaikan dengan memisalkan u. - **Akar palsu**: Jawaban yang dihasilkan langkah-langkah penyelesaian, seperti mengkuadratkan, yang tidak memenuhi persamaan semula. - **Penyelesaian yang hilang**: Penyelesaian yang lenyap karena sebuah langkah, seperti membagi dengan ekspresi yang dapat bernilai nol, tidak sah pada sudut itu. - **Bisection**: Cara mencari akar dengan membelah dua berulang-ulang sebuah interval tempat fungsi kontinu berubah tanda, dengan menyimpan separuh yang masih berubah tanda. - **Apitan**: Dua titik tempat fungsi kontinu memiliki tanda berlawanan, yang menjamin adanya akar di antaranya. ## Pertanyaan yang sering diajukan ### Berapa banyak penyelesaian yang dimiliki persamaan trigonometri? Tak berhingga bila tak ada interval yang diberikan, karena fungsinya berulang. Dalam satu putaran, sin x sama dengan c dan cos x sama dengan c masing-masing memiliki dua penyelesaian bila c tepat di antara minus 1 dan 1, dan tan x sama dengan c memiliki satu untuk setiap 180 derajat. ### Bagaimana menyelesaikan sin 2x = 1/2 untuk x antara 0 dan 360 derajat? Misalkan u adalah 2x, yang berjalan dari 0 sampai 720 derajat. Maka sin u sama dengan setengah di 30, 150, 390, dan 510 derajat, sehingga x adalah 15, 75, 195, dan 255 derajat. Ada empat penyelesaian, bukan dua, karena 2x berputar dua kali. ### Mengapa saya kehilangan penyelesaian ketika membagi dengan cos x? Pembagian dengan cos x tidak diperbolehkan di tempat cos x nol, yaitu pada 90 dan 270 derajat, dan sudut itu bisa jadi penyelesaian. Pindahkan semuanya ke satu ruas dan keluarkan cos x sebagai faktor, yang mempertahankan penyelesaian di tempat ia nol. ### Bagaimana menyelesaikan persamaan trigonometri kuadrat? Tulis u untuk sin x, cos x, atau tan x dan selesaikan kuadrat dalam u dengan pemfaktoran atau rumus. Untuk sinus dan kosinus buang akar di luar minus 1 sampai 1, lalu selesaikan sin x sama dengan tiap akar yang tersisa untuk sudutnya. ### Bagaimana menyelesaikan a sin x + b cos x = c? Tulis ulang ruas kiri sebagai R sin dari x tambah phi dengan R akar dari a kuadrat tambah b kuadrat. Maka sin dari x tambah phi sama dengan c per R, yang memiliki penyelesaian tepat ketika nilai mutlak c tidak lebih besar dari R. ### Mengapa saya mendapat jawaban tambahan setelah mengkuadratkan persamaan trigonometri? Mengkuadratkan mengubah A sama dengan B menjadi A kuadrat sama dengan B kuadrat, yang juga benar bila A sama dengan minus B. Jawaban tambahan menyelesaikan persamaan yang lain itu, jadi periksa tiap kandidat pada persamaan semula dan coret yang gagal. ### Dapatkah sin x sama dengan 2? Tidak untuk sudut real mana pun, karena sinus sudut real tidak pernah di atas 1. Dengan bilangan kompleks bisa: sin x sama dengan 2 di x sama dengan pi per 2 tambah atau kurang i kali logaritma natural dari 2 tambah akar 3. ### Bagaimana menyelesaikan cos x = x? Tak ada rumus yang memberinya, jadi pakai metode numerik dengan x dalam radian. Apit perubahan tanda cos x dikurangi x, seperti 0 sampai 1, lalu pakai bisection atau metode Newton. Akarnya sekitar 0,7391. --- # Trigonometric Identities: Sum, Double-Angle Formulas and Proofs Source: https://nunada.my.id/articles/trigonometric-identities/ Updated: 2026-10-26 ## Quick answer **A trigonometric identity is an equation between trigonometric expressions that is true for every angle at which both sides are defined, such as $\sin^2x+\cos^2x=1$.** The fundamental ones come from the unit circle; the sum formulas $\sin(x+y)=\sin x\cos y+\cos x\sin y$ and $\cos(x+y)=\cos x\cos y-\sin x\sin y$ come from turning a point through an angle, and the double-angle, half-angle, product and power formulas follow from them. To prove an identity you change one side into the other with valid steps; trying numbers can only refute it. ### Key takeaways - An identity holds for every angle where both sides are defined; an equation holds only for some. $\tan x=\frac{\sin x}{\cos x}$ is an identity even though neither side exists at $90^\circ$. A formula such as $\sin(x+y)=\sin x+\sin y$ is false, and one counterexample ($x=y=30^\circ$) shows it. - The fundamental identities (reciprocal, quotient, Pythagorean, cofunction, even and odd, shifts) are all read off the unit circle: the point at the angle $x$ is $(\cos x,\sin x)$ and lies at distance $1$ from the origin, which is already $\sin^2x+\cos^2x=1$. - Turning the point at $x$ through $y$ gives the sum formulas, because the images of $(1,0)$ and $(0,1)$ are $(\cos y,\sin y)$ and $(-\sin y,\cos y)$. Replace $y$ by $-y$ for the difference formulas, and divide for the tangent. - Put $y=x$ in the sum formulas and you get the double-angle formulas, with three forms of $\cos2x$; solve them for the squares and you get the half-angle and power-reducing formulas. Add and subtract the sum formulas and you get the product-to-sum formulas, and the sum-to-product ones are the same thing read backwards. - Any $a\sin x+b\cos x$ is a single wave $R\sin(x+\varphi)$ with $R=\sqrt{a^2+b^2}$ and $\varphi=\operatorname{atan2}(b,a)$, so its largest value is $R$ and an equation such as $3\sin x+4\cos x=2.5$ becomes a basic one. - To prove an identity, work on one side, one valid step at a time (never move terms across the equals sign), turn everything into sine and cosine when stuck, and use $\sin^2x+\cos^2x=1$. Before you start, test the claim at a few angles: one counterexample ends the search, but agreement at some angles proves nothing. ## What makes an equation a trigonometric identity? **A trigonometric identity is an equation that is true for every angle at which both of its sides are defined; an ordinary equation is true only for some angles.** $\sin x=\frac12$ is an equation: it is true at $30^\circ$ and $150^\circ$ and false at $45^\circ$. $\sin^2x+\cos^2x=1$ is an identity: it is true at $45^\circ$, at $1000^\circ$ and at every other angle. Solving an equation means finding the angles that make it true; proving an identity means showing that all of them do. Two details are worth knowing from the start. - **The sides need not exist everywhere.** $\tan x=\frac{\sin x}{\cos x}$ is an identity although neither side exists at $90^\circ$, because the claim is only about the angles where both do. Cancelling can change where an expression is defined: $\frac{\sin x\cos x}{\cos x}$ is not defined at $90^\circ$ but $\sin x$ is, so the two are equal wherever both are defined, which is as much as an identity ever asks. - **A false formula needs only one counterexample.** $\sin(x+y)=\sin x+\sin y$ looks reasonable, but at $x=y=30^\circ$ the left side is $\sin60^\circ\approx0.866$ and the right side is $0.5+0.5=1$. A true identity, on the other hand, can never be shown by trying angles, since there are infinitely many; it has to be proved. This article lists the identities worth knowing, shows where they come from (everything follows from the unit circle and one rotation), and then shows how to prove one and how to test a claim before spending time on it. The basics of the sine, cosine and tangent are in [the article on basic trigonometry](https://nunada.my.id/articles/basic-trigonometry/#identities); here are the proofs and the longer list. ## Where do the fundamental trigonometric identities come from? **The fundamental identities are the reciprocal, quotient, Pythagorean, cofunction, even-odd and shift identities, and every one of them can be read straight off the unit circle.** On the unit circle the point at the angle $x$ is $(\cos x,\sin x)$, which is where the sine and cosine come from for every angle (see [the unit circle](https://nunada.my.id/articles/basic-trigonometry/#unit-circle)). **Reciprocal and quotient.** These are the definitions of $\tan$, $\cot$, $\sec$ and $\csc$ in terms of $\sin$ and $\cos$: | Left side | = | Right side | |---|---|---| | $\csc x$ | $=$ | $\frac{1}{\sin x}$ | | $\sec x$ | $=$ | $\frac{1}{\cos x}$ | | $\cot x$ | $=$ | $\frac{1}{\tan x}$ † | | $\tan x$ | $=$ | $\frac{\sin x}{\cos x}$ | | $\cot x$ | $=$ | $\frac{\cos x}{\sin x}$ | **Pythagorean.** The point is on a circle of radius $1$, so its coordinates satisfy $x^2+y^2=1$, which is $\cos^2x+\sin^2x=1$. Divide it by $\cos^2x$ and you get $1+\tan^2x=\sec^2x$; divide it by $\sin^2x$ and you get $1+\cot^2x=\csc^2x$. It is the [Pythagorean theorem](https://nunada.my.id/articles/pythagorean-theorem/#what-is-the-theorem) in disguise. | Left side | = | Right side | |---|---|---| | $\sin^2 x+\cos^2 x$ | $=$ | $1$ | | $1+\tan^2 x$ | $=$ | $\sec^2 x$ | | $1+\cot^2 x$ | $=$ | $\csc^2 x$ | **Cofunction.** The two acute angles of a right triangle add up to $90^\circ$, and the side that is opposite one is adjacent to the other, so the sine of an angle is the cosine of its complement. | Left side | = | Right side | |---|---|---| | $\sin(90^\circ-x)$ | $=$ | $\cos x$ | | $\cos(90^\circ-x)$ | $=$ | $\sin x$ | | $\tan(90^\circ-x)$ | $=$ | $\cot x$ | **Even and odd.** Turning by $-x$ mirrors the point in the $x$-axis: the $x$-coordinate stays and the $y$-coordinate changes sign. | Left side | = | Right side | |---|---|---| | $\sin(-x)$ | $=$ | $-\sin x$ | | $\cos(-x)$ | $=$ | $\cos x$ | | $\tan(-x)$ | $=$ | $-\tan x$ | **Shifts by $90^\circ$ and $180^\circ$.** A half turn sends $(x,y)$ to $(-x,-y)$, and a quarter turn sends it to $(-y,x)$. | Left side | = | Right side | |---|---|---| | $\sin(180^\circ-x)$ | $=$ | $\sin x$ | | $\cos(180^\circ-x)$ | $=$ | $-\cos x$ | | $\sin(x+180^\circ)$ | $=$ | $-\sin x$ | | $\cos(x+180^\circ)$ | $=$ | $-\cos x$ | | $\tan(x+180^\circ)$ | $=$ | $\tan x$ | | $\sin(x+90^\circ)$ | $=$ | $\cos x$ | | $\cos(x+90^\circ)$ | $=$ | $-\sin x$ | † An identity that holds wherever both sides are defined: the two sides are not defined at the same angles. Every formula in the tables on this page was tested by a program at hundreds of angles, against an independent calculation, and the ones with a dagger are exactly the ones where one side is defined and the other is not at some angle. ## How do the sum and difference formulas work? **The sum formulas come from turning a point through an angle: the point at $x$, turned through $y$, lands at the angle $x+y$, and its new coordinates are made of the four products $\cos x\cos y$, $\sin x\sin y$, $\sin x\cos y$ and $\cos x\sin y$.** Turn the whole plane about the origin through the angle $y$. The point $(1,0)$ goes to $(\cos y,\sin y)$ and the point $(0,1)$ goes to $(-\sin y,\cos y)$. A rotation keeps sums and multiples, and the point at the angle $x$ is $\cos x\cdot(1,0)+\sin x\cdot(0,1)$, so it goes to $$\cos x\,(\cos y,\ \sin y)+\sin x\,(-\sin y,\ \cos y)$$ $$=\left(\cos x\cos y-\sin x\sin y,\ \ \sin x\cos y+\cos x\sin y\right).$$ But turning the point at $x$ through $y$ puts it at the angle $x+y$, whose coordinates are $(\cos(x+y),\sin(x+y))$. Comparing the two coordinates gives both formulas at once. | Left side | = | Right side | |---|---|---| | $\sin(x+y)$ | $=$ | $\sin x\cos y+\cos x\sin y$ | | $\sin(x-y)$ | $=$ | $\sin x\cos y-\cos x\sin y$ | | $\cos(x+y)$ | $=$ | $\cos x\cos y-\sin x\sin y$ | | $\cos(x-y)$ | $=$ | $\cos x\cos y+\sin x\sin y$ | | $\tan(x+y)$ | $=$ | $\frac{\tan x+\tan y}{1-\tan x\tan y}$ † | | $\tan(x-y)$ | $=$ | $\frac{\tan x-\tan y}{1+\tan x\tan y}$ † | † The tangent formulas hold wherever both sides are defined. **The difference formulas** are the sum formulas with $y$ replaced by $-y$, using $\cos(-y)=\cos y$ and $\sin(-y)=-\sin y$, which flips one sign in each: look at the minus in $\cos(x+y)=\cos x\cos y-\sin x\sin y$ and the plus in $\cos(x-y)=\cos x\cos y+\sin x\sin y$. **The tangent formulas** are the quotient of the two: divide the numerator and the denominator of $\frac{\sin(x+y)}{\cos(x+y)}$ by $\cos x\cos y$. Move the angles below and watch the four products make up the new point. ## How do you get the double-angle, half-angle and power-reducing formulas? **Put $y=x$ in the sum formulas and you get the double-angle formulas; solve those for the squares and you get the half-angle and power-reducing formulas.** Nothing new is needed: it is the same rotation. **Double angle.** $\sin2x=\sin(x+x)=2\sin x\cos x$ and $\cos2x=\cos^2x-\sin^2x$. Because $\sin^2x+\cos^2x=1$, the cosine has three forms: replace $\sin^2x$ by $1-\cos^2x$ and you get $2\cos^2x-1$; replace $\cos^2x$ by $1-\sin^2x$ and you get $1-2\sin^2x$. Which one to use depends on what you want to be left with. | Left side | = | Right side | |---|---|---| | $\sin 2x$ | $=$ | $2\sin x\cos x$ | | $\cos 2x$ | $=$ | $\cos^2 x-\sin^2 x$ | | $\cos 2x$ | $=$ | $2\cos^2 x-1$ | | $\cos 2x$ | $=$ | $1-2\sin^2 x$ | | $\tan 2x$ | $=$ | $\frac{2\tan x}{1-\tan^2 x}$ † | **Triple angle.** $\sin3x=\sin(2x+x)$ and $\cos3x=\cos(2x+x)$: use the sum formula, then the double-angle ones, then $\sin^2x+\cos^2x=1$. | Left side | = | Right side | |---|---|---| | $\sin 3x$ | $=$ | $3\sin x-4\sin^3 x$ | | $\cos 3x$ | $=$ | $4\cos^3 x-3\cos x$ | **Half angle.** Take $\cos x=1-2\sin^2\frac{x}{2}$ and $\cos x=2\cos^2\frac{x}{2}-1$ (the double-angle formulas for the angle $\frac{x}{2}$) and solve for the squares: | Left side | = | Right side | |---|---|---| | $\sin^2\frac{x}{2}$ | $=$ | $\frac{1-\cos x}{2}$ | | $\cos^2\frac{x}{2}$ | $=$ | $\frac{1+\cos x}{2}$ | | $\tan\frac{x}{2}$ | $=$ | $\frac{\sin x}{1+\cos x}$ | | $\tan\frac{x}{2}$ | $=$ | $\frac{1-\cos x}{\sin x}$ † | Taking the square root gives $\sin\frac{x}{2}=\pm\sqrt{\frac{1-\cos x}{2}}$ and $\cos\frac{x}{2}=\pm\sqrt{\frac{1+\cos x}{2}}$, and the sign is the sign of the sine or cosine in the quadrant where $\frac{x}{2}$ lies, not a free choice. **Power reducing.** The same two equations with $x$ in place of $\frac{x}{2}$ turn a square into a first power of a double angle, which is what an integral or a signal analysis wants: | Left side | = | Right side | |---|---|---| | $\sin^2 x$ | $=$ | $\frac{1-\cos 2x}{2}$ | | $\cos^2 x$ | $=$ | $\frac{1+\cos 2x}{2}$ | | $\sin^2 x\cos^2 x$ | $=$ | $\frac{1-\cos 4x}{8}$ | **Exact values.** With these formulas the angles of $30^\circ$, $45^\circ$ and $60^\circ$ lead to many more. $\sin15^\circ=\sin(45^\circ-30^\circ)$, which is $\frac{\sqrt2}{2}\cdot\frac{\sqrt3}{2}-\frac{\sqrt2}{2}\cdot\frac12$, that is $\frac{\sqrt6-\sqrt2}{4}$. $\sin22.5^\circ$ is half of $45^\circ$: $\sin^2 22.5^\circ=\frac{1-\cos45^\circ}{2}=\frac{2-\sqrt2}{4}$, so $\sin22.5^\circ=\frac{\sqrt{2-\sqrt2}}{2}$. Even the pentagon's angles ($18^\circ$, $36^\circ$, $54^\circ$, $72^\circ$) are exact: $\cos36^\circ=\frac{1+\sqrt5}{4}$, half the golden ratio. Pick any of them below to see the derivation. ## What are the product-to-sum formulas, and what is R sin(x + φ)? **Adding and subtracting the sum and difference formulas turns a product of sines and cosines into a sum, and the reverse turns a sum into a product.** Add $\sin(x+y)=\sin x\cos y+\cos x\sin y$ and $\sin(x-y)=\sin x\cos y-\cos x\sin y$: the second terms cancel and $\sin(x+y)+\sin(x-y)=2\sin x\cos y$. The other three come the same way. | Left side | = | Right side | |---|---|---| | $\sin x\cos y$ | $=$ | $\frac{\sin(x+y)+\sin(x-y)}{2}$ | | $\cos x\sin y$ | $=$ | $\frac{\sin(x+y)-\sin(x-y)}{2}$ | | $\cos x\cos y$ | $=$ | $\frac{\cos(x-y)+\cos(x+y)}{2}$ | | $\sin x\sin y$ | $=$ | $\frac{\cos(x-y)-\cos(x+y)}{2}$ | **Sum to product.** Write the angles as $x=\frac{u+v}{2}+\frac{u-v}{2}$ and $y=\frac{u+v}{2}-\frac{u-v}{2}$ in the product formulas, and a sum of two sines or cosines becomes a product: | Left side | = | Right side | |---|---|---| | $\sin x+\sin y$ | $=$ | $2\sin\frac{x+y}{2}\cos\frac{x-y}{2}$ | | $\sin x-\sin y$ | $=$ | $2\cos\frac{x+y}{2}\sin\frac{x-y}{2}$ | | $\cos x+\cos y$ | $=$ | $2\cos\frac{x+y}{2}\cos\frac{x-y}{2}$ | | $\cos x-\cos y$ | $=$ | $-2\sin\frac{x+y}{2}\sin\frac{x-y}{2}$ | **One wave from two.** The sum of a sine and a cosine of the same angle is again a single wave. Look for numbers $R$ and $\varphi$ with $R\cos\varphi=a$ and $R\sin\varphi=b$: then $$a\sin x+b\cos x=R\sin x\cos\varphi+R\cos x\sin\varphi=R\sin(x+\varphi),$$ by the sum formula. Squaring and adding the two conditions gives $R^2=a^2+b^2$, so $R=\sqrt{a^2+b^2}$, and $\varphi=\operatorname{atan2}(b,a)$. For example $3\sin x+4\cos x=5\sin(x+53.13^\circ)$, because $R=\sqrt{9+16}=5$. This does three jobs. **The largest and smallest values** of $a\sin x+b\cos x$ are $\pm R$ (here $\pm5$). **An equation** such as $3\sin x+4\cos x=2.5$ becomes the basic equation $\sin(x+53.13^\circ)=0.5$, whose solutions are $x+53.13^\circ=30^\circ$ or $150^\circ$ (plus whole turns), so $x\approx336.87^\circ$ or $96.87^\circ$ between $0^\circ$ and $360^\circ$ (more such equations are solved in [the article on trigonometric equations](https://nunada.my.id/articles/trigonometric-equations/#use-identities)). **Two waves of the same frequency** add up to another wave of that frequency, which is how alternating currents and sound waves combine. Try other values of $a$ and $b$ below. ## How do you prove a trigonometric identity? **To prove an identity, start from one side and change it, one valid step at a time, until it becomes the other side.** Every line must equal the line before it, and the last line must be the other side of the claim. 1. **Pick a side.** Usually the more complicated one, because simplifying is easier than growing. 2. **Do not move terms across the equals sign** and do not multiply or add to both sides. That assumes what you want to prove. (You may work on both sides separately until they meet in the middle.) 3. **Turn everything into sine and cosine** when you do not see a path: $\tan$, $\cot$, $\sec$, $\csc$ all have a definition in $\sin$ and $\cos$. 4. **Use the algebra you know:** common denominators, expanding, factoring, the difference of squares $a^2-b^2=(a-b)(a+b)$. 5. **Use $\sin^2x+\cos^2x=1$ in whichever direction helps:** $1\to\sin^2x+\cos^2x$, $1-\cos^2x\to\sin^2x$. 6. **Reach for the sum, double-angle and half-angle formulas** when an angle such as $2x$, $x+y$ or $\frac{x}{2}$ appears. 7. **Say where it holds:** wherever both sides are defined. **Example 1.** Prove $\tan x+\cot x=\sec x\csc x$. Start from the left side. $\tan x+\cot x=\frac{\sin x}{\cos x}+\frac{\cos x}{\sin x}$ (quotient identities) $=\frac{\sin^2x+\cos^2x}{\sin x\cos x}$ (common denominator) $=\frac{1}{\sin x\cos x}$ (Pythagorean) $=\sec x\csc x$ (reciprocals). Done. **Example 2.** Prove $(1-\cos x)(1+\cos x)=\sin^2x$. Start from the left side. It equals $1-\cos^2x$ (difference of squares), which is $\sin^2x$ (Pythagorean). Done. The nine proofs below go from these first ones to the triple angle and the half-angle tangent. Each line carries its reason, and a program has checked that each line equals the one before it. ## How can you test an identity before proving it, and what can a test not tell you? **Test a claimed identity by comparing both sides at many angles: a single difference refutes it, but agreement, however long, only makes it likely.** This saves a great deal of time, because trying to prove a false statement is a trap. Evaluate both sides at a few angles that are not special ($25^\circ$, $40^\circ$, $100^\circ$) and not too symmetric. If the sides differ anywhere, you have a counterexample and are done. What a test cannot do is prove. $\sin2x=2\sin x$ is true at $x=0^\circ$ and $x=180^\circ$, and a test at those two angles alone would pass it; it fails at $30^\circ$, where $\sin60^\circ\approx0.866$ and $2\sin30^\circ=1$. Even a test at a thousand angles is only evidence. An identity is proved with algebra or geometry, as in the previous section. A test also has to deal with two practical matters: - **Undefined points.** If one side is undefined where the other is not (cancelling $\cos x$ removes $90^\circ$ from the domain), the sides are equal where both are defined, and the tester below reports that case separately instead of calling it a difference. - **Rounding.** A computer does not get $\sin^2x+\cos^2x=1$ exactly: the difference is about $10^{-16}$, so compare with a small tolerance, never with equality. Near $90^\circ$ a tangent is huge, and a difference of two huge numbers loses its digits, so a sensible tester skips points where the numbers are too large. Type your own claim below, in degrees, with $x$ (and $y$ for two angles). It compares the sides at every whole degree from $0^\circ$ to $359^\circ$ and at hundreds of other angles. ## Is there one rule behind all of these formulas? **Yes: Euler's formula $e^{i\theta}=\cos\theta+i\sin\theta$ contains the sum formulas, and with them everything else in this article.** The exponential has the rule $e^{ix}\cdot e^{iy}=e^{i(x+y)}$. Write each factor with Euler's formula and multiply out, remembering $i^2=-1$: $$(\cos x+i\sin x)(\cos y+i\sin y)=(\cos x\cos y-\sin x\sin y)+i(\sin x\cos y+\cos x\sin y).$$ The left side is $e^{i(x+y)}=\cos(x+y)+i\sin(x+y)$. Two complex numbers are equal only if their real parts and their imaginary parts are equal, so the real parts give the cosine sum formula and the imaginary parts give the sine sum formula. It is the rotation of the previous section, since multiplying by $e^{iy}$ is turning through $y$. Raising to a power gives de Moivre's formula, $(\cos x+i\sin x)^n=\cos nx+i\sin nx$. For $n=3$, expanding the left side gives $\cos3x=\cos^3x-3\cos x\sin^2x$ and $\sin3x=3\cos^2x\sin x-\sin^3x$, which are the triple-angle formulas written with both functions (use $\sin^2x+\cos^2x=1$ to get the forms above). Exactly one rule about exponents sits behind the whole list. ## How do you check an identity in a program? **A program checks an identity by sampling: evaluate both sides at many angles and report the largest difference, which should be around $10^{-16}$ for a true identity and large for a false one.** Three details matter. Convert degrees to radians before calling `sin` and `cos`. Compare with a tolerance such as $10^{-12}$ rather than `==`. And skip the angles where a side is undefined (`tan` at $90^\circ$ or a division by zero) rather than calling them differences. The programs below measure the largest gap for four claims: $\sin^2x+\cos^2x=1$, $\sin2x=2\sin x\cos x$, the false $\sin2x=2\sin x$, and $3\sin x+4\cos x=5\sin(x+53.13^\circ)$. They print whether the gap is below the tolerance (true for the identities), and for the false one the size of the gap and where it is largest ($2.5981$ at $120^\circ$). For symbolic proofs of the same statements, use a computer algebra system such as SymPy: it can simplify one side into the other, which a numeric sample never can. ```python import math def max_gap(f, g, n=3600): """The largest |f(x) - g(x)| over n + 1 angles from 0 to 360 degrees, and where it first happens.""" worst, at = 0.0, 0.0 for k in range(n + 1): x = 360 * k / n try: gap = abs(f(x) - g(x)) except ZeroDivisionError: continue # undefined here: skip the point, do not call it a difference if gap > worst: worst, at = gap, x return worst, at r = math.radians sin = lambda x: math.sin(r(x)) cos = lambda x: math.cos(r(x)) print(max_gap(lambda x: sin(x) ** 2 + cos(x) ** 2, lambda x: 1)[0] < 1e-12) # True print(max_gap(lambda x: sin(2 * x), lambda x: 2 * sin(x) * cos(x))[0] < 1e-12) # True print(max_gap(lambda x: sin(x + 25), lambda x: sin(x) * cos(25) + cos(x) * sin(25))[0] < 1e-12) # True gap, at = max_gap(lambda x: sin(2 * x), lambda x: 2 * sin(x)) print(round(gap, 4), at) # 2.5981 120.0: not an identity print(round(max_gap(lambda x: sin(x + 25), lambda x: sin(x) + sin(25))[0], 4)) # 0.8555: not an identity either R = math.hypot(3, 4) phi = math.degrees(math.atan2(4, 3)) print(round(R, 4), round(phi, 4)) # 5.0 53.1301 print(max_gap(lambda x: 3 * sin(x) + 4 * cos(x), lambda x: R * sin(x + phi))[0] < 1e-12) # True ``` ```javascript const r = (d) => (d * Math.PI) / 180 const sin = (x) => Math.sin(r(x)) const cos = (x) => Math.cos(r(x)) function maxGap(f, g, n = 3600) { // the largest |f(x) - g(x)| over n + 1 angles from 0 to 360 degrees, and where it first happens let worst = 0, at = 0 for (let k = 0; k <= n; k++) { const x = (360 * k) / n const gap = Math.abs(f(x) - g(x)) if (Number.isNaN(gap)) continue // undefined here: skip the point, do not call it a difference if (gap > worst) { worst = gap; at = x } } return [worst, at] } maxGap((x) => sin(x) ** 2 + cos(x) ** 2, () => 1)[0] < 1e-12 // true maxGap((x) => sin(2 * x), (x) => 2 * sin(x) * cos(x))[0] < 1e-12 // true maxGap((x) => sin(x + 25), (x) => sin(x) * cos(25) + cos(x) * sin(25))[0] < 1e-12 // true const [gap, at] = maxGap((x) => sin(2 * x), (x) => 2 * sin(x)) ;[+gap.toFixed(4), at] // [2.5981, 120]: not an identity +maxGap((x) => sin(x + 25), (x) => sin(x) + sin(25))[0].toFixed(4) // 0.8555: not an identity either const R = Math.hypot(3, 4), phi = (Math.atan2(4, 3) * 180) / Math.PI ;[+R.toFixed(4), +phi.toFixed(4)] // [5, 53.1301] maxGap((x) => 3 * sin(x) + 4 * cos(x), (x) => R * sin(x + phi))[0] < 1e-12 // true ``` ```cpp #include #include #include using namespace std; const double PI = 3.14159265358979323846; double worstAt; // where the largest gap is double rad(double d) { return d * PI / 180.0; } // the two sides of claim number "which", at x degrees double lhs(int which, double x) { double a = rad(x); if (which == 1) return sin(a) * sin(a) + cos(a) * cos(a); if (which == 2) return sin(2 * a); if (which == 3) return sin(2 * a); return 3 * sin(a) + 4 * cos(a); } double rhs(int which, double x) { double a = rad(x); if (which == 1) return 1; if (which == 2) return 2 * sin(a) * cos(a); if (which == 3) return 2 * sin(a); return 5 * sin(a + rad(53.13010235415598)); } double maxGap(int which) { double worst = 0; worstAt = 0; for (int k = 0; k <= 3600; k++) { double x = 360.0 * k / 3600.0; double gap = fabs(lhs(which, x) - rhs(which, x)); if (gap > worst) { worst = gap; worstAt = x; } } return worst; } int main() { printf("%d\n", maxGap(1) < 1e-12 ? 1 : 0); printf("%d\n", maxGap(2) < 1e-12 ? 1 : 0); printf("%.4f %.1f\n", maxGap(3), worstAt); printf("%d\n", maxGap(4) < 1e-9 ? 1 : 0); return 0; } /* output: 1 1 2.5981 120.0 1 */ ``` ## Where do the trigonometric identities come from? **The sum formulas began as a theorem about chords in a circle, became tools for multiplying large numbers before logarithms, and were folded into one rule about exponentials in the eighteenth century.** - **About 150 AD.** Ptolemy's Almagest proves a theorem about the sides and diagonals of a quadrilateral inscribed in a circle. It gives the chord of a sum or a difference of two arcs, which is the sum formula for the sine in the language of chords, and Ptolemy used it to build his table. - **About 500 AD.** Indian astronomers state the rules for the sine and cosine of sums, and for the half angle, as part of their sine tables. - **16th century.** Prosthaphaeresis: before logarithms, astronomers (Tycho Brahe's circle among them) turned a multiplication into an addition with $\cos x\cos y=\frac{\cos(x-y)+\cos(x+y)}{2}$, looking the three cosines up in a table. Napier's logarithms (1614) replaced the method. - **1722.** de Moivre's formula, the form $(\cos x+i\sin x)^n=\cos nx+i\sin nx$, ties the multiple-angle formulas to powers. - **1748.** Euler's Introductio makes the modern notation standard and gives $e^{ix}=\cos x+i\sin x$, from which the sum formulas follow in two lines. ## What are the common mistakes with trigonometric identities? **The most common mistakes with trigonometric identities are the nine below, each with the correct statement.** | Mistake | Correct | |---|---| | ❌ $\sin(x+y)=\sin x+\sin y$ | $\sin(x+y)=\sin x\cos y+\cos x\sin y$; at $30^\circ$ and $30^\circ$ the first gives $0.866$ and the wrong one $1$. | | ❌ $\cos(x-y)=\cos x-\cos y$ | $\cos(x-y)=\cos x\cos y+\sin x\sin y$: the sign flips between the sum and the difference formula. | | ❌ $\sin2x=2\sin x$ | $\sin2x=2\sin x\cos x$; the wrong version holds only at $0^\circ$ and $180^\circ$. | | ❌ $\sin\frac{x}{2}=\frac{\sin x}{2}$ | $\sin\frac{x}{2}=\pm\sqrt{\frac{1-\cos x}{2}}$, with the sign of the quadrant of $\frac{x}{2}$. | | ❌ Take $+\sqrt{\ }$ in every half-angle formula | The sign is that of sine or cosine where $\frac{x}{2}$ lies: negative in quadrants III and IV for sine. | | ❌ $\sin x^2=\sin^2x$ | $\sin^2x$ means $(\sin x)^2$; $\sin(x^2)$ is a different function. | | ❌ Cancel a term of a sum: $\frac{\sin x+\cos x}{\sin x}=\cos x$ | Only factors cancel: it is $1+\cot x$. | | ❌ Move terms across the equals sign while proving | Work on one side only; each line must equal the one before it. | | ❌ Test one angle and call it an identity | Agreement at some angles proves nothing; one counterexample refutes, and only a proof confirms. | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: trigonometric identities at a glance - **Identity:** true wherever both sides are defined; a false formula needs one counterexample, a true one needs a proof. - **Fundamental:** $\sin^2x+\cos^2x=1$, $1+\tan^2x=\sec^2x$, $\tan x=\frac{\sin x}{\cos x}$, $\sin(90^\circ-x)=\cos x$, $\sin(-x)=-\sin x$, $\cos(-x)=\cos x$. - **Sum and difference:** $\sin(x\pm y)=\sin x\cos y\pm\cos x\sin y$, $\cos(x\pm y)=\cos x\cos y\mp\sin x\sin y$, from turning a point through $y$. - **Double and half:** $\sin2x=2\sin x\cos x$; $\cos2x=\cos^2x-\sin^2x$, also $2\cos^2x-1$ and $1-2\sin^2x$; $\sin^2\frac{x}{2}=\frac{1-\cos x}{2}$, $\cos^2\frac{x}{2}=\frac{1+\cos x}{2}$. - **Product and sum:** $\sin x\cos y=\frac{\sin(x+y)+\sin(x-y)}{2}$ and the other three; sums become products with the half sum and half difference. - **One wave:** $a\sin x+b\cos x=R\sin(x+\varphi)$, $R=\sqrt{a^2+b^2}$, $\varphi=\operatorname{atan2}(b,a)$. - **Proving:** one side only, valid steps, sine and cosine when stuck, Pythagorean in either direction, state the domain. - **Testing:** compare at many angles, tolerance not equality, skip undefined points; a test refutes but never proves. - **Behind it all:** $e^{ix}\cdot e^{iy}=e^{i(x+y)}$. ## Glossary: key terms - **Trigonometric identity**: An equation between trigonometric expressions that is true for every angle at which both sides are defined. - **Counterexample**: One angle at which the two sides of a claimed identity differ, which proves the claim false. - **Pythagorean identity**: The identity sin squared plus cos squared equals 1, which says that the point at an angle on the unit circle is at distance 1 from the center. - **Sum formula**: A formula that gives the sine, cosine or tangent of x plus y from the functions of x and of y, such as sin(x + y) = sin x cos y + cos x sin y. - **Double-angle formula**: A formula for the sine, cosine or tangent of 2x in terms of the functions of x, found by putting y equal to x in the sum formula. - **Half-angle formula**: A formula for the sine, cosine or tangent of x over 2, with a square root whose sign is that of the function in the quadrant of x over 2. - **Product-to-sum formula**: A formula that writes a product of two sines or cosines as half a sum, such as sin x cos y = (sin(x + y) + sin(x - y)) / 2. - **Single-wave form**: The rewriting of a sin x + b cos x as R sin(x + phi) with R equal to the square root of a squared plus b squared. - **Domain of an identity**: The angles at which both sides are defined; an identity says nothing about angles where a side is undefined. - **Prosthaphaeresis**: A sixteenth-century method that used the product-to-sum formulas to replace a multiplication by additions and table look-ups. ## Frequently asked questions ### What is the difference between a trigonometric identity and an equation? An identity is true for every angle where both sides are defined, like sin squared plus cos squared equals 1. An equation is true only for some angles, like sine of x equals one half, so you solve it instead of proving it. ### What are the sum and difference formulas for sine and cosine? Sin of x plus y is sin x cos y plus cos x sin y, and cos of x plus y is cos x cos y minus sin x sin y. For differences, change the sign in the sine formula and flip the sign in the cosine formula. ### How do you derive the double-angle formulas? Put y equal to x in the sum formulas: sin 2x is 2 sin x cos x and cos 2x is cos squared x minus sin squared x. With sin squared plus cos squared equal to 1, cos 2x also equals 2 cos squared x minus 1 and 1 minus 2 sin squared x. ### What is the half-angle formula for sine and cosine? Sine squared of x over 2 is 1 minus cos x, over 2, and cosine squared of x over 2 is 1 plus cos x, over 2. Taking the square root needs a plus or minus sign chosen by the quadrant of x over 2. ### How do you prove a trigonometric identity? Start from one side and change it, one valid step at a time, into the other side. Rewrite in sine and cosine when stuck, use the Pythagorean identity, and never move terms across the equals sign. ### Can you check an identity by plugging in numbers? Only to refute it. One angle where the sides differ shows the claim is false, but agreement at some angles proves nothing: sin 2x and 2 sin x agree at 0 and 180 degrees and are not equal in general. ### How do you turn a sin x + b cos x into a single sine? Write it as R sin of x plus phi, where R is the square root of a squared plus b squared and phi is atan2 of b and a. For example 3 sin x plus 4 cos x equals 5 sin of x plus 53.13 degrees. ### Which formulas give exact values such as sin 15 degrees? The difference and sum formulas applied to 30, 45 and 60 degrees, and the half-angle formulas. Sin 15 degrees is sin of 45 minus 30, which is root 6 minus root 2, over 4. --- # Identitas Trigonometri: Rumus Jumlah, Sudut Ganda, dan Pembuktian Source: https://nunada.my.id/artikel/identitas-trigonometri/ Updated: 2026-10-26 ## Jawaban singkat **Identitas trigonometri adalah persamaan antara ekspresi trigonometri yang benar untuk setiap sudut yang kedua ruasnya terdefinisi, misalnya $\sin^2x+\cos^2x=1$.** Yang mendasar berasal dari lingkaran satuan; rumus jumlah $\sin(x+y)=\sin x\cos y+\cos x\sin y$ dan $\cos(x+y)=\cos x\cos y-\sin x\sin y$ berasal dari memutar sebuah titik sebesar sebuah sudut, dan rumus sudut ganda, sudut paruh, hasil kali, dan pangkat mengikuti darinya. Untuk membuktikan identitas, kita mengubah satu ruas menjadi ruas lain dengan langkah yang sah; mencoba bilangan hanya dapat membantahnya. ### Poin penting - Identitas berlaku untuk setiap sudut yang kedua ruasnya terdefinisi; persamaan hanya berlaku untuk sebagian. $\tan x=\frac{\sin x}{\cos x}$ adalah identitas walaupun tak satu pun ruasnya ada pada $90^\circ$. Rumus seperti $\sin(x+y)=\sin x+\sin y$ salah, dan satu contoh penyangkal ($x=y=30^\circ$) menunjukkannya. - Identitas dasar (kebalikan, hasil bagi, Pythagoras, komplemen, genap dan ganjil, pergeseran) semuanya dibaca dari lingkaran satuan: titik pada sudut $x$ adalah $(\cos x,\sin x)$ dan berjarak $1$ dari titik asal, yang sudah merupakan $\sin^2x+\cos^2x=1$. - Memutar titik pada $x$ sebesar $y$ memberi rumus jumlah, karena bayangan $(1,0)$ dan $(0,1)$ adalah $(\cos y,\sin y)$ dan $(-\sin y,\cos y)$. Ganti $y$ dengan $-y$ untuk rumus selisih, dan bagi untuk tangen. - Pasang $y=x$ pada rumus jumlah dan diperoleh rumus sudut ganda, dengan tiga bentuk $\cos2x$; selesaikan untuk kuadratnya dan diperoleh rumus sudut paruh dan pengurangan pangkat. Jumlahkan dan kurangkan rumus jumlah dan diperoleh rumus hasil kali menjadi jumlah, dan yang jumlah menjadi hasil kali adalah hal yang sama dibaca terbalik. - Setiap $a\sin x+b\cos x$ adalah satu gelombang $R\sin(x+\varphi)$ dengan $R=\sqrt{a^2+b^2}$ dan $\varphi=\operatorname{atan2}(b,a)$, sehingga nilai terbesarnya adalah $R$ dan persamaan seperti $3\sin x+4\cos x=2{,}5$ menjadi persamaan dasar. - Untuk membuktikan identitas, kerjakan satu ruas, satu langkah sah pada satu waktu (jangan pernah memindahkan suku melewati tanda sama dengan), ubah semuanya menjadi sinus dan kosinus bila buntu, dan pakai $\sin^2x+\cos^2x=1$. Sebelum mulai, uji klaimnya pada beberapa sudut: satu contoh penyangkal mengakhiri pencarian, tetapi kecocokan pada sebagian sudut tidak membuktikan apa-apa. ## Apa yang membuat sebuah persamaan menjadi identitas trigonometri? **Identitas trigonometri adalah persamaan yang benar untuk setiap sudut yang kedua ruasnya terdefinisi; persamaan biasa hanya benar untuk sebagian sudut.** $\sin x=\frac12$ adalah persamaan: benar pada $30^\circ$ dan $150^\circ$ dan salah pada $45^\circ$. $\sin^2x+\cos^2x=1$ adalah identitas: benar pada $45^\circ$, pada $1000^\circ$, dan pada setiap sudut lain. Menyelesaikan persamaan berarti mencari sudut yang membuatnya benar; membuktikan identitas berarti menunjukkan bahwa semuanya membuatnya benar. Dua hal perlu diketahui sejak awal. - **Kedua ruas tidak harus ada di mana-mana.** $\tan x=\frac{\sin x}{\cos x}$ adalah identitas walaupun tak satu pun ruasnya ada pada $90^\circ$, karena klaimnya hanya tentang sudut yang keduanya ada. Mencoret dapat mengubah di mana sebuah ekspresi terdefinisi: $\frac{\sin x\cos x}{\cos x}$ tidak terdefinisi pada $90^\circ$ tetapi $\sin x$ terdefinisi, jadi keduanya sama di mana pun keduanya terdefinisi, yang sudah merupakan permintaan sebuah identitas. - **Rumus yang salah hanya memerlukan satu contoh penyangkal.** $\sin(x+y)=\sin x+\sin y$ tampak masuk akal, tetapi pada $x=y=30^\circ$ ruas kiri adalah $\sin60^\circ\approx0{,}866$ dan ruas kanan $0{,}5+0{,}5=1$. Identitas yang benar, sebaliknya, tidak pernah dapat ditunjukkan dengan mencoba sudut, karena jumlahnya tak terhingga; ia harus dibuktikan. Artikel ini mendaftar identitas yang layak diketahui, menunjukkan asalnya (semuanya mengikuti dari lingkaran satuan dan satu rotasi), lalu menunjukkan cara membuktikan identitas dan menguji sebuah klaim sebelum menghabiskan waktu untuknya. Dasar-dasar sinus, kosinus, dan tangen ada di [artikel trigonometri dasar](https://nunada.my.id/artikel/trigonometri-dasar/#identities); di sini ada pembuktian dan daftar yang lebih panjang. ## Dari mana identitas trigonometri yang mendasar berasal? **Identitas dasar adalah identitas kebalikan, hasil bagi, Pythagoras, komplemen, genap-ganjil, dan pergeseran, dan masing-masing dapat dibaca langsung dari lingkaran satuan.** Pada lingkaran satuan titik pada sudut $x$ adalah $(\cos x,\sin x)$, dari sinilah sinus dan kosinus berasal untuk setiap sudut (lihat [lingkaran satuan](https://nunada.my.id/artikel/trigonometri-dasar/#unit-circle)). **Kebalikan dan hasil bagi.** Inilah definisi $\tan$, $\cot$, $\sec$, dan $\csc$ dalam $\sin$ dan $\cos$: | Ruas kiri | = | Ruas kanan | |---|---|---| | $\csc x$ | $=$ | $\frac{1}{\sin x}$ | | $\sec x$ | $=$ | $\frac{1}{\cos x}$ | | $\cot x$ | $=$ | $\frac{1}{\tan x}$ † | | $\tan x$ | $=$ | $\frac{\sin x}{\cos x}$ | | $\cot x$ | $=$ | $\frac{\cos x}{\sin x}$ | **Pythagoras.** Titik itu berada pada lingkaran berjari-jari $1$, jadi koordinatnya memenuhi $x^2+y^2=1$, yaitu $\cos^2x+\sin^2x=1$. Bagi dengan $\cos^2x$ dan diperoleh $1+\tan^2x=\sec^2x$; bagi dengan $\sin^2x$ dan diperoleh $1+\cot^2x=\csc^2x$. Ini adalah [teorema Pythagoras](https://nunada.my.id/artikel/teorema-pythagoras/#what-is-the-theorem) dalam penyamaran. | Ruas kiri | = | Ruas kanan | |---|---|---| | $\sin^2 x+\cos^2 x$ | $=$ | $1$ | | $1+\tan^2 x$ | $=$ | $\sec^2 x$ | | $1+\cot^2 x$ | $=$ | $\csc^2 x$ | **Komplemen.** Kedua sudut lancip segitiga siku-siku berjumlah $90^\circ$, dan sisi yang berada di depan yang satu berada di samping yang lain, jadi sinus sebuah sudut adalah kosinus penyikunya. | Ruas kiri | = | Ruas kanan | |---|---|---| | $\sin(90^\circ-x)$ | $=$ | $\cos x$ | | $\cos(90^\circ-x)$ | $=$ | $\sin x$ | | $\tan(90^\circ-x)$ | $=$ | $\cot x$ | **Genap dan ganjil.** Berputar sebesar $-x$ mencerminkan titik pada sumbu-$x$: koordinat-$x$ tetap dan koordinat-$y$ berganti tanda. | Ruas kiri | = | Ruas kanan | |---|---|---| | $\sin(-x)$ | $=$ | $-\sin x$ | | $\cos(-x)$ | $=$ | $\cos x$ | | $\tan(-x)$ | $=$ | $-\tan x$ | **Pergeseran $90^\circ$ dan $180^\circ$.** Setengah putaran mengirim $(x,y)$ ke $(-x,-y)$, dan seperempat putaran mengirimnya ke $(-y,x)$. | Ruas kiri | = | Ruas kanan | |---|---|---| | $\sin(180^\circ-x)$ | $=$ | $\sin x$ | | $\cos(180^\circ-x)$ | $=$ | $-\cos x$ | | $\sin(x+180^\circ)$ | $=$ | $-\sin x$ | | $\cos(x+180^\circ)$ | $=$ | $-\cos x$ | | $\tan(x+180^\circ)$ | $=$ | $\tan x$ | | $\sin(x+90^\circ)$ | $=$ | $\cos x$ | | $\cos(x+90^\circ)$ | $=$ | $-\sin x$ | † Identitas yang berlaku di mana pun kedua ruas terdefinisi: kedua ruas tidak terdefinisi pada sudut yang sama. Setiap rumus dalam tabel di halaman ini diuji oleh program pada ratusan sudut, terhadap perhitungan yang bebas, dan yang bertanda belati adalah tepat yang pada suatu sudut satu ruasnya terdefinisi sedangkan yang lain tidak. ## Bagaimana rumus jumlah dan selisih bekerja? **Rumus jumlah berasal dari memutar sebuah titik sebesar sebuah sudut: titik pada $x$, diputar sebesar $y$, jatuh pada sudut $x+y$, dan koordinat barunya tersusun dari empat hasil kali $\cos x\cos y$, $\sin x\sin y$, $\sin x\cos y$, dan $\cos x\sin y$.** Putar seluruh bidang terhadap titik asal sebesar sudut $y$. Titik $(1,0)$ pergi ke $(\cos y,\sin y)$ dan titik $(0,1)$ pergi ke $(-\sin y,\cos y)$. Rotasi mempertahankan jumlah dan kelipatan, dan titik pada sudut $x$ adalah $\cos x\cdot(1,0)+\sin x\cdot(0,1)$, jadi ia pergi ke $$\cos x\,(\cos y,\ \sin y)+\sin x\,(-\sin y,\ \cos y)$$ $$=\left(\cos x\cos y-\sin x\sin y,\ \ \sin x\cos y+\cos x\sin y\right).$$ Tetapi memutar titik pada $x$ sebesar $y$ menempatkannya pada sudut $x+y$, yang koordinatnya $(\cos(x+y),\sin(x+y))$. Membandingkan kedua koordinat memberi kedua rumus sekaligus. | Ruas kiri | = | Ruas kanan | |---|---|---| | $\sin(x+y)$ | $=$ | $\sin x\cos y+\cos x\sin y$ | | $\sin(x-y)$ | $=$ | $\sin x\cos y-\cos x\sin y$ | | $\cos(x+y)$ | $=$ | $\cos x\cos y-\sin x\sin y$ | | $\cos(x-y)$ | $=$ | $\cos x\cos y+\sin x\sin y$ | | $\tan(x+y)$ | $=$ | $\frac{\tan x+\tan y}{1-\tan x\tan y}$ † | | $\tan(x-y)$ | $=$ | $\frac{\tan x-\tan y}{1+\tan x\tan y}$ † | † Rumus tangen berlaku di mana pun kedua ruas terdefinisi. **Rumus selisih** adalah rumus jumlah dengan $y$ diganti $-y$, memakai $\cos(-y)=\cos y$ dan $\sin(-y)=-\sin y$, yang membalik satu tanda pada masing-masing: perhatikan minus pada $\cos(x+y)=\cos x\cos y-\sin x\sin y$ dan plus pada $\cos(x-y)=\cos x\cos y+\sin x\sin y$. **Rumus tangen** adalah hasil bagi keduanya: bagi pembilang dan penyebut $\frac{\sin(x+y)}{\cos(x+y)}$ dengan $\cos x\cos y$. Geser sudut-sudut di bawah dan lihat keempat hasil kali menyusun titik yang baru. ## Bagaimana memperoleh rumus sudut ganda, sudut paruh, dan pengurangan pangkat? **Pasang $y=x$ pada rumus jumlah dan diperoleh rumus sudut ganda; selesaikan untuk kuadratnya dan diperoleh rumus sudut paruh dan pengurangan pangkat.** Tidak ada yang baru diperlukan: ini rotasi yang sama. **Sudut ganda.** $\sin2x=\sin(x+x)=2\sin x\cos x$ dan $\cos2x=\cos^2x-\sin^2x$. Karena $\sin^2x+\cos^2x=1$, kosinus memiliki tiga bentuk: ganti $\sin^2x$ dengan $1-\cos^2x$ dan diperoleh $2\cos^2x-1$; ganti $\cos^2x$ dengan $1-\sin^2x$ dan diperoleh $1-2\sin^2x$. Bentuk mana yang dipakai bergantung pada apa yang ingin tersisa. | Ruas kiri | = | Ruas kanan | |---|---|---| | $\sin 2x$ | $=$ | $2\sin x\cos x$ | | $\cos 2x$ | $=$ | $\cos^2 x-\sin^2 x$ | | $\cos 2x$ | $=$ | $2\cos^2 x-1$ | | $\cos 2x$ | $=$ | $1-2\sin^2 x$ | | $\tan 2x$ | $=$ | $\frac{2\tan x}{1-\tan^2 x}$ † | **Sudut rangkap tiga.** $\sin3x=\sin(2x+x)$ dan $\cos3x=\cos(2x+x)$: pakai rumus jumlah, lalu rumus sudut ganda, lalu $\sin^2x+\cos^2x=1$. | Ruas kiri | = | Ruas kanan | |---|---|---| | $\sin 3x$ | $=$ | $3\sin x-4\sin^3 x$ | | $\cos 3x$ | $=$ | $4\cos^3 x-3\cos x$ | **Sudut paruh.** Ambil $\cos x=1-2\sin^2\frac{x}{2}$ dan $\cos x=2\cos^2\frac{x}{2}-1$ (rumus sudut ganda untuk sudut $\frac{x}{2}$) dan selesaikan untuk kuadratnya: | Ruas kiri | = | Ruas kanan | |---|---|---| | $\sin^2\frac{x}{2}$ | $=$ | $\frac{1-\cos x}{2}$ | | $\cos^2\frac{x}{2}$ | $=$ | $\frac{1+\cos x}{2}$ | | $\tan\frac{x}{2}$ | $=$ | $\frac{\sin x}{1+\cos x}$ | | $\tan\frac{x}{2}$ | $=$ | $\frac{1-\cos x}{\sin x}$ † | Menarik akar kuadrat memberi $\sin\frac{x}{2}=\pm\sqrt{\frac{1-\cos x}{2}}$ dan $\cos\frac{x}{2}=\pm\sqrt{\frac{1+\cos x}{2}}$, dan tandanya adalah tanda sinus atau kosinus pada kuadran tempat $\frac{x}{2}$ berada, bukan pilihan bebas. **Pengurangan pangkat.** Kedua persamaan yang sama dengan $x$ menggantikan $\frac{x}{2}$ mengubah kuadrat menjadi pangkat satu dari sudut ganda, yang diinginkan integral atau analisis sinyal: | Ruas kiri | = | Ruas kanan | |---|---|---| | $\sin^2 x$ | $=$ | $\frac{1-\cos 2x}{2}$ | | $\cos^2 x$ | $=$ | $\frac{1+\cos 2x}{2}$ | | $\sin^2 x\cos^2 x$ | $=$ | $\frac{1-\cos 4x}{8}$ | **Nilai eksak.** Dengan rumus-rumus ini sudut $30^\circ$, $45^\circ$, dan $60^\circ$ menuntun ke banyak sudut lain. $\sin15^\circ=\sin(45^\circ-30^\circ)$, yaitu $\frac{\sqrt2}{2}\cdot\frac{\sqrt3}{2}-\frac{\sqrt2}{2}\cdot\frac12$, atau $\frac{\sqrt6-\sqrt2}{4}$. $\sin22{,}5^\circ$ adalah setengah dari $45^\circ$: $\sin^2 22{,}5^\circ=\frac{1-\cos45^\circ}{2}=\frac{2-\sqrt2}{4}$, jadi $\sin22{,}5^\circ=\frac{\sqrt{2-\sqrt2}}{2}$. Bahkan sudut-sudut segi lima ($18^\circ$, $36^\circ$, $54^\circ$, $72^\circ$) eksak: $\cos36^\circ=\frac{1+\sqrt5}{4}$, setengah rasio emas. Pilih salah satunya di bawah untuk melihat penurunannya. ## Apa rumus hasil kali menjadi jumlah, dan apa itu R sin(x + φ)? **Menjumlahkan dan mengurangkan rumus jumlah dan selisih mengubah hasil kali sinus dan kosinus menjadi jumlah, dan kebalikannya mengubah jumlah menjadi hasil kali.** Jumlahkan $\sin(x+y)=\sin x\cos y+\cos x\sin y$ dan $\sin(x-y)=\sin x\cos y-\cos x\sin y$: suku kedua saling menghilangkan dan $\sin(x+y)+\sin(x-y)=2\sin x\cos y$. Tiga yang lain diperoleh dengan cara yang sama. | Ruas kiri | = | Ruas kanan | |---|---|---| | $\sin x\cos y$ | $=$ | $\frac{\sin(x+y)+\sin(x-y)}{2}$ | | $\cos x\sin y$ | $=$ | $\frac{\sin(x+y)-\sin(x-y)}{2}$ | | $\cos x\cos y$ | $=$ | $\frac{\cos(x-y)+\cos(x+y)}{2}$ | | $\sin x\sin y$ | $=$ | $\frac{\cos(x-y)-\cos(x+y)}{2}$ | **Jumlah menjadi hasil kali.** Tulis sudut-sudutnya sebagai $x=\frac{u+v}{2}+\frac{u-v}{2}$ dan $y=\frac{u+v}{2}-\frac{u-v}{2}$ dalam rumus hasil kali, dan jumlah dua sinus atau kosinus menjadi hasil kali: | Ruas kiri | = | Ruas kanan | |---|---|---| | $\sin x+\sin y$ | $=$ | $2\sin\frac{x+y}{2}\cos\frac{x-y}{2}$ | | $\sin x-\sin y$ | $=$ | $2\cos\frac{x+y}{2}\sin\frac{x-y}{2}$ | | $\cos x+\cos y$ | $=$ | $2\cos\frac{x+y}{2}\cos\frac{x-y}{2}$ | | $\cos x-\cos y$ | $=$ | $-2\sin\frac{x+y}{2}\sin\frac{x-y}{2}$ | **Satu gelombang dari dua.** Jumlah sebuah sinus dan sebuah kosinus dari sudut yang sama adalah lagi satu gelombang. Cari bilangan $R$ dan $\varphi$ dengan $R\cos\varphi=a$ dan $R\sin\varphi=b$: maka $$a\sin x+b\cos x=R\sin x\cos\varphi+R\cos x\sin\varphi=R\sin(x+\varphi),$$ menurut rumus jumlah. Mengkuadratkan dan menjumlahkan kedua syarat memberi $R^2=a^2+b^2$, jadi $R=\sqrt{a^2+b^2}$, dan $\varphi=\operatorname{atan2}(b,a)$. Misalnya $3\sin x+4\cos x=5\sin(x+53{,}13^\circ)$, karena $R=\sqrt{9+16}=5$. Ini melakukan tiga pekerjaan. **Nilai terbesar dan terkecil** $a\sin x+b\cos x$ adalah $\pm R$ (di sini $\pm5$). **Persamaan** seperti $3\sin x+4\cos x=2{,}5$ menjadi persamaan dasar $\sin(x+53{,}13^\circ)=0{,}5$, yang penyelesaiannya $x+53{,}13^\circ=30^\circ$ atau $150^\circ$ (ditambah putaran penuh), sehingga $x\approx336{,}87^\circ$ atau $96{,}87^\circ$ di antara $0^\circ$ dan $360^\circ$ (persamaan semacam ini lebih banyak diselesaikan di [artikel tentang persamaan trigonometri](https://nunada.my.id/artikel/persamaan-trigonometri/#use-identities)). **Dua gelombang berfrekuensi sama** menjumlah menjadi gelombang lain berfrekuensi itu, begitulah arus bolak-balik dan gelombang bunyi bergabung. Coba nilai $a$ dan $b$ yang lain di bawah. ## Bagaimana membuktikan sebuah identitas trigonometri? **Untuk membuktikan identitas, mulailah dari satu ruas dan ubah, satu langkah sah pada satu waktu, sampai menjadi ruas yang lain.** Setiap baris harus sama dengan baris sebelumnya, dan baris terakhir harus ruas lain dari klaim itu. 1. **Pilih satu ruas.** Biasanya yang lebih rumit, karena menyederhanakan lebih mudah daripada membesarkan. 2. **Jangan memindahkan suku melewati tanda sama dengan** dan jangan mengalikan atau menambah kedua ruas. Itu mengandaikan apa yang ingin dibuktikan. (Boleh mengerjakan kedua ruas secara terpisah sampai bertemu di tengah.) 3. **Ubah semuanya menjadi sinus dan kosinus** bila belum melihat jalan: $\tan$, $\cot$, $\sec$, $\csc$ semuanya memiliki definisi dalam $\sin$ dan $\cos$. 4. **Pakai aljabar yang sudah dikenal:** penyebut sama, menjabarkan, memfaktorkan, selisih kuadrat $a^2-b^2=(a-b)(a+b)$. 5. **Pakai $\sin^2x+\cos^2x=1$ ke arah mana pun yang membantu:** $1\to\sin^2x+\cos^2x$, $1-\cos^2x\to\sin^2x$. 6. **Pakai rumus jumlah, sudut ganda, dan sudut paruh** ketika muncul sudut seperti $2x$, $x+y$, atau $\frac{x}{2}$. 7. **Sebutkan di mana ia berlaku:** di mana pun kedua ruas terdefinisi. **Contoh 1.** Buktikan $\tan x+\cot x=\sec x\csc x$. Mulai dari ruas kiri. $\tan x+\cot x=\frac{\sin x}{\cos x}+\frac{\cos x}{\sin x}$ (identitas hasil bagi) $=\frac{\sin^2x+\cos^2x}{\sin x\cos x}$ (penyebut sama) $=\frac{1}{\sin x\cos x}$ (Pythagoras) $=\sec x\csc x$ (kebalikan). Selesai. **Contoh 2.** Buktikan $(1-\cos x)(1+\cos x)=\sin^2x$. Mulai dari ruas kiri. Ia sama dengan $1-\cos^2x$ (selisih kuadrat), yaitu $\sin^2x$ (Pythagoras). Selesai. Sembilan pembuktian di bawah berjalan dari yang pertama ini sampai sudut rangkap tiga dan tangen sudut paruh. Setiap baris membawa alasannya, dan sebuah program telah memeriksa bahwa setiap baris sama dengan baris sebelumnya. ## Bagaimana menguji sebuah identitas sebelum membuktikannya, dan apa yang tidak dapat dikatakan sebuah uji? **Uji identitas yang diklaim dengan membandingkan kedua ruas pada banyak sudut: satu perbedaan membantahnya, tetapi kecocokan, sepanjang apa pun, hanya membuatnya mungkin benar.** Ini menghemat banyak waktu, karena mencoba membuktikan pernyataan yang salah adalah jebakan. Hitung kedua ruas pada beberapa sudut yang tidak istimewa ($25^\circ$, $40^\circ$, $100^\circ$) dan tidak terlalu simetris. Bila kedua ruas berbeda di mana pun, kita punya contoh penyangkal dan selesai. Yang tidak dapat dilakukan sebuah uji adalah membuktikan. $\sin2x=2\sin x$ benar pada $x=0^\circ$ dan $x=180^\circ$, dan uji pada kedua sudut itu saja akan meloloskannya; ia gagal pada $30^\circ$, tempat $\sin60^\circ\approx0{,}866$ dan $2\sin30^\circ=1$. Bahkan uji pada seribu sudut hanyalah bukti pendukung. Identitas dibuktikan dengan aljabar atau geometri, seperti pada bagian sebelumnya. Sebuah uji juga harus menangani dua hal praktis: - **Titik tak terdefinisi.** Bila satu ruas tak terdefinisi di tempat yang lain terdefinisi (mencoret $\cos x$ menghapus $90^\circ$ dari daerah asal), kedua ruas sama di tempat keduanya terdefinisi, dan penguji di bawah melaporkan kasus itu secara terpisah alih-alih menyebutnya perbedaan. - **Pembulatan.** Komputer tidak mendapatkan $\sin^2x+\cos^2x=1$ dengan tepat: selisihnya sekitar $10^{-16}$, jadi bandingkan dengan toleransi kecil, jangan pernah dengan kesamaan. Dekat $90^\circ$ tangen sangat besar, dan selisih dua bilangan yang sangat besar kehilangan angkanya, jadi penguji yang baik melewati titik yang bilangannya terlalu besar. Ketik klaim Anda sendiri di bawah, dalam derajat, dengan $x$ (dan $y$ untuk dua sudut). Ia membandingkan kedua ruas pada setiap derajat bulat dari $0^\circ$ sampai $359^\circ$ dan pada ratusan sudut lain. ## Adakah satu aturan di balik semua rumus ini? **Ada: rumus Euler $e^{i\theta}=\cos\theta+i\sin\theta$ memuat rumus jumlah, dan bersamanya semua yang lain dalam artikel ini.** Eksponensial memiliki aturan $e^{ix}\cdot e^{iy}=e^{i(x+y)}$. Tulis setiap faktor dengan rumus Euler dan kalikan, ingat $i^2=-1$: $$(\cos x+i\sin x)(\cos y+i\sin y)=(\cos x\cos y-\sin x\sin y)+i(\sin x\cos y+\cos x\sin y).$$ Ruas kiri adalah $e^{i(x+y)}=\cos(x+y)+i\sin(x+y)$. Dua bilangan kompleks sama hanya jika bagian real dan bagian imajinernya sama, jadi bagian real memberi rumus jumlah kosinus dan bagian imajiner memberi rumus jumlah sinus. Inilah rotasi pada bagian sebelumnya, karena mengalikan dengan $e^{iy}$ adalah memutar sebesar $y$. Memangkatkan memberi rumus de Moivre, $(\cos x+i\sin x)^n=\cos nx+i\sin nx$. Untuk $n=3$, menjabarkan ruas kiri memberi $\cos3x=\cos^3x-3\cos x\sin^2x$ dan $\sin3x=3\cos^2x\sin x-\sin^3x$, yaitu rumus sudut rangkap tiga yang ditulis dengan kedua fungsi (pakai $\sin^2x+\cos^2x=1$ untuk mendapat bentuk di atas). Tepat satu aturan tentang eksponen berada di balik seluruh daftar. ## Bagaimana memeriksa sebuah identitas dalam program? **Program memeriksa identitas dengan cuplikan: hitung kedua ruas pada banyak sudut dan laporkan selisih terbesar, yang seharusnya sekitar $10^{-16}$ untuk identitas yang benar dan besar untuk yang salah.** Tiga hal penting. Ubah derajat ke radian sebelum memanggil `sin` dan `cos`. Bandingkan dengan toleransi seperti $10^{-12}$ alih-alih `==`. Dan lewati sudut yang salah satu ruasnya tak terdefinisi (`tan` pada $90^\circ$ atau pembagian dengan nol) alih-alih menyebutnya perbedaan. Program di bawah mengukur selisih terbesar untuk empat klaim: $\sin^2x+\cos^2x=1$, $\sin2x=2\sin x\cos x$, yang salah $\sin2x=2\sin x$, dan $3\sin x+4\cos x=5\sin(x+53{,}13^\circ)$. Mereka mencetak apakah selisihnya di bawah toleransi (benar untuk identitas), dan untuk yang salah besar selisih dan tempat terbesarnya ($2{,}5981$ pada $120^\circ$). Untuk pembuktian simbolik atas pernyataan yang sama, pakai sistem aljabar komputer seperti SymPy: ia dapat menyederhanakan satu ruas menjadi ruas lain, yang tidak pernah dapat dilakukan cuplikan numerik. ```python import math def max_gap(f, g, n=3600): """The largest |f(x) - g(x)| over n + 1 angles from 0 to 360 degrees, and where it first happens.""" worst, at = 0.0, 0.0 for k in range(n + 1): x = 360 * k / n try: gap = abs(f(x) - g(x)) except ZeroDivisionError: continue # undefined here: skip the point, do not call it a difference if gap > worst: worst, at = gap, x return worst, at r = math.radians sin = lambda x: math.sin(r(x)) cos = lambda x: math.cos(r(x)) print(max_gap(lambda x: sin(x) ** 2 + cos(x) ** 2, lambda x: 1)[0] < 1e-12) # True print(max_gap(lambda x: sin(2 * x), lambda x: 2 * sin(x) * cos(x))[0] < 1e-12) # True print(max_gap(lambda x: sin(x + 25), lambda x: sin(x) * cos(25) + cos(x) * sin(25))[0] < 1e-12) # True gap, at = max_gap(lambda x: sin(2 * x), lambda x: 2 * sin(x)) print(round(gap, 4), at) # 2.5981 120.0: not an identity print(round(max_gap(lambda x: sin(x + 25), lambda x: sin(x) + sin(25))[0], 4)) # 0.8555: not an identity either R = math.hypot(3, 4) phi = math.degrees(math.atan2(4, 3)) print(round(R, 4), round(phi, 4)) # 5.0 53.1301 print(max_gap(lambda x: 3 * sin(x) + 4 * cos(x), lambda x: R * sin(x + phi))[0] < 1e-12) # True ``` ```javascript const r = (d) => (d * Math.PI) / 180 const sin = (x) => Math.sin(r(x)) const cos = (x) => Math.cos(r(x)) function maxGap(f, g, n = 3600) { // the largest |f(x) - g(x)| over n + 1 angles from 0 to 360 degrees, and where it first happens let worst = 0, at = 0 for (let k = 0; k <= n; k++) { const x = (360 * k) / n const gap = Math.abs(f(x) - g(x)) if (Number.isNaN(gap)) continue // undefined here: skip the point, do not call it a difference if (gap > worst) { worst = gap; at = x } } return [worst, at] } maxGap((x) => sin(x) ** 2 + cos(x) ** 2, () => 1)[0] < 1e-12 // true maxGap((x) => sin(2 * x), (x) => 2 * sin(x) * cos(x))[0] < 1e-12 // true maxGap((x) => sin(x + 25), (x) => sin(x) * cos(25) + cos(x) * sin(25))[0] < 1e-12 // true const [gap, at] = maxGap((x) => sin(2 * x), (x) => 2 * sin(x)) ;[+gap.toFixed(4), at] // [2.5981, 120]: not an identity +maxGap((x) => sin(x + 25), (x) => sin(x) + sin(25))[0].toFixed(4) // 0.8555: not an identity either const R = Math.hypot(3, 4), phi = (Math.atan2(4, 3) * 180) / Math.PI ;[+R.toFixed(4), +phi.toFixed(4)] // [5, 53.1301] maxGap((x) => 3 * sin(x) + 4 * cos(x), (x) => R * sin(x + phi))[0] < 1e-12 // true ``` ```cpp #include #include #include using namespace std; const double PI = 3.14159265358979323846; double worstAt; // where the largest gap is double rad(double d) { return d * PI / 180.0; } // the two sides of claim number "which", at x degrees double lhs(int which, double x) { double a = rad(x); if (which == 1) return sin(a) * sin(a) + cos(a) * cos(a); if (which == 2) return sin(2 * a); if (which == 3) return sin(2 * a); return 3 * sin(a) + 4 * cos(a); } double rhs(int which, double x) { double a = rad(x); if (which == 1) return 1; if (which == 2) return 2 * sin(a) * cos(a); if (which == 3) return 2 * sin(a); return 5 * sin(a + rad(53.13010235415598)); } double maxGap(int which) { double worst = 0; worstAt = 0; for (int k = 0; k <= 3600; k++) { double x = 360.0 * k / 3600.0; double gap = fabs(lhs(which, x) - rhs(which, x)); if (gap > worst) { worst = gap; worstAt = x; } } return worst; } int main() { printf("%d\n", maxGap(1) < 1e-12 ? 1 : 0); printf("%d\n", maxGap(2) < 1e-12 ? 1 : 0); printf("%.4f %.1f\n", maxGap(3), worstAt); printf("%d\n", maxGap(4) < 1e-9 ? 1 : 0); return 0; } /* output: 1 1 2.5981 120.0 1 */ ``` ## Dari mana identitas trigonometri berasal? **Rumus jumlah bermula sebagai teorema tentang tali busur pada lingkaran, menjadi alat untuk mengalikan bilangan besar sebelum logaritma, dan dilebur menjadi satu aturan tentang eksponensial pada abad kedelapan belas.** - **Sekitar 150 M.** Almagest Ptolemeus membuktikan teorema tentang sisi dan diagonal segi empat yang tertulis dalam lingkaran. Ia memberi tali busur jumlah atau selisih dua busur, yaitu rumus jumlah sinus dalam bahasa tali busur, dan Ptolemeus memakainya untuk menyusun tabelnya. - **Sekitar 500 M.** Astronom India menyatakan aturan untuk sinus dan kosinus jumlah, dan untuk sudut paruh, sebagai bagian dari tabel sinus mereka. - **Abad ke-16.** Prostaferesis: sebelum logaritma, para astronom (termasuk lingkaran Tycho Brahe) mengubah perkalian menjadi penjumlahan dengan $\cos x\cos y=\frac{\cos(x-y)+\cos(x+y)}{2}$, mencari ketiga kosinus dalam tabel. Logaritma Napier (1614) menggantikan metode itu. - **1722.** Rumus de Moivre, bentuk $(\cos x+i\sin x)^n=\cos nx+i\sin nx$, mengikat rumus sudut kelipatan dengan pangkat. - **1748.** Introductio karya Euler menjadikan notasi modern baku dan memberi $e^{ix}=\cos x+i\sin x$, yang darinya rumus jumlah mengikuti dalam dua baris. ## Apa kesalahan umum pada identitas trigonometri? **Kesalahan paling umum pada identitas trigonometri adalah sembilan hal berikut, masing-masing dengan pernyataan yang benar.** | Kesalahan | Yang benar | |---|---| | ❌ $\sin(x+y)=\sin x+\sin y$ | $\sin(x+y)=\sin x\cos y+\cos x\sin y$; pada $30^\circ$ dan $30^\circ$ yang benar memberi $0{,}866$ dan yang salah $1$. | | ❌ $\cos(x-y)=\cos x-\cos y$ | $\cos(x-y)=\cos x\cos y+\sin x\sin y$: tandanya berbalik antara rumus jumlah dan rumus selisih. | | ❌ $\sin2x=2\sin x$ | $\sin2x=2\sin x\cos x$; versi yang salah hanya berlaku pada $0^\circ$ dan $180^\circ$. | | ❌ $\sin\frac{x}{2}=\frac{\sin x}{2}$ | $\sin\frac{x}{2}=\pm\sqrt{\frac{1-\cos x}{2}}$, dengan tanda kuadran $\frac{x}{2}$. | | ❌ Mengambil $+\sqrt{\ }$ pada setiap rumus sudut paruh | Tandanya adalah tanda sinus atau kosinus di tempat $\frac{x}{2}$ berada: negatif di kuadran III dan IV untuk sinus. | | ❌ $\sin x^2=\sin^2x$ | $\sin^2x$ berarti $(\sin x)^2$; $\sin(x^2)$ adalah fungsi yang berbeda. | | ❌ Mencoret suku dari jumlah: $\frac{\sin x+\cos x}{\sin x}=\cos x$ | Hanya faktor yang dapat dicoret: hasilnya $1+\cot x$. | | ❌ Memindahkan suku melewati tanda sama dengan saat membuktikan | Kerjakan satu ruas saja; setiap baris harus sama dengan baris sebelumnya. | | ❌ Menguji satu sudut dan menyebutnya identitas | Kecocokan pada sebagian sudut tidak membuktikan apa-apa; satu contoh penyangkal membantah, dan hanya bukti yang memastikan. | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: identitas trigonometri sekilas - **Identitas:** benar di mana pun kedua ruas terdefinisi; rumus yang salah memerlukan satu contoh penyangkal, yang benar memerlukan bukti. - **Dasar:** $\sin^2x+\cos^2x=1$, $1+\tan^2x=\sec^2x$, $\tan x=\frac{\sin x}{\cos x}$, $\sin(90^\circ-x)=\cos x$, $\sin(-x)=-\sin x$, $\cos(-x)=\cos x$. - **Jumlah dan selisih:** $\sin(x\pm y)=\sin x\cos y\pm\cos x\sin y$, $\cos(x\pm y)=\cos x\cos y\mp\sin x\sin y$, dari memutar titik sebesar $y$. - **Ganda dan paruh:** $\sin2x=2\sin x\cos x$; $\cos2x=\cos^2x-\sin^2x$, juga $2\cos^2x-1$ dan $1-2\sin^2x$; $\sin^2\frac{x}{2}=\frac{1-\cos x}{2}$, $\cos^2\frac{x}{2}=\frac{1+\cos x}{2}$. - **Hasil kali dan jumlah:** $\sin x\cos y=\frac{\sin(x+y)+\sin(x-y)}{2}$ dan tiga yang lain; jumlah menjadi hasil kali dengan setengah jumlah dan setengah selisih. - **Satu gelombang:** $a\sin x+b\cos x=R\sin(x+\varphi)$, $R=\sqrt{a^2+b^2}$, $\varphi=\operatorname{atan2}(b,a)$. - **Membuktikan:** satu ruas saja, langkah sah, sinus dan kosinus bila buntu, Pythagoras ke dua arah, sebutkan daerah asal. - **Menguji:** bandingkan pada banyak sudut, toleransi bukan kesamaan, lewati titik tak terdefinisi; uji membantah tetapi tidak pernah membuktikan. - **Di balik semuanya:** $e^{ix}\cdot e^{iy}=e^{i(x+y)}$. ## Glosarium: istilah penting - **Identitas trigonometri**: Persamaan antara ekspresi trigonometri yang benar untuk setiap sudut yang kedua ruasnya terdefinisi. - **Contoh penyangkal**: Satu sudut yang membuat kedua ruas identitas yang diklaim berbeda, yang membuktikan klaim itu salah. - **Identitas Pythagoras**: Identitas sin kuadrat ditambah cos kuadrat sama dengan 1, yang menyatakan bahwa titik pada suatu sudut di lingkaran satuan berjarak 1 dari pusat. - **Rumus jumlah**: Rumus yang memberi sinus, kosinus, atau tangen x ditambah y dari fungsi x dan y, seperti sin(x + y) = sin x cos y + cos x sin y. - **Rumus sudut ganda**: Rumus sinus, kosinus, atau tangen 2x dalam fungsi x, yang diperoleh dengan memasang y sama dengan x pada rumus jumlah. - **Rumus sudut paruh**: Rumus sinus, kosinus, atau tangen x per 2, dengan akar kuadrat yang tandanya adalah tanda fungsi di kuadran x per 2. - **Rumus hasil kali menjadi jumlah**: Rumus yang menulis hasil kali dua sinus atau kosinus sebagai setengah jumlah, seperti sin x cos y = (sin(x + y) + sin(x - y)) / 2. - **Bentuk satu gelombang**: Penulisan ulang a sin x + b cos x sebagai R sin(x + phi) dengan R sama dengan akar dari a kuadrat ditambah b kuadrat. - **Daerah asal identitas**: Sudut-sudut yang membuat kedua ruas terdefinisi; identitas tidak menyatakan apa-apa tentang sudut tempat sebuah ruas tak terdefinisi. - **Prostaferesis**: Metode abad keenam belas yang memakai rumus hasil kali menjadi jumlah untuk mengganti perkalian dengan penjumlahan dan pencarian tabel. ## Pertanyaan yang sering diajukan ### Apa beda identitas trigonometri dan persamaan? Identitas benar untuk setiap sudut yang kedua ruasnya terdefinisi, seperti sin kuadrat ditambah cos kuadrat sama dengan 1. Persamaan hanya benar untuk sebagian sudut, seperti sinus x sama dengan setengah, sehingga diselesaikan, bukan dibuktikan. ### Apa rumus jumlah dan selisih untuk sinus dan kosinus? Sin x tambah y adalah sin x cos y tambah cos x sin y, dan cos x tambah y adalah cos x cos y kurang sin x sin y. Untuk selisih, ubah tanda pada rumus sinus dan balik tanda pada rumus kosinus. ### Bagaimana menurunkan rumus sudut ganda? Pasang y sama dengan x pada rumus jumlah: sin 2x adalah 2 sin x cos x dan cos 2x adalah cos kuadrat x kurang sin kuadrat x. Dengan sin kuadrat ditambah cos kuadrat sama dengan 1, cos 2x juga sama dengan 2 cos kuadrat x kurang 1 dan 1 kurang 2 sin kuadrat x. ### Apa rumus sudut paruh untuk sinus dan kosinus? Sinus kuadrat x per 2 adalah 1 kurang cos x, per 2, dan kosinus kuadrat x per 2 adalah 1 tambah cos x, per 2. Menarik akar kuadrat memerlukan tanda plus atau minus yang dipilih menurut kuadran x per 2. ### Bagaimana membuktikan identitas trigonometri? Mulailah dari satu ruas dan ubah, satu langkah sah pada satu waktu, menjadi ruas yang lain. Tulis ulang dalam sinus dan kosinus bila buntu, pakai identitas Pythagoras, dan jangan memindahkan suku melewati tanda sama dengan. ### Dapatkah identitas diperiksa dengan memasukkan bilangan? Hanya untuk membantahnya. Satu sudut yang membuat kedua ruas berbeda menunjukkan klaim itu salah, tetapi kecocokan pada sebagian sudut tidak membuktikan apa-apa: sin 2x dan 2 sin x sama pada 0 dan 180 derajat dan tidak sama secara umum. ### Bagaimana mengubah a sin x + b cos x menjadi satu sinus? Tulis sebagai R sin dari x tambah phi, dengan R akar dari a kuadrat tambah b kuadrat dan phi atan2 dari b dan a. Misalnya 3 sin x tambah 4 cos x sama dengan 5 sin dari x tambah 53,13 derajat. ### Rumus mana yang memberi nilai eksak seperti sin 15 derajat? Rumus selisih dan jumlah yang diterapkan pada 30, 45, dan 60 derajat, dan rumus sudut paruh. Sin 15 derajat adalah sin dari 45 kurang 30, yaitu akar 6 kurang akar 2, per 4. --- # Basic Trigonometry: Sine, Cosine and Tangent Source: https://nunada.my.id/articles/basic-trigonometry/ Updated: 2026-10-26 ## Quick answer **Trigonometry links the angles of a triangle to the lengths of its sides: in a right triangle, the sine of an angle is the opposite side over the hypotenuse, the cosine is the adjacent side over the hypotenuse, and the tangent is the opposite side over the adjacent side.** These ratios depend only on the angle, never on the size of the triangle, so one angle and one side give you every other side. The unit circle extends them to every angle, positive or negative. ### Key takeaways - For an acute angle $\theta$ of a right triangle: $\sin\theta=\frac{\text{opposite}}{\text{hypotenuse}}$, $\cos\theta=\frac{\text{adjacent}}{\text{hypotenuse}}$, $\tan\theta=\frac{\text{opposite}}{\text{adjacent}}$ (SOH-CAH-TOA). Their reciprocals are $\csc\theta$, $\sec\theta$ and $\cot\theta$. Two right triangles with the same angle are similar, so the ratios do not depend on the size. - To find a missing side, pick the ratio that holds the side you know and the side you want, and solve; to find an angle, use the inverse function ($\arcsin$, $\arccos$, $\arctan$). Always check the calculator mode: degrees for a problem in degrees. - The exact values at $30^\circ$, $45^\circ$ and $60^\circ$ come from half an equilateral triangle and half a square: $\sin30^\circ=\frac12$, $\sin45^\circ=\frac{\sqrt2}{2}$, $\sin60^\circ=\frac{\sqrt3}{2}$, with the cosines in reverse order, and $\tan$ is $\frac{\sqrt3}{3}$, $1$, $\sqrt3$. - On the unit circle the point at angle $\theta$ is $(\cos\theta,\sin\theta)$. That defines the functions for every angle, with signs by quadrant (all positive in I, sine in II, tangent in III, cosine in IV) and the value equal to the value at the reference angle, up to sign. Sine and cosine repeat every $360^\circ$, tangent every $180^\circ$. - The basic identities are $\sin^2\theta+\cos^2\theta=1$, $\tan\theta=\frac{\sin\theta}{\cos\theta}$, $\sin(90^\circ-\theta)=\cos\theta$, $\sin2\theta=2\sin\theta\cos\theta$ and $\sin(\alpha+\beta)=\sin\alpha\cos\beta+\cos\alpha\sin\beta$. The tempting ones such as $\sin(\alpha+\beta)=\sin\alpha+\sin\beta$ are false: one lucky angle does not prove an identity. - The equation $\sin x=c$ has two solutions between $0^\circ$ and $360^\circ$ (the angle and its mirror image), $\cos x=c$ has two, and $\tan x=c$ has two a half turn apart. The graph of $y=a\sin(b(x-c))+d$ has amplitude $|a|$, period $\frac{360^\circ}{b}$, phase shift $c$ and midline $y=d$. In code, convert degrees to radians, and prefer `atan2` to find an angle. ## What are sine, cosine and tangent? **Trigonometry is the part of mathematics that connects the angles of a triangle with the lengths of its sides; its three basic tools are the sine, the cosine and the tangent of an angle.** The name comes from the Greek for triangle measure. It starts with the right triangle, the one with a $90^\circ$ angle. Pick one of the two acute angles and call it $\theta$. The three sides now have names relative to $\theta$: - the **hypotenuse** is the side opposite the right angle, always the longest; - the **opposite** side is the one across from $\theta$; - the **adjacent** side is the other leg, the one that touches $\theta$. *The sides of a right triangle named from the angle $\theta$: $a$ is the opposite side, $b$ the adjacent side and $c$ the hypotenuse. Then $\sin\theta=\frac{a}{c}$, $\cos\theta=\frac{b}{c}$ and $\tan\theta=\frac{a}{b}$.* Then the three ratios are $$\sin\theta=\frac{\text{opposite}}{\text{hypotenuse}},\qquad \cos\theta=\frac{\text{adjacent}}{\text{hypotenuse}},\qquad \tan\theta=\frac{\text{opposite}}{\text{adjacent}}.$$ A way to remember them is SOH-CAH-TOA: Sine is Opposite over Hypotenuse, Cosine is Adjacent over Hypotenuse, Tangent is Opposite over Adjacent. There are also three reciprocals: the cosecant $\csc\theta=\frac{1}{\sin\theta}$, the secant $\sec\theta=\frac{1}{\cos\theta}$ and the cotangent $\cot\theta=\frac{1}{\tan\theta}$. **Why does this make sense?** Two right triangles that share the angle $\theta$ have all three angles equal, so they are similar: one is an enlargement of the other, and the ratio of two sides stays the same. So $\sin\theta$ is a number that belongs to the angle, not to the triangle: it is the same for a triangle on paper and for one the size of a tower. Because the hypotenuse is the longest side, $\sin\theta$ and $\cos\theta$ of an acute angle are always between $0$ and $1$. *Two right triangles with the same angle $\theta$. Every side of the larger one is twice the matching side of the smaller one, so $\sin\theta=\frac35=\frac{6}{10}$ in both: the ratio belongs to the angle, not to the size of the triangle.* Two more facts follow at once. The other acute angle is $90^\circ-\theta$, and the opposite and adjacent sides swap when you look from it, so $\sin(90^\circ-\theta)=\cos\theta$. And by the [Pythagorean theorem](https://nunada.my.id/articles/pythagorean-theorem/#what-is-the-theorem), $\text{opposite}^2+\text{adjacent}^2=\text{hypotenuse}^2$; divide by the hypotenuse squared and you get $\sin^2\theta+\cos^2\theta=1$. Try it: move the angle and the size, and switch the angle you look from. ## How do you find a missing side or angle of a right triangle? **To find a missing side, choose the ratio that contains the side you know and the side you want, write it down and solve for the unknown; to find a missing angle, use the inverse function of that ratio.** Any right triangle can be solved from an angle and a side, or from two sides. 1. Draw the triangle and mark the angle $\theta$ you are using. 2. Name the sides relative to $\theta$: opposite, adjacent, hypotenuse. 3. Pick the ratio that holds the known side and the unknown side: opposite and hypotenuse mean sine, adjacent and hypotenuse mean cosine, opposite and adjacent mean tangent. 4. Write the equation, for example $\sin\theta=\frac{\text{opposite}}{\text{hypotenuse}}$, and solve it: multiply to find a side, or take the inverse function ($\arcsin$, $\arccos$, $\arctan$) to find an angle. 5. Check that the hypotenuse is the longest side, and that $\text{opposite}^2+\text{adjacent}^2=\text{hypotenuse}^2$. **Example, a side.** You stand $40$ m from the foot of a tower and see its top at an angle of elevation of $35^\circ$ (the angle above the horizontal). The known side is the adjacent $40$ and the unknown is the opposite, so the tangent is the right ratio: $\tan35^\circ=\frac{h}{40}$, hence $h=40\tan35^\circ\approx28.01$ m. (Add the height of your eye to get the height of the tower.) Looking down from a tower to a boat uses the angle of depression, measured below the horizontal; it equals the angle of elevation seen from the boat. *The tower problem: from $40$ m away you see the top at an angle of elevation of $35^\circ$. The height above your eye is $h=40\tan35^\circ\approx28$ m. (The drawing uses $10$ units for $40$ m.)* **Example, an angle.** A road rises $8$ m over a horizontal distance of $100$ m. Then $\tan\theta=\frac{8}{100}$, so $\theta=\arctan0.08\approx4.57^\circ$. A grade of $8\%$ is exactly this tangent. **Example, a ladder.** A $5$ m ladder leans against a wall at $70^\circ$ to the ground. The hypotenuse is $5$, so it reaches $5\sin70^\circ\approx4.70$ m up the wall, and its foot is $5\cos70^\circ\approx1.71$ m from the wall. The inverse functions are the subject of [their own article](https://nunada.my.id/articles/inverse-trigonometric-functions/#definitions): $\arcsin x$ is the angle between $-90^\circ$ and $90^\circ$ whose sine is $x$. For a triangle that is not a right triangle, use the law of sines and the law of cosines ([solving a triangle](https://nunada.my.id/articles/triangles/#solve-a-triangle)). The solver below takes any pair of measurements and also has these examples ready. ## What are the exact values of sine and cosine at 30°, 45° and 60°? **The exact values at $30^\circ$, $45^\circ$ and $60^\circ$ come from two triangles you can draw: half of an equilateral triangle, and half of a square.** Half of an equilateral triangle. Take an equilateral triangle with side $2$ and cut it in half along a height. You get a right triangle with angles $30^\circ$, $60^\circ$ and $90^\circ$, hypotenuse $2$, the short leg $1$ (half of the base) and the long leg $\sqrt{2^2-1^2}=\sqrt3$. Read the ratios: $\sin30^\circ=\frac12$, $\cos30^\circ=\frac{\sqrt3}{2}$, $\tan30^\circ=\frac{1}{\sqrt3}=\frac{\sqrt3}{3}$, and from the other angle $\sin60^\circ=\frac{\sqrt3}{2}$, $\cos60^\circ=\frac12$, $\tan60^\circ=\sqrt3$. *An equilateral triangle of side $2$ cut along its height. Each half is a right triangle with angles $30^\circ$, $60^\circ$, $90^\circ$ and sides $1$, $\sqrt3$, $2$ (the long leg is $\sqrt{2^2-1^2}=\sqrt3$).* Half of a square. Cut a square of side $1$ along a diagonal. You get a right triangle with two angles of $45^\circ$, legs $1$ and hypotenuse $\sqrt2$. So $\sin45^\circ=\cos45^\circ=\frac{1}{\sqrt2}=\frac{\sqrt2}{2}$ and $\tan45^\circ=1$. *A square of side $1$ cut along a diagonal. Each half is a right triangle with two angles of $45^\circ$ and sides $1$, $1$, $\sqrt2$, so $\sin45^\circ=\cos45^\circ=\frac{1}{\sqrt2}=\frac{\sqrt2}{2}$ and $\tan45^\circ=1$.* | $\theta$ | $0^\circ$ | $30^\circ$ | $45^\circ$ | $60^\circ$ | $90^\circ$ | |---|---|---|---|---|---| | $\sin\theta$ | $0$ | $\frac12$ | $\frac{\sqrt2}{2}$ | $\frac{\sqrt3}{2}$ | $1$ | | $\cos\theta$ | $1$ | $\frac{\sqrt3}{2}$ | $\frac{\sqrt2}{2}$ | $\frac12$ | $0$ | | $\tan\theta$ | $0$ | $\frac{\sqrt3}{3}$ | $1$ | $\sqrt3$ | undefined | **A pattern to remember.** Write the sines of $0^\circ,30^\circ,45^\circ,60^\circ,90^\circ$ as $\frac{\sqrt0}{2},\frac{\sqrt1}{2},\frac{\sqrt2}{2},\frac{\sqrt3}{2},\frac{\sqrt4}{2}$; the cosines are the same list backwards, and the tangent is the sine divided by the cosine. The angle $0^\circ$ is a degenerate triangle with no height ($\sin0^\circ=0$) and at $90^\circ$ the adjacent side shrinks to nothing, so $\tan90^\circ=\frac{1}{0}$ has no value. The multiples of $15^\circ$ need a little more: $\sin15^\circ=\frac{\sqrt6-\sqrt2}{4}$, $\cos15^\circ=\frac{\sqrt6+\sqrt2}{4}$ and $\tan15^\circ=2-\sqrt3$, which follow from the angle formulas below ($15^\circ=45^\circ-30^\circ$). The unit circle further down gives the exact value of all of them. These triangles are also the ones from [right triangles](https://nunada.my.id/articles/triangles/#right-triangles), where their sides appear as the ratios $1:1:\sqrt2$ and $1:\sqrt3:2$. ## How does the unit circle give sine and cosine for every angle? **On the unit circle, the circle of radius $1$ around the origin, the point reached by turning through an angle $\theta$ from the positive $x$-axis is $(\cos\theta,\sin\theta)$.** This is the definition that works for every angle. For an acute angle it agrees with the triangle: drop a perpendicular from the point to the $x$-axis, and the right triangle has hypotenuse $1$, so the adjacent side is $\cos\theta$ and the opposite side is $\sin\theta$. Positive angles turn counterclockwise, negative angles clockwise (see [how angles are measured](https://nunada.my.id/articles/angles/#units)), and $\tan\theta=\frac{\sin\theta}{\cos\theta}$ wherever the cosine is not $0$. *The unit circle. The point at the angle $\theta$ is $(\cos\theta,\sin\theta)$: the radius is the hypotenuse, of length $1$, the horizontal leg is $\cos\theta$ and the vertical leg is $\sin\theta$. Pythagoras gives $\sin^2\theta+\cos^2\theta=1$.* Three things follow. **Signs by quadrant.** The sign of $\cos\theta$ is the sign of the $x$-coordinate and the sign of $\sin\theta$ that of the $y$-coordinate: | Quadrant | Angles | $\sin$ | $\cos$ | $\tan$ | |---|---|---|---|---| | I | $0^\circ$ to $90^\circ$ | $+$ | $+$ | $+$ | | II | $90^\circ$ to $180^\circ$ | $+$ | $-$ | $-$ | | III | $180^\circ$ to $270^\circ$ | $-$ | $-$ | $+$ | | IV | $270^\circ$ to $360^\circ$ | $-$ | $+$ | $-$ | In words: all three are positive in I, only sine in II, only tangent in III and only cosine in IV (English speakers remember it as "All Students Take Calculus"). **Reference angles.** The reference angle of $\theta$ is the acute angle between its terminal side and the $x$-axis. By symmetry, each function at $\theta$ has the absolute value it has at the reference angle, and the sign is given by the quadrant. 1. Find the reference angle: $\theta$ in quadrant II gives $180^\circ-\theta$, in III gives $\theta-180^\circ$, in IV gives $360^\circ-\theta$. 2. Read the value at the reference angle (the table in the previous section). 3. Put the sign of the quadrant in front. For example $\sin210^\circ$: it is in quadrant III, the reference angle is $30^\circ$, and sine is negative there, so $\sin210^\circ=-\frac12$. And $\cos120^\circ=-\cos60^\circ=-\frac12$, $\tan135^\circ=-\tan45^\circ=-1$. *The angle $150^\circ$ is in quadrant II. Its reference angle is $180^\circ-150^\circ=30^\circ$, so $\sin150^\circ=\sin30^\circ=\frac12$ (positive there) and $\cos150^\circ=-\cos30^\circ=-\frac{\sqrt3}{2}$ (negative there). The signs written in each quadrant are those of $\sin$, $\cos$ and $\tan$, in that order.* **Periodicity and negative angles.** A full turn changes nothing, so $\sin(\theta+360^\circ)=\sin\theta$ and the same for cosine; the tangent repeats after a half turn, $\tan(\theta+180^\circ)=\tan\theta$. Turning the other way mirrors the point in the $x$-axis: $\sin(-\theta)=-\sin\theta$ and $\cos(-\theta)=\cos\theta$. So $\sin(-30^\circ)=-\frac12$ and $\cos(-30^\circ)=\frac{\sqrt3}{2}$. (Mathematicians measure the same turn in radians, where $360^\circ=2\pi$.) Move the angle below, from $-360^\circ$ to $720^\circ$, and watch the point, the signs and the exact values. ## How do you solve sin x = c, cos x = c and tan x = c? **To solve $\sin x=c$, $\cos x=c$ or $\tan x=c$, find one angle with the inverse function, find its mirror image on the unit circle, and add whole turns to both.** The reason there is a second angle is that two points of the unit circle have the same height (the same sine), two have the same $x$-coordinate (the same cosine), and two opposite points give the same tangent. 1. If $c$ is outside $-1\le c\le1$ for sine or cosine, there is no solution. 2. Find the principal angle $\alpha$ with the inverse function ($\arcsin c$, $\arccos c$ or $\arctan c$). 3. Find the second angle between $0^\circ$ and $360^\circ$ from the symmetry: - sine: $x=\alpha$ and $x=180^\circ-\alpha$; - cosine: $x=\alpha$ and $x=360^\circ-\alpha$ (that is, $\pm\alpha$); - tangent: $x=\alpha$ and $x=\alpha+180^\circ$. 4. Add whole turns for all the solutions: $360^\circ k$ for sine and cosine, $180^\circ k$ for tangent, where $k$ is any whole number. 5. Check the answers by substituting. **Example.** $\sin x=\frac12$. The principal angle is $\alpha=30^\circ$, so the solutions between $0^\circ$ and $360^\circ$ are $30^\circ$ and $180^\circ-30^\circ=150^\circ$; in general $x=30^\circ+360^\circ k$ or $x=150^\circ+360^\circ k$. For $\cos x=-\frac{\sqrt2}{2}$ the principal angle is $135^\circ$, and the solutions are $135^\circ$ and $225^\circ$. For $\tan x=\sqrt3$ they are $60^\circ$ and $240^\circ$. A calculator or program gives only the principal value ($\arcsin$ returns an angle between $-90^\circ$ and $90^\circ$), so the second solution is yours to find. The same method solves harder equations once they are brought to this form, for instance $2\sin^2x=\sin x$ becomes $\sin x\,(2\sin x-1)=0$, so $\sin x=0$ or $\sin x=\frac12$. Multiple angles, quadratic equations and false roots are in [the article on trigonometric equations](https://nunada.my.id/articles/trigonometric-equations/). *The equation $\sin x=\frac12$. The line $y=\frac12$ cuts the sine wave between $0^\circ$ and $360^\circ$ at two points, $x=30^\circ$ and $x=180^\circ-30^\circ=150^\circ$; every further turn adds $360^\circ$.* ## What are the basic trigonometric identities? **A trigonometric identity is an equation that is true for every angle for which both sides are defined, which makes it different from an equation, which is true only for some angles.** $\sin x=\frac12$ is an equation (it holds at $30^\circ$ and $150^\circ$ and so on); $\sin^2x+\cos^2x=1$ is an identity (it holds always). These are the ones to know. | Name | Identity | |---|---| | Pythagorean | $\sin^2x+\cos^2x=1$ and $1+\tan^2x=\frac{1}{\cos^2x}$ | | Quotient and reciprocal | $\tan x=\frac{\sin x}{\cos x}$, $\csc x=\frac{1}{\sin x}$, $\sec x=\frac{1}{\cos x}$, $\cot x=\frac{1}{\tan x}$ | | Cofunction | $\sin(90^\circ-x)=\cos x$ and $\cos(90^\circ-x)=\sin x$ | | Supplement and negative angle | $\sin(180^\circ-x)=\sin x$, $\sin(-x)=-\sin x$, $\cos(-x)=\cos x$ | | Double angle | $\sin2x=2\sin x\cos x$ and $\cos2x=\cos^2x-\sin^2x$ | | Sum | $\sin(x+y)=\sin x\cos y+\cos x\sin y$ and $\cos(x+y)=\cos x\cos y-\sin x\sin y$ | Where they come from. The Pythagorean identity is the equation of the unit circle, $x^2+y^2=1$, with $x=\cos\theta$ and $y=\sin\theta$; divide it by $\cos^2x$ for the second form. The cofunction identity says that the sine of an angle is the cosine of its complement (the two acute angles of a right triangle). The double-angle formulas are the sum formulas with $y=x$, and the sum formulas can be proved from the geometry of the unit circle. With them you get exact values beyond the table, for example $\sin75^\circ=\sin(45^\circ+30^\circ)$, which by the sum formula is $\frac{\sqrt2}{2}\cdot\frac{\sqrt3}{2}+\frac{\sqrt2}{2}\cdot\frac12$, that is $\frac{\sqrt6+\sqrt2}{4}$. **An identity is not proved by trying a number.** The tempting formulas $\sin(x+y)=\sin x+\sin y$, $\sin2x=2\sin x$ and $\sin x+\cos x=1$ are false, yet each is true at a few angles: $\sin2x=2\sin x$ holds at $x=0^\circ$ and $x=180^\circ$, and a single lucky test would convince you. A false identity is refuted by one counterexample ($\sin(30^\circ+60^\circ)=1$ but $\sin30^\circ+\sin60^\circ\approx1.366$); a true one has to be proved, with algebra or geometry. The tester below compares both sides over all $360$ whole degrees. The sum, double-angle and half-angle formulas, with their proofs and a strategy for proving identities, are in [the article on trigonometric identities](https://nunada.my.id/articles/trigonometric-identities/#sum-and-difference). ## What do the graphs of sine and cosine look like? **The graphs of $y=\sin x$ and $y=\cos x$ are waves that repeat every $360^\circ$ and oscillate between $-1$ and $1$; the cosine is the sine shifted left by $90^\circ$.** Plot the height of the point on the unit circle against the angle and you get the sine wave: it starts at $0$, rises to $1$ at $90^\circ$, falls through $0$ at $180^\circ$ to $-1$ at $270^\circ$ and is back at $0$ at $360^\circ$. The tangent has a different shape: it repeats every $180^\circ$ and blows up near $90^\circ$ and $270^\circ$, where the cosine is $0$. *One turn of the sine wave (solid) and of the cosine wave (dashed). The cosine is the sine shifted $90^\circ$ to the left. Both oscillate between $-1$ and $1$ and repeat every $360^\circ$.* Every wave of the form $y=a\sin(b(x-c))+d$ (or with the cosine) is described by four numbers: - the **amplitude** $|a|$, the distance from the middle line to a peak; a negative $a$ flips the wave upside down; - the **period** $\frac{360^\circ}{b}$, the length of one full cycle (in radians, $\frac{2\pi}{b}$); a larger $b$ squeezes the wave; - the **phase shift** $c$, how far the wave is moved to the right; - the **midline** $y=d$, the height around which it oscillates; the maximum is $d+|a|$ and the minimum $d-|a|$. **Example.** $y=2\sin(3x)+1$: amplitude $2$, period $\frac{360^\circ}{3}=120^\circ$, no shift, midline $y=1$, maximum $3$, minimum $-1$. The zeros are where $\sin3x=-\frac12$. *The graph of $y=2\sin3x+1$. The midline is $y=1$ (dashed), the amplitude is $2$ (from the midline up to the peak at $y=3$) and the period is $\frac{360^\circ}{3}=120^\circ$ (the bar at the bottom).* Waves of this shape describe anything that goes round and round or back and forth: the height of a tide, a swinging pendulum, a sound of one pure pitch, alternating current, the seasons of daylight. Their slopes are another wave, which is the subject of [the derivatives of sine and cosine](https://nunada.my.id/articles/derivatives-of-trigonometric-functions/#sine-and-cosine). The graphs of the other four functions, how to sketch and read these waves, and how to add them are in [the article on trigonometric graphs](https://nunada.my.id/articles/trigonometric-graphs/). Change the four numbers below and watch the table. ## Where is trigonometry used? **Trigonometry is used wherever you cannot measure a length or a direction directly but can measure an angle, or wherever something turns or oscillates.** - **Heights and distances.** The height of a tower, a tree or a mountain, the width of a river, the distance to a ship: one angle and one measured length give the rest (surveying works exactly like this, with a theodolite to measure the angles). - **Slopes.** The gradient of a road or a roof is the tangent of its angle; a ramp for a wheelchair should not exceed about $5^\circ$. - **Navigation.** A bearing is an angle from north (see [directions and bearings](https://nunada.my.id/articles/angles/#directions)); the components of a course east and north are $d\sin\theta$ and $d\cos\theta$ for a bearing $\theta$. - **Physics and engineering.** A force or velocity at angle $\theta$ has components $F\cos\theta$ and $F\sin\theta$; a block on a slope feels $mg\sin\theta$ along it. - **Waves and signals.** Sound, light, radio, alternating current and tides are sums of sine waves. - **Computers.** A point rotated by $\theta$ about the origin goes to $(x\cos\theta-y\sin\theta,\ x\sin\theta+y\cos\theta)$, the basis of graphics, games and robot arms; the position of a point on a circle is $(r\cos\theta,\ r\sin\theta)$. All of it rests on the same picture: a right triangle, or the point on the unit circle. ## How do you use trigonometry in code? **Every programming language takes angles in radians, so convert first: `math.sin(math.radians(30))` in Python, `Math.sin(30 Math.PI / 180)` in JavaScript, `sin(30 PI / 180)` in C++.** Forgetting this is the most common error: `math.sin(30)` is the sine of $30$ radians, about $-0.988$. The second trap is rounding. Because $\pi$ is stored with a small error, the values you expect to be exact are not: `math.sin(math.radians(30))` gives `0.49999999999999994`, `math.cos(math.radians(90))` gives `6.1e-17` instead of $0$, and `math.tan(math.radians(90))` gives about $1.6\times10^{16}$ instead of "undefined". Compare with a tolerance, never with `==`, or fold the angle to a reference angle between $0^\circ$ and $90^\circ$ first, as the function `sin_deg` below does. To go the other way, use the inverse functions, and prefer `atan2(opposite, adjacent)` to `atan(opposite / adjacent)`: it gets the quadrant right and does not divide by zero (see [the angle between two vectors](https://nunada.my.id/articles/angles/#between-lines-and-vectors)). The program solves the tower and the road of the examples, the $3$-$4$-$5$ triangle and the equation $\sin x=\frac12$. ```python import math def sin_deg(d): """Sine of an angle in degrees: fold to a reference angle first, so 30 and 90 come out exact.""" n = d % 360 ref, sign = (n, 1) if n <= 90 else (180 - n, 1) if n <= 180 else (n - 180, -1) if n <= 270 else (360 - n, -1) v = {0: 0.0, 30: 0.5, 90: 1.0}.get(ref, math.sin(math.radians(ref))) return sign * v if v else 0.0 def cos_deg(d): return sin_deg(90 - d) print(math.sin(math.radians(30)), sin_deg(30)) # 0.49999999999999994 0.5 print(math.cos(math.radians(90)), cos_deg(90)) # 6.123233995736766e-17 0.0 print(math.tan(math.radians(90))) # 1.633123935319537e+16, not "undefined" print(round(40 * math.tan(math.radians(35)), 2)) # 28.01: the tower seen at 35 degrees from 40 m print(round(math.degrees(math.atan2(8, 100)), 2)) # 4.57: the road that rises 8 m in 100 m print(round(math.degrees(math.atan2(3, 4)), 4), math.hypot(3, 4)) # 36.8699 5.0 x = math.degrees(math.asin(0.5)) # the principal value of sin x = 1/2 print(round(x, 6), round(180 - x, 6)) # 30.0 150.0: the mirror image is yours to add print(round(math.sin(math.radians(75)), 6), round((math.sqrt(6) + math.sqrt(2)) / 4, 6)) # 0.965926 0.965926 print(sin_deg(210), sin_deg(-30), cos_deg(120)) # -0.5 -0.5 -0.5 ``` ```javascript const rad = (d) => (d * Math.PI) / 180 const deg = (r) => (r * 180) / Math.PI function sinDeg(d) { const n = ((d % 360) + 360) % 360 // JavaScript's % keeps the sign of d, so fix it const [ref, sign] = n <= 90 ? [n, 1] : n <= 180 ? [180 - n, 1] : n <= 270 ? [n - 180, -1] : [360 - n, -1] const v = ref === 0 ? 0 : ref === 30 ? 0.5 : ref === 90 ? 1 : Math.sin(rad(ref)) return v === 0 ? 0 : sign * v } const cosDeg = (d) => sinDeg(90 - d) ;[Math.sin(rad(30)), sinDeg(30)] // [0.49999999999999994, 0.5] ;[Math.cos(rad(90)), cosDeg(90)] // [6.123233995736766e-17, 0] Math.tan(rad(90)) // 16331239353195370, not "undefined" +(40 * Math.tan(rad(35))).toFixed(2) // 28.01 +deg(Math.atan2(8, 100)).toFixed(2) // 4.57 ;[deg(Math.asin(0.5)), 180 - deg(Math.asin(0.5))].map((x) => +x.toFixed(6)) // [30, 150] ;[sinDeg(210), sinDeg(-30), cosDeg(120)] // [-0.5, -0.5, -0.5] ``` ```cpp #include #include #include using namespace std; const double PI = 3.14159265358979323846; double radians(double d) { return d * PI / 180.0; } double sinDeg(double d) { double n = d - 360.0 * floor(d / 360.0); // into [0, 360) double ref = n; double sign = 1; if (n > 270) { ref = 360 - n; sign = -1; } else if (n > 180) { ref = n - 180; sign = -1; } else if (n > 90) { ref = 180 - n; } double v; if (ref == 0) v = 0; else if (ref == 30) v = 0.5; else if (ref == 90) v = 1; else v = sin(radians(ref)); return v == 0 ? 0 : sign * v; } double cosDeg(double d) { return sinDeg(90 - d); } int same(double a, double b) { return a == b ? 1 : 0; } int main() { printf("%d %d\n", same(sin(radians(30)), 0.5), same(sinDeg(30), 0.5)); printf("%d %d\n", same(cos(radians(90)), 0), same(cosDeg(90), 0)); printf("%.2f\n", 40 * tan(radians(35))); printf("%.2f\n", atan2(8, 100) * 180 / PI); printf("%.4f %.4f\n", sinDeg(210), cosDeg(120)); printf("%.6f %.6f\n", asin(0.5) * 180 / PI, 180 - asin(0.5) * 180 / PI); return 0; } /* output: 0 1 0 1 28.01 4.57 -0.5000 -0.5000 30.000000 150.000000 */ ``` ## Where does trigonometry come from? **Trigonometry began as the astronomy of chords, grew sines and cosines in India and the Islamic world, and became the functions we write today in the eighteenth century.** - **About 150 BC.** Hipparchus builds the first table of chords (the length of the segment joining two points of a circle for a given angle), to predict the positions of the Sun and Moon. Around 150 AD, Ptolemy's Almagest has a chord table for every half degree. - **About 500 AD.** Indian astronomers such as Aryabhata work with the half-chord instead, the jya, which is our sine, and tabulate it; the cosine appears as the sine of the complement. - **About 800 to 1000.** In the Islamic world, scholars including al-Khwarizmi and Abu al-Wafa extend the tables and use all six functions, and al-Battani replaces the Greek chords by sines in his astronomy. - **12th century.** Latin translators render the Arabic jayb (a mis-reading of the Sanskrit jya) as sinus, which means "fold" or "bay": that is how the word sine got its name. - **1464.** Regiomontanus writes De triangulis omnimodis, the first European book on trigonometry as a subject of its own, apart from astronomy. - **1595.** Bartholomaeus Pitiscus publishes Trigonometria and gives the subject its name. - **1748.** Euler's Introductio in analysin infinitorum fixes the modern notation (sin, cos, tan) and treats them as functions of a number, which opens the way to calculus and to waves. ## What are the common mistakes in trigonometry? **The most common mistakes in trigonometry are the nine below, each with the correct statement.** | Mistake | Correct | |---|---| | ❌ Use the calculator or program in the wrong mode | Degrees for degrees, radians for radians; check that $\sin30$ gives $0.5$ in degree mode. | | ❌ $\sin(x+y)=\sin x+\sin y$ | $\sin(x+y)=\sin x\cos y+\cos x\sin y$; for $30^\circ$ and $60^\circ$ the first gives $1$ and the wrong one $1.366$. | | ❌ $\sin2x=2\sin x$ | $\sin2x=2\sin x\cos x$; the wrong version only works at $0^\circ$ and $180^\circ$. | | ❌ $\sin^{-1}x$ means $\frac{1}{\sin x}$ | $\sin^{-1}x$ is the inverse function $\arcsin x$; the reciprocal is $\csc x$. | | ❌ Opposite and adjacent are fixed sides | They depend on the angle you look from; they swap when you look from the other acute angle. | | ❌ $\tan90^\circ=\infty$ or $0$ | It is undefined: $\tan90^\circ=\frac{\sin90^\circ}{\cos90^\circ}=\frac10$. | | ❌ A big triangle has a bigger sine | The ratios depend only on the angle; for an acute angle the sine is between $0$ and $1$. | | ❌ $\sin150^\circ$ is negative because $150^\circ>90^\circ$ | It is in quadrant II, where sine is positive: $\sin150^\circ=\sin30^\circ=\frac12$. | | ❌ $\sin x=\frac12$ has only the solution $30^\circ$ | There are two between $0^\circ$ and $360^\circ$: $30^\circ$ and $150^\circ$ (and every turn more). | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: basic trigonometry at a glance - **Ratios:** $\sin\theta=\frac{\text{opp}}{\text{hyp}}$, $\cos\theta=\frac{\text{adj}}{\text{hyp}}$, $\tan\theta=\frac{\text{opp}}{\text{adj}}$ (SOH-CAH-TOA); reciprocals $\csc$, $\sec$, $\cot$; they depend only on the angle (similar triangles). - **Solve a right triangle:** one angle and one side, or two sides; pick the ratio with the known and unknown sides; inverse functions for angles; check with Pythagoras. - **Special angles:** $\sin30^\circ=\frac12$, $\sin45^\circ=\frac{\sqrt2}{2}$, $\sin60^\circ=\frac{\sqrt3}{2}$; cosines in reverse; $\tan$: $\frac{\sqrt3}{3}$, $1$, $\sqrt3$; $\tan90^\circ$ undefined. - **Unit circle:** the point at angle $\theta$ is $(\cos\theta,\sin\theta)$; signs: all, sine, tangent, cosine in quadrants I to IV; reference angle; period $360^\circ$ (tangent $180^\circ$); $\sin(-\theta)=-\sin\theta$, $\cos(-\theta)=\cos\theta$. - **Equations:** $\sin x=c$: $\alpha$ and $180^\circ-\alpha$; $\cos x=c$: $\pm\alpha$; $\tan x=c$: $\alpha$ and $\alpha+180^\circ$; add turns. - **Identities:** $\sin^2x+\cos^2x=1$, $\tan x=\frac{\sin x}{\cos x}$, $\sin(90^\circ-x)=\cos x$, $\sin2x=2\sin x\cos x$, $\sin(x+y)=\sin x\cos y+\cos x\sin y$; a counterexample refutes, a proof is needed to confirm. - **Graphs:** $y=a\sin(b(x-c))+d$ has amplitude $|a|$, period $\frac{360^\circ}{b}$, phase shift $c$, midline $d$. - **Code:** radians for `sin` and `cos`; compare with a tolerance; `atan2` for angles; the inverse functions give only one solution. ## Glossary: key terms - **Trigonometry**: The branch of mathematics that relates the angles of a triangle to the lengths of its sides, through the sine, cosine and tangent. - **Hypotenuse**: The side of a right triangle opposite the right angle, and its longest side. - **Sine**: For an acute angle of a right triangle, the length of the opposite side divided by the hypotenuse; on the unit circle, the y-coordinate of the point at that angle. - **Cosine**: For an acute angle of a right triangle, the adjacent side divided by the hypotenuse; on the unit circle, the x-coordinate of the point at that angle. - **Tangent**: The opposite side divided by the adjacent side, which equals sine divided by cosine; it is undefined where the cosine is zero. - **Unit circle**: The circle of radius 1 centered at the origin, used to define sine and cosine for every angle. - **Reference angle**: The acute angle between the terminal side of an angle and the x-axis; the functions at the angle equal those at the reference angle up to sign. - **Angle of elevation**: The angle above the horizontal at which you look up at an object; the angle of depression is the same angle measured below the horizontal. - **Trigonometric identity**: An equation involving trigonometric functions that is true for every angle at which both sides are defined, such as sin squared plus cos squared equals 1. - **Amplitude and period**: For a sine or cosine wave, the amplitude is the height from the midline to a peak, and the period is the length of one full cycle. ## Frequently asked questions ### What are sine, cosine and tangent? They are the three basic ratios of a right triangle for one of its acute angles: sine is opposite over hypotenuse, cosine is adjacent over hypotenuse and tangent is opposite over adjacent. They depend only on the angle. ### What does SOH-CAH-TOA mean? It is a memory aid: Sine is Opposite over Hypotenuse, Cosine is Adjacent over Hypotenuse, Tangent is Opposite over Adjacent. The sides are named from the angle you are looking at. ### How do you find a side of a right triangle with trigonometry? Pick the ratio that contains the side you know and the side you want, write it as an equation and solve. For example, with an angle of 35 degrees and an adjacent side of 40, the opposite side is 40 times tan 35. ### What are the exact values of sin, cos and tan for 30, 45 and 60 degrees? Sine is one half, root 2 over 2 and root 3 over 2; cosine is the same list backwards; tangent is root 3 over 3, 1 and root 3. They come from half an equilateral triangle and half a square. ### What is the unit circle in trigonometry? It is the circle of radius 1 around the origin. The point reached by turning through an angle from the positive x-axis has coordinates cosine and sine of that angle, which defines the functions for every angle. ### Why is tan 90 degrees undefined? Tangent is sine divided by cosine, and at 90 degrees the cosine is 0 while the sine is 1, so the division has no value. The graph of the tangent rises without bound near 90 degrees. ### Is sin(a + b) equal to sin a + sin b? No. The correct formula is sin a cos b plus cos a sin b. For 30 and 60 degrees the left side is sin 90, which is 1, while sin 30 plus sin 60 is about 1.366. ### Why does my calculator give a wrong answer for sin 30? It is probably in radian mode, where 30 means 30 radians and the sine is about minus 0.988. Switch to degree mode to get 0.5. Programming languages always use radians, so convert degrees first. --- # Trigonometri Dasar: Sinus, Kosinus, dan Tangen Source: https://nunada.my.id/artikel/trigonometri-dasar/ Updated: 2026-10-26 ## Jawaban singkat **Trigonometri menghubungkan sudut segitiga dengan panjang sisinya: pada segitiga siku-siku, sinus sebuah sudut adalah sisi depan dibagi sisi miring, kosinus adalah sisi samping dibagi sisi miring, dan tangen adalah sisi depan dibagi sisi samping.** Perbandingan ini hanya bergantung pada sudut, tidak pernah pada ukuran segitiga, sehingga satu sudut dan satu sisi memberi semua sisi lainnya. Lingkaran satuan memperluasnya ke setiap sudut, positif maupun negatif. ### Poin penting - Untuk sudut lancip $\theta$ pada segitiga siku-siku: $\sin\theta=\frac{\text{depan}}{\text{miring}}$, $\cos\theta=\frac{\text{samping}}{\text{miring}}$, $\tan\theta=\frac{\text{depan}}{\text{samping}}$ (sin-de-mi, cos-sa-mi, tan-de-sa). Kebalikannya adalah $\csc\theta$, $\sec\theta$, dan $\cot\theta$. Dua segitiga siku-siku dengan sudut sama sebangun, sehingga perbandingannya tidak bergantung pada ukuran. - Untuk mencari sisi yang hilang, pilih perbandingan yang memuat sisi yang diketahui dan sisi yang dicari, lalu selesaikan; untuk mencari sudut, pakai fungsi invers ($\arcsin$, $\arccos$, $\arctan$). Selalu periksa mode kalkulator: derajat untuk soal dalam derajat. - Nilai eksak pada $30^\circ$, $45^\circ$, dan $60^\circ$ berasal dari setengah segitiga sama sisi dan setengah persegi: $\sin30^\circ=\frac12$, $\sin45^\circ=\frac{\sqrt2}{2}$, $\sin60^\circ=\frac{\sqrt3}{2}$, dengan kosinus dalam urutan terbalik, dan $\tan$ bernilai $\frac{\sqrt3}{3}$, $1$, $\sqrt3$. - Pada lingkaran satuan titik pada sudut $\theta$ adalah $(\cos\theta,\sin\theta)$. Itu mendefinisikan fungsi untuk setiap sudut, dengan tanda menurut kuadran (semua positif di I, sinus di II, tangen di III, kosinus di IV) dan nilai sama dengan nilai pada sudut acuan, kecuali tandanya. Sinus dan kosinus berulang setiap $360^\circ$, tangen setiap $180^\circ$. - Identitas dasarnya adalah $\sin^2\theta+\cos^2\theta=1$, $\tan\theta=\frac{\sin\theta}{\cos\theta}$, $\sin(90^\circ-\theta)=\cos\theta$, $\sin2\theta=2\sin\theta\cos\theta$, dan $\sin(\alpha+\beta)=\sin\alpha\cos\beta+\cos\alpha\sin\beta$. Yang menggoda seperti $\sin(\alpha+\beta)=\sin\alpha+\sin\beta$ salah: satu sudut yang kebetulan cocok tidak membuktikan identitas. - Persamaan $\sin x=c$ memiliki dua penyelesaian di antara $0^\circ$ dan $360^\circ$ (sudut itu dan bayangan cerminnya), $\cos x=c$ memiliki dua, dan $\tan x=c$ memiliki dua yang berjarak setengah putaran. Grafik $y=a\sin(b(x-c))+d$ memiliki amplitudo $|a|$, periode $\frac{360^\circ}{b}$, pergeseran fase $c$, dan garis tengah $y=d$. Dalam kode, ubah derajat ke radian, dan pilih `atan2` untuk mencari sudut. ## Apa itu sinus, kosinus, dan tangen? **Trigonometri adalah bagian matematika yang menghubungkan sudut segitiga dengan panjang sisinya; tiga alat dasarnya adalah sinus, kosinus, dan tangen sebuah sudut.** Namanya berasal dari bahasa Yunani yang berarti pengukuran segitiga. Ia bermula dari segitiga siku-siku, yang memiliki sudut $90^\circ$. Pilih satu dari dua sudut lancipnya dan sebut $\theta$. Ketiga sisi sekarang memiliki nama relatif terhadap $\theta$: - **sisi miring** (hipotenusa) adalah sisi di depan sudut siku-siku, selalu yang terpanjang; - **sisi depan** adalah sisi yang berseberangan dengan $\theta$; - **sisi samping** adalah sisi tegak lainnya, yang menyentuh $\theta$. *Sisi-sisi segitiga siku-siku diberi nama dari sudut $\theta$: $a$ adalah sisi depan, $b$ sisi samping, dan $c$ sisi miring. Maka $\sin\theta=\frac{a}{c}$ (sin-de-mi), $\cos\theta=\frac{b}{c}$ (cos-sa-mi), dan $\tan\theta=\frac{a}{b}$ (tan-de-sa).* Maka ketiga perbandingannya adalah $$\sin\theta=\frac{\text{depan}}{\text{miring}},\qquad \cos\theta=\frac{\text{samping}}{\text{miring}},\qquad \tan\theta=\frac{\text{depan}}{\text{samping}}.$$ Cara mengingatnya adalah sin-de-mi, cos-sa-mi, tan-de-sa: Sinus adalah sisi DEpan per sisi MIring, Kosinus adalah sisi SAmping per sisi MIring, Tangen adalah sisi DEpan per sisi SAmping. Ada pula tiga kebalikannya: kosekan $\csc\theta=\frac{1}{\sin\theta}$, sekan $\sec\theta=\frac{1}{\cos\theta}$, dan kotangen $\cot\theta=\frac{1}{\tan\theta}$. **Mengapa ini masuk akal?** Dua segitiga siku-siku yang sama-sama memiliki sudut $\theta$ memiliki ketiga sudut sama, sehingga sebangun: yang satu adalah pembesaran yang lain, dan perbandingan dua sisi tetap sama. Jadi $\sin\theta$ adalah bilangan milik sudut, bukan milik segitiga: ia sama untuk segitiga di atas kertas dan untuk segitiga sebesar menara. Karena sisi miring adalah sisi terpanjang, $\sin\theta$ dan $\cos\theta$ sebuah sudut lancip selalu di antara $0$ dan $1$. *Dua segitiga siku-siku dengan sudut $\theta$ yang sama. Setiap sisi segitiga yang lebih besar dua kali sisi yang bersesuaian pada yang lebih kecil, sehingga $\sin\theta=\frac35=\frac{6}{10}$ pada keduanya: perbandingan itu milik sudutnya, bukan ukuran segitiganya.* Dua fakta lagi mengikuti. Sudut lancip yang lain adalah $90^\circ-\theta$, dan sisi depan dan samping bertukar bila kita melihat darinya, sehingga $\sin(90^\circ-\theta)=\cos\theta$. Dan menurut [teorema Pythagoras](https://nunada.my.id/artikel/teorema-pythagoras/#what-is-the-theorem), $\text{depan}^2+\text{samping}^2=\text{miring}^2$; bagi dengan kuadrat sisi miring dan diperoleh $\sin^2\theta+\cos^2\theta=1$. Cobalah: geser sudut dan ukurannya, dan ganti sudut yang dilihat. ## Bagaimana mencari sisi atau sudut yang hilang pada segitiga siku-siku? **Untuk mencari sisi yang hilang, pilih perbandingan yang memuat sisi yang diketahui dan sisi yang dicari, tulis, lalu selesaikan untuk bilangan yang tidak diketahui; untuk mencari sudut yang hilang, pakai fungsi invers dari perbandingan itu.** Setiap segitiga siku-siku dapat dipecahkan dari satu sudut dan satu sisi, atau dari dua sisi. 1. Gambar segitiganya dan tandai sudut $\theta$ yang dipakai. 2. Namai sisi-sisinya relatif terhadap $\theta$: depan, samping, miring. 3. Pilih perbandingan yang memuat sisi yang diketahui dan sisi yang tidak diketahui: depan dan miring berarti sinus, samping dan miring berarti kosinus, depan dan samping berarti tangen. 4. Tulis persamaannya, misalnya $\sin\theta=\frac{\text{depan}}{\text{miring}}$, dan selesaikan: kalikan untuk mencari sisi, atau ambil fungsi invers ($\arcsin$, $\arccos$, $\arctan$) untuk mencari sudut. 5. Periksa bahwa sisi miring adalah sisi terpanjang, dan bahwa $\text{depan}^2+\text{samping}^2=\text{miring}^2$. **Contoh, sebuah sisi.** Anda berdiri $40$ m dari kaki sebuah menara dan melihat puncaknya dengan sudut elevasi $35^\circ$ (sudut di atas garis mendatar). Sisi yang diketahui adalah sisi samping $40$ dan yang tidak diketahui sisi depan, jadi tangen adalah perbandingan yang tepat: $\tan35^\circ=\frac{h}{40}$, sehingga $h=40\tan35^\circ\approx28{,}01$ m. (Tambahkan tinggi mata Anda untuk mendapat tinggi menara.) Memandang ke bawah dari menara ke sebuah perahu memakai sudut depresi, diukur di bawah garis mendatar; ia sama dengan sudut elevasi yang dilihat dari perahu. *Soal menara: dari jarak $40$ m Anda melihat puncaknya dengan sudut elevasi $35^\circ$. Tinggi di atas mata Anda adalah $h=40\tan35^\circ\approx28$ m. (Gambar memakai $10$ satuan untuk $40$ m.)* **Contoh, sebuah sudut.** Sebuah jalan naik $8$ m pada jarak mendatar $100$ m. Maka $\tan\theta=\frac{8}{100}$, sehingga $\theta=\arctan0{,}08\approx4{,}57^\circ$. Kemiringan $8\%$ tepat adalah tangen ini. **Contoh, sebuah tangga.** Tangga $5$ m bersandar pada dinding dengan sudut $70^\circ$ terhadap tanah. Sisi miringnya $5$, jadi ia mencapai $5\sin70^\circ\approx4{,}70$ m ke atas dinding, dan kakinya $5\cos70^\circ\approx1{,}71$ m dari dinding. Fungsi invers adalah topik [artikelnya sendiri](https://nunada.my.id/artikel/fungsi-trigonometri-invers/#definitions): $\arcsin x$ adalah sudut di antara $-90^\circ$ dan $90^\circ$ yang sinusnya $x$. Untuk segitiga yang bukan siku-siku, pakai aturan sinus dan aturan kosinus ([memecahkan segitiga](https://nunada.my.id/artikel/segitiga/#solve-a-triangle)). Pemecah di bawah menerima pasangan ukuran apa pun dan juga menyediakan contoh-contoh ini. ## Berapa nilai eksak sinus dan kosinus pada 30°, 45°, dan 60°? **Nilai eksak pada $30^\circ$, $45^\circ$, dan $60^\circ$ berasal dari dua segitiga yang dapat digambar: setengah segitiga sama sisi, dan setengah persegi.** Setengah segitiga sama sisi. Ambil segitiga sama sisi dengan sisi $2$ dan belah menjadi dua sepanjang tingginya. Diperoleh segitiga siku-siku dengan sudut $30^\circ$, $60^\circ$, dan $90^\circ$, sisi miring $2$, sisi tegak pendek $1$ (setengah alas), dan sisi tegak panjang $\sqrt{2^2-1^2}=\sqrt3$. Baca perbandingannya: $\sin30^\circ=\frac12$, $\cos30^\circ=\frac{\sqrt3}{2}$, $\tan30^\circ=\frac{1}{\sqrt3}=\frac{\sqrt3}{3}$, dan dari sudut yang lain $\sin60^\circ=\frac{\sqrt3}{2}$, $\cos60^\circ=\frac12$, $\tan60^\circ=\sqrt3$. *Segitiga sama sisi bersisi $2$ yang dibelah sepanjang tingginya. Setiap belahan adalah segitiga siku-siku dengan sudut $30^\circ$, $60^\circ$, $90^\circ$ dan sisi $1$, $\sqrt3$, $2$ (sisi tegak panjangnya $\sqrt{2^2-1^2}=\sqrt3$).* Setengah persegi. Belah persegi bersisi $1$ sepanjang diagonalnya. Diperoleh segitiga siku-siku dengan dua sudut $45^\circ$, sisi tegak $1$, dan sisi miring $\sqrt2$. Jadi $\sin45^\circ=\cos45^\circ=\frac{1}{\sqrt2}=\frac{\sqrt2}{2}$ dan $\tan45^\circ=1$. *Persegi bersisi $1$ yang dibelah sepanjang diagonalnya. Setiap belahan adalah segitiga siku-siku dengan dua sudut $45^\circ$ dan sisi $1$, $1$, $\sqrt2$, sehingga $\sin45^\circ=\cos45^\circ=\frac{1}{\sqrt2}=\frac{\sqrt2}{2}$ dan $\tan45^\circ=1$.* | $\theta$ | $0^\circ$ | $30^\circ$ | $45^\circ$ | $60^\circ$ | $90^\circ$ | |---|---|---|---|---|---| | $\sin\theta$ | $0$ | $\frac12$ | $\frac{\sqrt2}{2}$ | $\frac{\sqrt3}{2}$ | $1$ | | $\cos\theta$ | $1$ | $\frac{\sqrt3}{2}$ | $\frac{\sqrt2}{2}$ | $\frac12$ | $0$ | | $\tan\theta$ | $0$ | $\frac{\sqrt3}{3}$ | $1$ | $\sqrt3$ | tak terdefinisi | **Pola yang mudah diingat.** Tulis sinus $0^\circ,30^\circ,45^\circ,60^\circ,90^\circ$ sebagai $\frac{\sqrt0}{2},\frac{\sqrt1}{2},\frac{\sqrt2}{2},\frac{\sqrt3}{2},\frac{\sqrt4}{2}$; kosinusnya adalah daftar yang sama dari belakang, dan tangen adalah sinus dibagi kosinus. Sudut $0^\circ$ adalah segitiga yang merosot tanpa tinggi ($\sin0^\circ=0$) dan pada $90^\circ$ sisi samping menyusut menjadi nol, sehingga $\tan90^\circ=\frac{1}{0}$ tidak bernilai. Kelipatan $15^\circ$ memerlukan sedikit lebih banyak: $\sin15^\circ=\frac{\sqrt6-\sqrt2}{4}$, $\cos15^\circ=\frac{\sqrt6+\sqrt2}{4}$, dan $\tan15^\circ=2-\sqrt3$, yang mengikuti dari rumus sudut di bawah ($15^\circ=45^\circ-30^\circ$). Lingkaran satuan di bawah memberi nilai eksak semuanya. Segitiga-segitiga ini juga yang ada pada [segitiga siku-siku](https://nunada.my.id/artikel/segitiga/#right-triangles), tempat sisi-sisinya muncul sebagai perbandingan $1:1:\sqrt2$ dan $1:\sqrt3:2$. ## Bagaimana lingkaran satuan memberi sinus dan kosinus untuk setiap sudut? **Pada lingkaran satuan, lingkaran berjari-jari $1$ berpusat di titik asal, titik yang dicapai dengan berputar sebesar sudut $\theta$ dari sumbu-$x$ positif adalah $(\cos\theta,\sin\theta)$.** Inilah definisi yang berlaku untuk setiap sudut. Untuk sudut lancip ia sesuai dengan segitiga: jatuhkan garis tegak lurus dari titik itu ke sumbu-$x$, dan segitiga siku-sikunya memiliki sisi miring $1$, sehingga sisi samping adalah $\cos\theta$ dan sisi depan adalah $\sin\theta$. Sudut positif berputar berlawanan arah jarum jam, sudut negatif searah jarum jam (lihat [cara sudut diukur](https://nunada.my.id/artikel/sudut/#units)), dan $\tan\theta=\frac{\sin\theta}{\cos\theta}$ di mana pun kosinus bukan $0$. *Lingkaran satuan. Titik pada sudut $\theta$ adalah $(\cos\theta,\sin\theta)$: jari-jari adalah sisi miring, berpanjang $1$, sisi tegak mendatar adalah $\cos\theta$ dan sisi tegak vertikal adalah $\sin\theta$. Pythagoras memberi $\sin^2\theta+\cos^2\theta=1$.* Tiga hal mengikuti. **Tanda menurut kuadran.** Tanda $\cos\theta$ adalah tanda koordinat-$x$ dan tanda $\sin\theta$ adalah tanda koordinat-$y$: | Kuadran | Sudut | $\sin$ | $\cos$ | $\tan$ | |---|---|---|---|---| | I | $0^\circ$ sampai $90^\circ$ | $+$ | $+$ | $+$ | | II | $90^\circ$ sampai $180^\circ$ | $+$ | $-$ | $-$ | | III | $180^\circ$ sampai $270^\circ$ | $-$ | $-$ | $+$ | | IV | $270^\circ$ sampai $360^\circ$ | $-$ | $+$ | $-$ | Dengan kata-kata: ketiganya positif di I, hanya sinus di II, hanya tangen di III, dan hanya kosinus di IV (urutan kuadran I sampai IV: semua, sin, tan, cos). **Sudut acuan.** Sudut acuan $\theta$ adalah sudut lancip antara kaki terminalnya dan sumbu-$x$. Karena kesimetrian, setiap fungsi di $\theta$ memiliki nilai mutlak yang sama dengan nilainya pada sudut acuan, dan tandanya ditentukan kuadran. 1. Cari sudut acuan: $\theta$ di kuadran II memberi $180^\circ-\theta$, di III memberi $\theta-180^\circ$, di IV memberi $360^\circ-\theta$. 2. Baca nilai pada sudut acuan (tabel di bagian sebelumnya). 3. Pasang tanda kuadran di depannya. Misalnya $\sin210^\circ$: ia di kuadran III, sudut acuannya $30^\circ$, dan sinus negatif di sana, jadi $\sin210^\circ=-\frac12$. Dan $\cos120^\circ=-\cos60^\circ=-\frac12$, $\tan135^\circ=-\tan45^\circ=-1$. *Sudut $150^\circ$ berada di kuadran II. Sudut acuannya adalah $180^\circ-150^\circ=30^\circ$, sehingga $\sin150^\circ=\sin30^\circ=\frac12$ (positif di sana) dan $\cos150^\circ=-\cos30^\circ=-\frac{\sqrt3}{2}$ (negatif di sana). Tanda yang tertulis di tiap kuadran adalah tanda $\sin$, $\cos$, dan $\tan$, dalam urutan itu.* **Periodisitas dan sudut negatif.** Satu putaran penuh tidak mengubah apa pun, sehingga $\sin(\theta+360^\circ)=\sin\theta$ dan hal yang sama untuk kosinus; tangen berulang setelah setengah putaran, $\tan(\theta+180^\circ)=\tan\theta$. Berputar ke arah sebaliknya mencerminkan titik pada sumbu-$x$: $\sin(-\theta)=-\sin\theta$ dan $\cos(-\theta)=\cos\theta$. Jadi $\sin(-30^\circ)=-\frac12$ dan $\cos(-30^\circ)=\frac{\sqrt3}{2}$. (Ahli matematika mengukur putaran yang sama dalam radian, dengan $360^\circ=2\pi$.) Geser sudut di bawah, dari $-360^\circ$ sampai $720^\circ$, dan lihat titik, tanda, dan nilai eksaknya. ## Bagaimana menyelesaikan sin x = c, cos x = c, dan tan x = c? **Untuk menyelesaikan $\sin x=c$, $\cos x=c$, atau $\tan x=c$, cari satu sudut dengan fungsi invers, cari bayangan cerminnya pada lingkaran satuan, dan tambahkan putaran penuh pada keduanya.** Alasan adanya sudut kedua adalah bahwa dua titik pada lingkaran satuan memiliki tinggi yang sama (sinus yang sama), dua titik memiliki koordinat-$x$ yang sama (kosinus yang sama), dan dua titik berlawanan memberi tangen yang sama. 1. Bila $c$ di luar $-1\le c\le1$ untuk sinus atau kosinus, tidak ada penyelesaian. 2. Cari sudut pokok $\alpha$ dengan fungsi invers ($\arcsin c$, $\arccos c$, atau $\arctan c$). 3. Cari sudut kedua di antara $0^\circ$ dan $360^\circ$ dari kesimetrian: - sinus: $x=\alpha$ dan $x=180^\circ-\alpha$; - kosinus: $x=\alpha$ dan $x=360^\circ-\alpha$ (yaitu $\pm\alpha$); - tangen: $x=\alpha$ dan $x=\alpha+180^\circ$. 4. Tambahkan putaran penuh untuk semua penyelesaian: $360^\circ k$ untuk sinus dan kosinus, $180^\circ k$ untuk tangen, dengan $k$ bilangan bulat apa saja. 5. Periksa jawabannya dengan substitusi. **Contoh.** $\sin x=\frac12$. Sudut pokoknya $\alpha=30^\circ$, sehingga penyelesaian di antara $0^\circ$ dan $360^\circ$ adalah $30^\circ$ dan $180^\circ-30^\circ=150^\circ$; secara umum $x=30^\circ+360^\circ k$ atau $x=150^\circ+360^\circ k$. Untuk $\cos x=-\frac{\sqrt2}{2}$ sudut pokoknya $135^\circ$, dan penyelesaiannya $135^\circ$ dan $225^\circ$. Untuk $\tan x=\sqrt3$ penyelesaiannya $60^\circ$ dan $240^\circ$. Kalkulator atau program hanya memberi nilai pokok ($\arcsin$ mengembalikan sudut di antara $-90^\circ$ dan $90^\circ$), sehingga penyelesaian kedua harus dicari sendiri. Cara yang sama menyelesaikan persamaan yang lebih sulit setelah dibawa ke bentuk ini, misalnya $2\sin^2x=\sin x$ menjadi $\sin x\,(2\sin x-1)=0$, sehingga $\sin x=0$ atau $\sin x=\frac12$. Sudut kelipatan, persamaan kuadrat, dan akar palsu ada di [artikel tentang persamaan trigonometri](https://nunada.my.id/artikel/persamaan-trigonometri/). *Persamaan $\sin x=\frac12$. Garis $y=\frac12$ memotong gelombang sinus di antara $0^\circ$ dan $360^\circ$ di dua titik, $x=30^\circ$ dan $x=180^\circ-30^\circ=150^\circ$; setiap putaran berikutnya menambah $360^\circ$.* ## Apa saja identitas trigonometri dasar? **Identitas trigonometri adalah persamaan yang benar untuk setiap sudut yang kedua ruasnya terdefinisi, yang membedakannya dari persamaan biasa, yang benar hanya untuk sebagian sudut.** $\sin x=\frac12$ adalah persamaan (berlaku pada $30^\circ$ dan $150^\circ$ dan seterusnya); $\sin^2x+\cos^2x=1$ adalah identitas (berlaku selalu). Berikut yang perlu diketahui. | Nama | Identitas | |---|---| | Pythagoras | $\sin^2x+\cos^2x=1$ dan $1+\tan^2x=\frac{1}{\cos^2x}$ | | Hasil bagi dan kebalikan | $\tan x=\frac{\sin x}{\cos x}$, $\csc x=\frac{1}{\sin x}$, $\sec x=\frac{1}{\cos x}$, $\cot x=\frac{1}{\tan x}$ | | Fungsi komplemen | $\sin(90^\circ-x)=\cos x$ dan $\cos(90^\circ-x)=\sin x$ | | Pelurus dan sudut negatif | $\sin(180^\circ-x)=\sin x$, $\sin(-x)=-\sin x$, $\cos(-x)=\cos x$ | | Sudut ganda | $\sin2x=2\sin x\cos x$ dan $\cos2x=\cos^2x-\sin^2x$ | | Jumlah | $\sin(x+y)=\sin x\cos y+\cos x\sin y$ dan $\cos(x+y)=\cos x\cos y-\sin x\sin y$ | Asalnya. Identitas Pythagoras adalah persamaan lingkaran satuan, $x^2+y^2=1$, dengan $x=\cos\theta$ dan $y=\sin\theta$; bagi dengan $\cos^2x$ untuk bentuk kedua. Identitas fungsi komplemen mengatakan bahwa sinus sebuah sudut adalah kosinus penyikunya (kedua sudut lancip segitiga siku-siku). Rumus sudut ganda adalah rumus jumlah dengan $y=x$, dan rumus jumlah dapat dibuktikan dari geometri lingkaran satuan. Dengannya diperoleh nilai eksak di luar tabel, misalnya $\sin75^\circ=\sin(45^\circ+30^\circ)$, yang menurut rumus jumlah adalah $\frac{\sqrt2}{2}\cdot\frac{\sqrt3}{2}+\frac{\sqrt2}{2}\cdot\frac12$, yaitu $\frac{\sqrt6+\sqrt2}{4}$. **Identitas tidak dibuktikan dengan mencoba satu bilangan.** Rumus yang menggoda $\sin(x+y)=\sin x+\sin y$, $\sin2x=2\sin x$, dan $\sin x+\cos x=1$ salah, namun masing-masing benar pada beberapa sudut: $\sin2x=2\sin x$ berlaku pada $x=0^\circ$ dan $x=180^\circ$, dan satu uji yang kebetulan cocok dapat meyakinkan kita. Identitas yang salah dibantah oleh satu contoh penyangkal ($\sin(30^\circ+60^\circ)=1$ tetapi $\sin30^\circ+\sin60^\circ\approx1{,}366$); yang benar harus dibuktikan, dengan aljabar atau geometri. Penguji di bawah membandingkan kedua ruas pada semua $360$ derajat bulat. Rumus jumlah, sudut ganda, dan sudut paruh, beserta pembuktiannya dan strategi membuktikan identitas, ada di [artikel identitas trigonometri](https://nunada.my.id/artikel/identitas-trigonometri/#sum-and-difference). ## Seperti apa grafik sinus dan kosinus? **Grafik $y=\sin x$ dan $y=\cos x$ adalah gelombang yang berulang setiap $360^\circ$ dan berosilasi di antara $-1$ dan $1$; kosinus adalah sinus yang digeser $90^\circ$ ke kiri.** Gambarkan tinggi titik pada lingkaran satuan terhadap sudutnya dan diperoleh gelombang sinus: ia mulai dari $0$, naik ke $1$ pada $90^\circ$, turun melewati $0$ pada $180^\circ$ ke $-1$ pada $270^\circ$, dan kembali di $0$ pada $360^\circ$. Tangen memiliki bentuk lain: ia berulang setiap $180^\circ$ dan meledak di dekat $90^\circ$ dan $270^\circ$, tempat kosinus bernilai $0$. *Satu putaran gelombang sinus (garis penuh) dan gelombang kosinus (putus-putus). Kosinus adalah sinus yang digeser $90^\circ$ ke kiri. Keduanya berosilasi di antara $-1$ dan $1$ dan berulang setiap $360^\circ$.* Setiap gelombang berbentuk $y=a\sin(b(x-c))+d$ (atau dengan kosinus) diuraikan oleh empat bilangan: - **amplitudo** $|a|$, jarak dari garis tengah ke puncak; $a$ negatif membalik gelombang; - **periode** $\frac{360^\circ}{b}$, panjang satu siklus penuh (dalam radian, $\frac{2\pi}{b}$); $b$ yang lebih besar merapatkan gelombang; - **pergeseran fase** $c$, seberapa jauh gelombang digeser ke kanan; - **garis tengah** $y=d$, tinggi tempat gelombang berosilasi; maksimumnya $d+|a|$ dan minimumnya $d-|a|$. **Contoh.** $y=2\sin(3x)+1$: amplitudo $2$, periode $\frac{360^\circ}{3}=120^\circ$, tanpa pergeseran, garis tengah $y=1$, maksimum $3$, minimum $-1$. Nolnya ada di tempat $\sin3x=-\frac12$. *Grafik $y=2\sin3x+1$. Garis tengahnya $y=1$ (putus-putus), amplitudonya $2$ (dari garis tengah ke puncak di $y=3$), dan periodenya $\frac{360^\circ}{3}=120^\circ$ (batang di bagian bawah).* Gelombang berbentuk ini menggambarkan apa pun yang berputar atau bolak-balik: tinggi pasang surut, bandul yang berayun, bunyi satu nada murni, arus bolak-balik, pergantian panjang siang. Gradiennya adalah gelombang lain, yang menjadi topik [turunan sinus dan kosinus](https://nunada.my.id/artikel/turunan-fungsi-trigonometri/#sine-and-cosine). Grafik keempat fungsi lainnya, cara membuat sketsa dan membaca gelombang ini, dan cara menjumlahkannya ada di [artikel tentang grafik fungsi trigonometri](https://nunada.my.id/artikel/grafik-fungsi-trigonometri/). Ubah keempat bilangan di bawah dan lihat tabelnya. ## Di mana trigonometri dipakai? **Trigonometri dipakai di mana pun kita tidak dapat mengukur panjang atau arah secara langsung tetapi dapat mengukur sudut, atau di mana sesuatu berputar atau berosilasi.** - **Tinggi dan jarak.** Tinggi menara, pohon, atau gunung, lebar sungai, jarak ke sebuah kapal: satu sudut dan satu panjang yang terukur memberi sisanya (survei bekerja persis seperti ini, dengan teodolit untuk mengukur sudutnya). - **Kemiringan.** Gradien jalan atau atap adalah tangen sudutnya; landasan miring untuk kursi roda sebaiknya tidak melebihi sekitar $5^\circ$. - **Navigasi.** Bearing adalah sudut dari utara (lihat [arah dan bearing](https://nunada.my.id/artikel/sudut/#directions)); komponen arah timur dan utara dari sebuah haluan adalah $d\sin\theta$ dan $d\cos\theta$ untuk bearing $\theta$. - **Fisika dan teknik.** Gaya atau kecepatan pada sudut $\theta$ memiliki komponen $F\cos\theta$ dan $F\sin\theta$; sebuah balok pada bidang miring merasakan $mg\sin\theta$ sepanjang bidang itu. - **Gelombang dan sinyal.** Bunyi, cahaya, radio, arus bolak-balik, dan pasang surut adalah jumlah gelombang sinus. - **Komputer.** Sebuah titik yang diputar sebesar $\theta$ terhadap titik asal berpindah ke $(x\cos\theta-y\sin\theta,\ x\sin\theta+y\cos\theta)$, dasar grafika, permainan, dan lengan robot; posisi titik pada lingkaran adalah $(r\cos\theta,\ r\sin\theta)$. Semuanya bertumpu pada gambar yang sama: sebuah segitiga siku-siku, atau titik pada lingkaran satuan. ## Bagaimana memakai trigonometri dalam kode? **Setiap bahasa pemrograman menerima sudut dalam radian, jadi ubah dulu: `math.sin(math.radians(30))` di Python, `Math.sin(30 Math.PI / 180)` di JavaScript, `sin(30 PI / 180)` di C++.** Melupakan ini adalah kesalahan paling umum: `math.sin(30)` adalah sinus $30$ radian, sekitar $-0{,}988$. Jebakan kedua adalah pembulatan. Karena $\pi$ disimpan dengan galat kecil, nilai yang kita harapkan tepat ternyata tidak: `math.sin(math.radians(30))` memberi `0.49999999999999994`, `math.cos(math.radians(90))` memberi `6.1e-17` alih-alih $0$, dan `math.tan(math.radians(90))` memberi sekitar $1{,}6\times10^{16}$ alih-alih "tak terdefinisi". Bandingkan dengan toleransi, jangan pernah dengan `==`, atau lipat sudut ke sudut acuan di antara $0^\circ$ dan $90^\circ$ dulu, seperti fungsi `sin_deg` di bawah. Untuk arah sebaliknya, pakai fungsi invers, dan pilih `atan2(depan, samping)` daripada `atan(depan / samping)`: ia mendapatkan kuadran yang benar dan tidak membagi dengan nol (lihat [sudut antara dua vektor](https://nunada.my.id/artikel/sudut/#between-lines-and-vectors)). Program memecahkan menara dan jalan dari contoh, segitiga $3$-$4$-$5$, dan persamaan $\sin x=\frac12$. ```python import math def sin_deg(d): """Sine of an angle in degrees: fold to a reference angle first, so 30 and 90 come out exact.""" n = d % 360 ref, sign = (n, 1) if n <= 90 else (180 - n, 1) if n <= 180 else (n - 180, -1) if n <= 270 else (360 - n, -1) v = {0: 0.0, 30: 0.5, 90: 1.0}.get(ref, math.sin(math.radians(ref))) return sign * v if v else 0.0 def cos_deg(d): return sin_deg(90 - d) print(math.sin(math.radians(30)), sin_deg(30)) # 0.49999999999999994 0.5 print(math.cos(math.radians(90)), cos_deg(90)) # 6.123233995736766e-17 0.0 print(math.tan(math.radians(90))) # 1.633123935319537e+16, not "undefined" print(round(40 * math.tan(math.radians(35)), 2)) # 28.01: the tower seen at 35 degrees from 40 m print(round(math.degrees(math.atan2(8, 100)), 2)) # 4.57: the road that rises 8 m in 100 m print(round(math.degrees(math.atan2(3, 4)), 4), math.hypot(3, 4)) # 36.8699 5.0 x = math.degrees(math.asin(0.5)) # the principal value of sin x = 1/2 print(round(x, 6), round(180 - x, 6)) # 30.0 150.0: the mirror image is yours to add print(round(math.sin(math.radians(75)), 6), round((math.sqrt(6) + math.sqrt(2)) / 4, 6)) # 0.965926 0.965926 print(sin_deg(210), sin_deg(-30), cos_deg(120)) # -0.5 -0.5 -0.5 ``` ```javascript const rad = (d) => (d * Math.PI) / 180 const deg = (r) => (r * 180) / Math.PI function sinDeg(d) { const n = ((d % 360) + 360) % 360 // JavaScript's % keeps the sign of d, so fix it const [ref, sign] = n <= 90 ? [n, 1] : n <= 180 ? [180 - n, 1] : n <= 270 ? [n - 180, -1] : [360 - n, -1] const v = ref === 0 ? 0 : ref === 30 ? 0.5 : ref === 90 ? 1 : Math.sin(rad(ref)) return v === 0 ? 0 : sign * v } const cosDeg = (d) => sinDeg(90 - d) ;[Math.sin(rad(30)), sinDeg(30)] // [0.49999999999999994, 0.5] ;[Math.cos(rad(90)), cosDeg(90)] // [6.123233995736766e-17, 0] Math.tan(rad(90)) // 16331239353195370, not "undefined" +(40 * Math.tan(rad(35))).toFixed(2) // 28.01 +deg(Math.atan2(8, 100)).toFixed(2) // 4.57 ;[deg(Math.asin(0.5)), 180 - deg(Math.asin(0.5))].map((x) => +x.toFixed(6)) // [30, 150] ;[sinDeg(210), sinDeg(-30), cosDeg(120)] // [-0.5, -0.5, -0.5] ``` ```cpp #include #include #include using namespace std; const double PI = 3.14159265358979323846; double radians(double d) { return d * PI / 180.0; } double sinDeg(double d) { double n = d - 360.0 * floor(d / 360.0); // into [0, 360) double ref = n; double sign = 1; if (n > 270) { ref = 360 - n; sign = -1; } else if (n > 180) { ref = n - 180; sign = -1; } else if (n > 90) { ref = 180 - n; } double v; if (ref == 0) v = 0; else if (ref == 30) v = 0.5; else if (ref == 90) v = 1; else v = sin(radians(ref)); return v == 0 ? 0 : sign * v; } double cosDeg(double d) { return sinDeg(90 - d); } int same(double a, double b) { return a == b ? 1 : 0; } int main() { printf("%d %d\n", same(sin(radians(30)), 0.5), same(sinDeg(30), 0.5)); printf("%d %d\n", same(cos(radians(90)), 0), same(cosDeg(90), 0)); printf("%.2f\n", 40 * tan(radians(35))); printf("%.2f\n", atan2(8, 100) * 180 / PI); printf("%.4f %.4f\n", sinDeg(210), cosDeg(120)); printf("%.6f %.6f\n", asin(0.5) * 180 / PI, 180 - asin(0.5) * 180 / PI); return 0; } /* output: 0 1 0 1 28.01 4.57 -0.5000 -0.5000 30.000000 150.000000 */ ``` ## Dari mana trigonometri berasal? **Trigonometri bermula sebagai astronomi tali busur, tumbuh menjadi sinus dan kosinus di India dan dunia Islam, dan menjadi fungsi yang kita tulis sekarang pada abad kedelapan belas.** - **Sekitar 150 SM.** Hipparchus menyusun tabel tali busur pertama (panjang ruas garis yang menghubungkan dua titik pada lingkaran untuk suatu sudut), untuk meramalkan posisi Matahari dan Bulan. Sekitar 150 M, Almagest Ptolemeus memuat tabel tali busur untuk setiap setengah derajat. - **Sekitar 500 M.** Astronom India seperti Aryabhata bekerja dengan setengah tali busur, yaitu jya, yang adalah sinus kita, dan menabelkannya; kosinus muncul sebagai sinus sudut penyiku. - **Sekitar 800 sampai 1000.** Di dunia Islam, cendekiawan termasuk al-Khwarizmi dan Abu al-Wafa memperluas tabel dan memakai keenam fungsi, dan al-Battani mengganti tali busur Yunani dengan sinus dalam astronominya. - **Abad ke-12.** Penerjemah Latin menerjemahkan jayb dalam bahasa Arab (salah baca atas jya Sanskerta) sebagai sinus, yang berarti "lipatan" atau "teluk": begitulah kata sine mendapat namanya. - **1464.** Regiomontanus menulis De triangulis omnimodis, buku Eropa pertama tentang trigonometri sebagai bidang tersendiri, terpisah dari astronomi. - **1595.** Bartholomaeus Pitiscus menerbitkan Trigonometria dan memberi bidang itu namanya. - **1748.** Introductio in analysin infinitorum karya Euler menetapkan notasi modern (sin, cos, tan) dan memperlakukannya sebagai fungsi dari sebuah bilangan, yang membuka jalan bagi kalkulus dan gelombang. ## Apa kesalahan umum dalam trigonometri? **Kesalahan paling umum dalam trigonometri adalah sembilan hal berikut, masing-masing dengan pernyataan yang benar.** | Kesalahan | Yang benar | |---|---| | ❌ Memakai kalkulator atau program pada mode yang salah | Derajat untuk derajat, radian untuk radian; periksa bahwa $\sin30$ memberi $0{,}5$ pada mode derajat. | | ❌ $\sin(x+y)=\sin x+\sin y$ | $\sin(x+y)=\sin x\cos y+\cos x\sin y$; untuk $30^\circ$ dan $60^\circ$ yang benar memberi $1$ dan yang salah $1{,}366$. | | ❌ $\sin2x=2\sin x$ | $\sin2x=2\sin x\cos x$; versi yang salah hanya berlaku pada $0^\circ$ dan $180^\circ$. | | ❌ $\sin^{-1}x$ berarti $\frac{1}{\sin x}$ | $\sin^{-1}x$ adalah fungsi invers $\arcsin x$; kebalikannya adalah $\csc x$. | | ❌ Sisi depan dan samping adalah sisi yang tetap | Keduanya bergantung pada sudut yang dilihat; keduanya bertukar bila kita melihat dari sudut lancip yang lain. | | ❌ $\tan90^\circ=\infty$ atau $0$ | Ia tak terdefinisi: $\tan90^\circ=\frac{\sin90^\circ}{\cos90^\circ}=\frac10$. | | ❌ Segitiga besar memiliki sinus lebih besar | Perbandingan hanya bergantung pada sudut; untuk sudut lancip sinus berada di antara $0$ dan $1$. | | ❌ $\sin150^\circ$ negatif karena $150^\circ>90^\circ$ | Ia di kuadran II, tempat sinus positif: $\sin150^\circ=\sin30^\circ=\frac12$. | | ❌ $\sin x=\frac12$ hanya memiliki penyelesaian $30^\circ$ | Ada dua di antara $0^\circ$ dan $360^\circ$: $30^\circ$ dan $150^\circ$ (dan setiap putaran berikutnya). | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: trigonometri dasar sekilas - **Perbandingan:** $\sin\theta=\frac{\text{dep}}{\text{mir}}$, $\cos\theta=\frac{\text{sam}}{\text{mir}}$, $\tan\theta=\frac{\text{dep}}{\text{sam}}$ (sin-de-mi, cos-sa-mi, tan-de-sa); kebalikan $\csc$, $\sec$, $\cot$; hanya bergantung pada sudut (segitiga sebangun). - **Memecahkan segitiga siku-siku:** satu sudut dan satu sisi, atau dua sisi; pilih perbandingan dengan sisi yang diketahui dan dicari; fungsi invers untuk sudut; periksa dengan Pythagoras. - **Sudut istimewa:** $\sin30^\circ=\frac12$, $\sin45^\circ=\frac{\sqrt2}{2}$, $\sin60^\circ=\frac{\sqrt3}{2}$; kosinus terbalik; $\tan$: $\frac{\sqrt3}{3}$, $1$, $\sqrt3$; $\tan90^\circ$ tak terdefinisi. - **Lingkaran satuan:** titik pada sudut $\theta$ adalah $(\cos\theta,\sin\theta)$; tanda: semua, sinus, tangen, kosinus di kuadran I sampai IV; sudut acuan; periode $360^\circ$ (tangen $180^\circ$); $\sin(-\theta)=-\sin\theta$, $\cos(-\theta)=\cos\theta$. - **Persamaan:** $\sin x=c$: $\alpha$ dan $180^\circ-\alpha$; $\cos x=c$: $\pm\alpha$; $\tan x=c$: $\alpha$ dan $\alpha+180^\circ$; tambahkan putaran. - **Identitas:** $\sin^2x+\cos^2x=1$, $\tan x=\frac{\sin x}{\cos x}$, $\sin(90^\circ-x)=\cos x$, $\sin2x=2\sin x\cos x$, $\sin(x+y)=\sin x\cos y+\cos x\sin y$; satu contoh penyangkal membantah, bukti diperlukan untuk memastikan. - **Grafik:** $y=a\sin(b(x-c))+d$ memiliki amplitudo $|a|$, periode $\frac{360^\circ}{b}$, pergeseran fase $c$, garis tengah $d$. - **Kode:** radian untuk `sin` dan `cos`; bandingkan dengan toleransi; `atan2` untuk sudut; fungsi invers hanya memberi satu penyelesaian. ## Glosarium: istilah penting - **Trigonometri**: Cabang matematika yang menghubungkan sudut segitiga dengan panjang sisinya, melalui sinus, kosinus, dan tangen. - **Sisi miring**: Sisi segitiga siku-siku di depan sudut siku-siku, dan sisi terpanjangnya. - **Sinus**: Untuk sudut lancip segitiga siku-siku, panjang sisi depan dibagi sisi miring; pada lingkaran satuan, koordinat-y titik pada sudut itu. - **Kosinus**: Untuk sudut lancip segitiga siku-siku, sisi samping dibagi sisi miring; pada lingkaran satuan, koordinat-x titik pada sudut itu. - **Tangen**: Sisi depan dibagi sisi samping, yang sama dengan sinus dibagi kosinus; ia tak terdefinisi di tempat kosinus bernilai nol. - **Lingkaran satuan**: Lingkaran berjari-jari 1 berpusat di titik asal, dipakai untuk mendefinisikan sinus dan kosinus untuk setiap sudut. - **Sudut acuan**: Sudut lancip antara kaki terminal sebuah sudut dan sumbu-x; nilai fungsi pada sudut itu sama dengan pada sudut acuan kecuali tandanya. - **Sudut elevasi**: Sudut di atas garis mendatar saat kita memandang ke atas sebuah benda; sudut depresi adalah sudut yang sama diukur di bawah garis mendatar. - **Identitas trigonometri**: Persamaan yang memuat fungsi trigonometri yang benar untuk setiap sudut yang kedua ruasnya terdefinisi, seperti sin kuadrat ditambah cos kuadrat sama dengan 1. - **Amplitudo dan periode**: Pada gelombang sinus atau kosinus, amplitudo adalah tinggi dari garis tengah ke puncak, dan periode adalah panjang satu siklus penuh. ## Pertanyaan yang sering diajukan ### Apa itu sinus, kosinus, dan tangen? Ketiganya adalah perbandingan dasar segitiga siku-siku untuk salah satu sudut lancipnya: sinus adalah depan per miring, kosinus adalah samping per miring, dan tangen adalah depan per samping. Ketiganya hanya bergantung pada sudut. ### Apa arti sin-de-mi, cos-sa-mi, tan-de-sa? Itu alat bantu ingatan: sin-de-mi berarti sinus adalah sisi depan per sisi miring, cos-sa-mi berarti kosinus adalah sisi samping per sisi miring, dan tan-de-sa berarti tangen adalah sisi depan per sisi samping. Sisi-sisi dinamai dari sudut yang dilihat. ### Bagaimana mencari sisi segitiga siku-siku dengan trigonometri? Pilih perbandingan yang memuat sisi yang diketahui dan sisi yang dicari, tulis sebagai persamaan, dan selesaikan. Misalnya dengan sudut 35 derajat dan sisi samping 40, sisi depannya adalah 40 kali tan 35. ### Berapa nilai eksak sin, cos, dan tan untuk 30, 45, dan 60 derajat? Sinus adalah setengah, akar 2 per 2, dan akar 3 per 2; kosinus adalah daftar yang sama dari belakang; tangen adalah akar 3 per 3, 1, dan akar 3. Nilai-nilai itu berasal dari setengah segitiga sama sisi dan setengah persegi. ### Apa itu lingkaran satuan dalam trigonometri? Itu adalah lingkaran berjari-jari 1 di sekitar titik asal. Titik yang dicapai dengan berputar sebesar sudut dari sumbu-x positif memiliki koordinat kosinus dan sinus sudut itu, yang mendefinisikan fungsi untuk setiap sudut. ### Mengapa tan 90 derajat tak terdefinisi? Tangen adalah sinus dibagi kosinus, dan pada 90 derajat kosinus bernilai 0 sedangkan sinus 1, sehingga pembagiannya tidak bernilai. Grafik tangen naik tanpa batas di dekat 90 derajat. ### Apakah sin(a + b) sama dengan sin a + sin b? Tidak. Rumus yang benar adalah sin a cos b ditambah cos a sin b. Untuk 30 dan 60 derajat ruas kirinya sin 90, yaitu 1, sedangkan sin 30 ditambah sin 60 sekitar 1,366. ### Mengapa kalkulator saya memberi jawaban salah untuk sin 30? Kemungkinan ia dalam mode radian, di mana 30 berarti 30 radian dan sinusnya sekitar minus 0,988. Ganti ke mode derajat untuk mendapat 0,5. Bahasa pemrograman selalu memakai radian, jadi ubah derajat dulu. --- # Constructing Segments and Angles with a Ruler and Compass Source: https://nunada.my.id/articles/constructing-segments-and-angles/ Updated: 2026-10-24 ## Quick answer **A geometric construction draws a figure with only an unmarked ruler and a compass: the ruler draws a line through two points, the compass draws a circle, and every new point must be a crossing of lines and circles already drawn.** With them you can copy a segment or an angle, find a midpoint, bisect an angle, draw perpendiculars and parallels, and make $60^\circ$, $90^\circ$, $30^\circ$ and $45^\circ$ exactly; you cannot trisect a general angle. ### Key takeaways - A construction uses two tools: a ruler without numbers (a straightedge) and a compass. There are three allowed moves: draw the line through two points, draw the circle around a point through another, and mark a point where two lines or circles cross. A construction is exact and comes with a proof, which a drawing with a protractor never does. - To copy a segment, set the compass to its length and swing an arc from the new point. To find the midpoint, draw two circles of the same radius around the ends: the line through their two crossings is the perpendicular bisector. Both rest on one fact: a point on the bisector is equally far from both ends. - An equilateral triangle on a segment gives $60^\circ$. To bisect an angle, draw an arc around the vertex, then two arcs of equal radius around the points where it cuts the arms. To copy an angle, copy its chord with the compass. All three are proved by congruent triangles with three equal sides (SSS). - A perpendicular is the perpendicular bisector of two points marked on the line with a circle; a parallel is the opposite side of a rhombus. From $60^\circ$, $90^\circ$, halving, adding and subtracting you get $30^\circ$, $45^\circ$, $15^\circ$, $75^\circ$ and more; with the pentagon's $72^\circ$ you reach every whole number of degrees that is a multiple of $3$ and no other. - Equal steps along any ray and parallel lines cut a segment into $n$ equal parts (the intercept theorem). But a ruler and compass cannot trisect a general angle, double a cube or square a circle: they only reach numbers whose degree over the rationals is a power of $2$. A regular $n$-gon can be built exactly when $n$ is a power of $2$ times different Fermat primes. - In code, a construction is the crossing of two circles: solve for the two points with the distance between the centers, and use `max(h², 0)` so that tangent circles do not give a square root of a tiny negative number. The test for buildable angles and polygons is Euler's $\varphi$ function. ## What does it mean to construct a figure in geometry? **A geometric construction is a drawing made with only two tools, an unmarked ruler and a compass, in which every new point has to be a crossing of lines and circles that are already drawn.** The ruler (called a straightedge in geometry) draws a straight line through two points; it has no numbers, so it cannot measure. The compass draws a circle, or just an arc of one, around a point, with a radius equal to a distance you already have. Nothing else is allowed: no protractor, no marks on the ruler, no placing a point by eye. Why work so strictly? Because a construction is exact and provable. A figure drawn with a protractor is only as good as the width of the pencil line, while a construction comes with a reason (usually that two triangles have three equal sides) which shows that the result is exactly right, however carefully or carelessly you draw. This is how Euclid built geometry in the Elements around 300 BC, and why a bisected angle or a perpendicular bisector is still the first thing a geometry course teaches you to draw. | | Drawing with a ruler and protractor | Constructing with a ruler and compass | |---|---|---| | Tools | ruler with numbers, protractor | ruler without numbers, compass | | How a length is made | measured in cm | copied with the compass | | How good is it | as good as your reading | exact, and proved | | What it teaches | how to measure | why it is true | > **The three allowed moves** > > - **Line:** draw the line through two points that already exist. > - **Circle:** draw the circle around a point that exists, with a radius equal to the distance between two points that exist (often: through another point that exists). > - **Point:** mark a new point where two of the lines and circles you have drawn cross. > > Every construction in this article is a list of these three moves and nothing else; the interactive drawings below check that rule on every step. > **A compass that folds, or one that stays open?** > > Euclid's compass collapses when it is lifted off the paper, so it cannot carry a length from one place to another. A school compass keeps its opening. Euclid's Proposition I.2 shows that the two are equivalent: whatever one can build, the other can too. In this article the compass keeps its opening, which is how the tool really behaves. ## How do you copy, add and subtract line segments? **To copy a segment $AB$ onto a ray that starts at $C$, open the compass until its point is on $A$ and its pencil on $B$, then put the point on $C$ and swing an arc across the ray: the crossing $D$ gives $CD=AB$.** The ruler is used only to draw the ray. The compass does the measuring without any numbers, because it keeps its opening, so every point of the arc is exactly the length $AB$ from $C$. 1. Draw a ray from $C$ (or use the one you have). 2. Open the compass from $A$ to $B$. 3. Keep that opening, put the point on $C$ and draw an arc that crosses the ray at $D$. With this one move you can do arithmetic on lengths: - **Add** two segments: copy the first onto a ray from $C$, ending at $D$; then put the compass point on $D$ and copy the second one further along the same ray, ending at $E$. Then $CE$ is the sum. - **Subtract**: copy the longer segment onto a ray, then copy the shorter one from its end back towards $C$. What is left is the difference. - **Multiply by a whole number**: copy the same segment end to end, $2$, $3$, $4$ times. Lengths here are copied, never read: you may not know in centimetres how long $AB$ is, and you do not need to. If you choose one segment as the unit, the same moves give lengths such as $2$, $3$ or $\frac{3}{2}$ times it. ## How do you find the midpoint and perpendicular bisector of a segment? **Draw two circles of the same radius around the ends $A$ and $B$ of the segment; the line through their two crossings $P$ and $Q$ is the perpendicular bisector of $AB$, and it meets $AB$ at its midpoint $M$.** The perpendicular bisector is the line that cuts a segment in half at a right angle; it is also the set of all points that are equally far from $A$ and from $B$. 1. Open the compass to more than half of $AB$ (the length $AB$ itself is a good choice). 2. Put the point on $A$ and draw an arc above the segment and another below it. 3. Keep the same opening, put the point on $B$ and draw two arcs that cross the first two, at $P$ above and $Q$ below. 4. Draw the line $PQ$ with the ruler. It crosses $AB$ at the midpoint $M$ and is perpendicular to it. **Why it works.** Both circles have the same radius, so $PA=PB=QA=QB$: the quadrilateral $APBQ$ has four equal sides, which makes it a rhombus. The diagonals of a rhombus cut each other in half and meet at a right angle (see [the properties of quadrilaterals](https://nunada.my.id/articles/quadrilaterals/#properties)), and those diagonals are exactly $AB$ and $PQ$. Another way to see it: the triangles $APQ$ and $BPQ$ have three equal sides, so they are congruent, and the angles at $P$ are equal. This construction does a lot of work. Finding the midpoint of a side is the first step to the median of a triangle, and the perpendicular bisectors of two sides of a triangle meet at the center of its circumscribed circle (see [the centers of a triangle](https://nunada.my.id/articles/triangles/#centers)). ## How do you construct 60°, bisect an angle and copy an angle? **The three basic angle constructions all use circles of one single radius, and each is proved by two triangles with three equal sides (SSS).** **An equilateral triangle gives $60^\circ$.** This is Euclid's very first proposition. Draw the segment $AB$, then the circle around $A$ through $B$ and the circle around $B$ through $A$. They cross at $C$, and $CA=AB=CB$: three equal sides. The three angles of an equilateral triangle are equal and add up to $180^\circ$, so each is $60^\circ$ (see [the angles of a triangle](https://nunada.my.id/articles/triangles/#angle-sum)). **To bisect an angle** $POQ$ with vertex $O$: 1. Put the compass point on $O$ and draw an arc that crosses both arms, at $P$ and $Q$. 2. Put the point on $P$ and draw an arc inside the angle. 3. Keep the same opening, put the point on $Q$ and draw an arc that crosses the previous one at $R$. 4. Draw the ray $OR$. It cuts the angle into two equal angles. Why: the triangles $OPR$ and $OQR$ have $OP=OQ$ (the first arc), $PR=QR$ (the same opening) and the side $OR$ in common. Three equal sides make them congruent, so the angles $POR$ and $QOR$ are equal. If the second and third arcs also use the radius $OP$, then $O$, $P$, $R$, $Q$ form a rhombus, and a diagonal of a rhombus bisects its angle. **To copy an angle** $POQ$ onto a ray $ST$: 1. With the point on $O$, draw an arc that crosses the arms at $P$ and $Q$. Draw the same arc (the same opening) around $S$, crossing the ray $ST$ at $U$. 2. Open the compass to the distance $PQ$. 3. With the point on $U$, draw an arc that crosses the first arc at $V$. 4. Draw the ray $SV$. The angle $USV$ equals $POQ$. Why: the triangles $OPQ$ and $SUV$ have $OP=SU$, $OQ=SV$ and $PQ=UV$, all copied with the compass, so they are congruent by SSS and the angles at $O$ and $S$ are equal. Bisecting, copying and adding angles are the only moves you need to build every other angle (see [how angles are named and added](https://nunada.my.id/articles/angles/#types-and-pairs)). ## How do you draw a perpendicular line and a parallel line? **A perpendicular is the perpendicular bisector of two points that you mark on the line with a circle, and a parallel is the opposite side of a rhombus, so both come from the constructions above.** **A perpendicular at a point $C$ on a line.** 1. Put the compass point on $C$ and draw a circle that crosses the line at two points, $A$ on one side and $X$ on the other. They are the same distance from $C$. 2. Construct the perpendicular bisector of $AX$ (two circles of the same radius around $A$ and $X$). 3. That bisector goes through the midpoint of $AX$, which is $C$, and is perpendicular to the line. To make a right angle of $90^\circ$ at the end of a ray, extend the ray backwards and take $C$ to be the end. **A perpendicular from a point $C$ that is not on the line.** 1. Draw a circle around $C$ that cuts the line at two points, $A$ and $X$. 2. Construct the perpendicular bisector of $AX$. Because $CA=CX$, the point $C$ is on it. 3. The bisector is the perpendicular from $C$; it meets the line at the foot $F$, and $CF$ is the shortest way from $C$ to the line. **A parallel to a line $AB$ through a point $C$ that is not on it.** 1. Draw the circle around $A$ through $C$. It crosses the line at $X$. 2. With the same opening, draw a circle around $X$ and another around $C$. They cross at $A$ and at a second point $Q$. 3. Draw the line $CQ$. The four points $A$, $X$, $Q$, $C$ are the corners of a rhombus (four sides equal to the one opening), and opposite sides of a rhombus are parallel, so $CQ\parallel AB$. A second way to make a parallel is to copy an angle: draw any line through $C$ that crosses $AB$, copy the angle it makes with $AB$ so that it becomes the corresponding angle at $C$, and use the fact that equal corresponding angles mean parallel lines (see [lines cut by a transversal](https://nunada.my.id/articles/angles/#parallel-lines)). ## Can you watch every circle and line of each construction? **Pick a construction, step through it one circle or line at a time, and measure the finished drawing.** The drawing obeys the rule of the three moves: a new point can only appear where two things you have already drawn cross, and the program refuses any other step. Press another drawing to run the same construction on a new segment or angle: the measurements stay exact because the proof does not depend on where the points are. ## Which angles can be built with a ruler and compass? **Starting from $60^\circ$ and $90^\circ$ and using only halving, adding and subtracting, you can build $30^\circ$, $45^\circ$, $15^\circ$, $75^\circ$, $105^\circ$, $120^\circ$, $135^\circ$, $150^\circ$ and many more, but not $20^\circ$ or $1^\circ$.** Each of the rows below is a few moves of the constructions above. | Angle | How | |---|---| | $90^\circ$ | a perpendicular | | $60^\circ$ | an equilateral triangle | | $30^\circ$ | half of $60^\circ$ | | $45^\circ$ | half of $90^\circ$ | | $15^\circ$ | half of $30^\circ$ | | $75^\circ$ | $60^\circ+15^\circ$ | | $105^\circ$ | $90^\circ+15^\circ$ | | $120^\circ$ | $60^\circ+60^\circ$ | | $135^\circ$ | $90^\circ+45^\circ$ | | $150^\circ$ | $90^\circ+60^\circ$ | There is one more building block, found by the Greeks: the regular pentagon. Its central angle is $72^\circ$, because $\cos72^\circ=\frac{\sqrt5-1}{4}$ and a square root is something a compass can make (a circle of radius $\frac{\sqrt5}{2}$ around the midpoint of a radius, and two more bisections). From $72^\circ$ you get $36^\circ$, $18^\circ$ and, subtracting $60^\circ$, $12^\circ$. And then $15^\circ-12^\circ=3^\circ$: **an angle of one degree is out of reach, but one of three degrees is not.** **The whole degrees that can be built are exactly the multiples of $3$.** Every multiple of $3$ is reached by adding and subtracting copies of $3^\circ$. For the others, suppose $n^\circ$ could be built with $n$ not a multiple of $3$. Then $n$ and $3$ have no common factor, so there are whole numbers $a$ and $b$ with $an+3b=1$, and adding and subtracting copies of $n^\circ$ and $3^\circ$ would build $1^\circ$. But $1^\circ$ cannot be built, as the section on impossible constructions explains. Type any whole number of degrees below and you get the cheapest recipe and the finished drawing, or the reason why none exists. ## How do you divide a segment into equal parts? **To divide $AB$ into $n$ equal parts, step $n$ equal lengths off a ray from $A$, join the last mark to $B$, and draw parallels to that line through the other marks; they cut $AB$ into $n$ equal parts.** The reason is the intercept theorem: parallel lines that cut equal pieces from one transversal cut equal pieces from every other. Here is the construction for $n=3$. 1. Draw a ray from $A$ at any angle to $AB$. 2. Choose any compass opening and step off three equal lengths along the ray, from $A$: the marks $D_1$, $D_2$, $D_3$. 3. Draw the line $D_3B$. 4. Draw the parallels to $D_3B$ through $D_2$ and $D_1$ (see the rhombus method above). They cross $AB$ at $K_2$ and $K_1$. 5. $AK_1=K_1K_2=K_2B$. The same moves divide a segment in a given ratio: to cut $AB$ in the ratio $2:3$, divide it into $5$ equal parts and take the second mark. Dividing a segment into two equal parts is the perpendicular bisector, which is quicker than this method. And because you can build $\frac{a}{n}$ of any length, the lengths you can make from one unit segment include every fraction. The drawing below plays the whole construction for $2$ to $10$ parts; the table at the end measures every mark against $\frac{k}{n}$ of the way from $A$ to $B$. ## What can never be built with a ruler and compass? **A general angle cannot be divided into three equal parts, a cube cannot be doubled and a circle cannot be squared with a ruler and compass; each was proved impossible in the nineteenth century.** The three problems were open for more than two thousand years. The answer is not that nobody was clever enough, but that the tools reach only certain numbers. **What numbers can be built?** Take a unit length. The three moves can only produce the numbers you get from $1$ by adding, subtracting, multiplying, dividing and taking square roots, because crossing a line with a line leads to a linear equation and crossing a line or circle with a circle leads to a quadratic one. Each square root at most doubles the degree of a number over the rationals (the smallest degree of a whole-number polynomial that has it as a root). So a number that can be built has a degree that is a power of $2$: $1$, $2$, $4$, $8$, … This is Wantzel's theorem (1837). **Why $20^\circ$ cannot be built.** The triple-angle identity says $\cos3\varphi=4\cos^3\varphi-3\cos\varphi$. Put $\varphi=20^\circ$ and $\cos60^\circ=\frac12$, and $x=\cos20^\circ$ satisfies $8x^3-6x-1=0$. This cubic has no rational root (the only candidates are $\pm1$, $\pm\frac12$, $\pm\frac14$, $\pm\frac18$, and none works), so it cannot be split, and $\cos20^\circ$ has degree $3$. Three is not a power of $2$, so $20^\circ$ cannot be built, and an angle of $60^\circ$ cannot be trisected. If $1^\circ$ could be built, so could $20^\circ$ (twenty copies), which is why no whole degree outside the multiples of $3$ can. **The three classical problems.** - **Trisecting an angle:** possible for special angles ($90^\circ$ gives $30^\circ$), impossible in general ($60^\circ$ gives $20^\circ$). - **Doubling the cube:** a cube of twice the volume needs an edge of $\sqrt[3]{2}$ times the old one, a number of degree $3$. - **Squaring the circle:** a square of the same area as a circle of radius $1$ needs a side $\sqrt\pi$. Lindemann proved in 1882 that $\pi$ is transcendental, which means it is not a root of any whole-number polynomial, so $\sqrt\pi$ is out of reach too (see [π and the transcendental numbers](https://nunada.my.id/articles/irrational-numbers/#pi-e-transcendental)). **Other tools can do it.** Archimedes trisected any angle with a ruler that has two marks one unit apart (a marked ruler, called neusis in Greek). Put the ruler through $B$ so that one mark is on the circle at $C$ and the other is on the line $AO$ extended, at $D$; the angle at $D$ is exactly one third of the angle at $O$. Paper folding (origami) and some other curves can also trisect an angle. The impossibility is about the ruler and compass alone. The drawing below shows Archimedes' trisection for any angle, and tells you whether a ruler and compass alone could have done it. ## Which regular polygons can be built with a ruler and compass? **A regular polygon with $n$ sides can be built exactly when $n$ is a power of $2$ times different Fermat primes ($3$, $5$, $17$, $257$, $65537$); the first few are $3$, $4$, $5$, $6$, $8$, $10$, $12$, $15$, $16$, $17$.** This is the Gauss–Wantzel theorem. Carl Friedrich Gauss found at 18 that the regular 17-gon can be built, published it in 1801, and asked for one on his gravestone; Pierre Wantzel proved in 1837 that no other regular polygons can. Why those numbers? Building the $n$-gon means building the angle $\frac{360^\circ}{n}$, that is, the number $\cos\frac{2\pi}{n}$, whose degree over the rationals is $\frac{\varphi(n)}{2}$ for $n\ge3$. Here $\varphi(n)$ is Euler's function, the count of whole numbers from $1$ to $n$ that share no factor with $n$. That degree is a power of $2$ exactly when $\varphi(n)$ is, and $\varphi(n)$ is a power of $2$ exactly when $n$ is a power of $2$ times different primes of the form $2^{2^k}+1$ (Fermat primes). The only five known are $3$, $5$, $17$, $257$ and $65537$. - **Pentagon ($5$):** $\cos72^\circ=\frac{\sqrt5-1}{4}$, one square root. Built by the Greeks. - **Heptagon ($7$) and nonagon ($9$):** $\varphi(7)=6$ and $\varphi(9)=6$ are not powers of $2$, so they cannot be built. The $9$-gon would need the trisection of $120^\circ$, which is impossible. - **17-gon:** $\varphi(17)=16$, and $\cos\frac{2\pi}{17}$ needs three nested layers of square roots. - **257-gon and 65537-gon:** built on paper by Richelot (1832) and by Hermes (1894, after about ten years of work). Type a number of sides to see why a polygon can or cannot be built. ## How do you do a construction in code? **In a program a construction is the crossing of two circles (or of a line and a circle) computed from the distance between the centers.** For circles of radii $r_1$ and $r_2$ whose centers are $d$ apart, the crossings lie at the distance $a=\frac{r_1^2-r_2^2+d^2}{2d}$ from the first center along the line between the centers, and at the height $h=\sqrt{r_1^2-a^2}$ on both sides of it. If $d>r_1+r_2$ or $d<|r_1-r_2|$ the circles miss each other and there is no point. Two details matter in floating-point arithmetic (see [why floating-point sums are not exact](https://nunada.my.id/articles/floating-point-numbers/)). First, when the circles only touch, $r_1^2-a^2$ can come out as $-10^{-17}$, so take `max(h², 0)` before the square root. Second, never compare lengths with `==`: two distances that are equal on paper differ in the last digit, so compare with a small tolerance, and measure angles with `atan2`. The program builds the lens of the perpendicular bisector for $A=(0,0)$ and $B=(4,0)$, checks that the upper crossing makes an equilateral triangle, and tests which whole degrees and which polygons are buildable with Euler's $\varphi$ function. ```python import math def circles_meet(c1, r1, c2, r2): """The two points where two circles cross, the one on the left of c1 -> c2 first; None if they miss.""" dx, dy = c2[0] - c1[0], c2[1] - c1[1] d = math.hypot(dx, dy) if d == 0 or d > r1 + r2 or d < abs(r1 - r2): return None a = (r1 * r1 - r2 * r2 + d * d) / (2 * d) h = math.sqrt(max(r1 * r1 - a * a, 0.0)) # rounding can leave -1e-17 when the circles only touch mx, my = c1[0] + a * dx / d, c1[1] + a * dy / d return (mx - h * dy / d, my + h * dx / d), (mx + h * dy / d, my - h * dx / d) def totient(n): return sum(1 for k in range(1, n + 1) if math.gcd(k, n) == 1) def is_power_of_two(n): return n >= 1 and n & (n - 1) == 0 def angle_buildable(deg): """A whole number of degrees can be built when cos(deg) has a degree that is a power of two.""" m = 360 // math.gcd(deg, 360) return is_power_of_two(1 if m <= 2 else totient(m) // 2) def polygon_buildable(n): return n >= 3 and is_power_of_two(totient(n)) A, B = (0.0, 0.0), (4.0, 0.0) P, Q = circles_meet(A, 4, B, 4) # the lens of the perpendicular bisector print([round(v, 4) for v in P], [round(v, 4) for v in Q]) # [2.0, 3.4641] [2.0, -3.4641] print(round(math.dist(P, A), 4), round(math.dist(P, B), 4), round(math.dist(A, B), 4)) # 4.0 4.0 4.0 print(round(math.degrees(math.atan2(P[1] - A[1], P[0] - A[0])), 4)) # 60.0: the angle PAB print([d for d in range(1, 31) if angle_buildable(d)]) # [3, 6, 9, 12, 15, 18, 21, 24, 27, 30] print([n for n in range(3, 41) if polygon_buildable(n)]) # [3, 4, 5, 6, 8, 10, 12, 15, 16, 17, 20, 24, 30, 32, 34, 40] print(circles_meet((0, 0), 1, (5, 0), 1)) # None: too far apart ``` ```javascript const circlesMeet = ([x1, y1], r1, [x2, y2], r2) => { const dx = x2 - x1, dy = y2 - y1 const d = Math.hypot(dx, dy) if (d === 0 || d > r1 + r2 || d < Math.abs(r1 - r2)) return null const a = (r1 * r1 - r2 * r2 + d * d) / (2 * d) const h = Math.sqrt(Math.max(r1 * r1 - a * a, 0)) // rounding can leave -1e-17 when the circles only touch const mx = x1 + (a * dx) / d, my = y1 + (a * dy) / d return [[mx - (h * dy) / d, my + (h * dx) / d], [mx + (h * dy) / d, my - (h * dx) / d]] } const gcd = (a, b) => (b === 0 ? a : gcd(b, a % b)) const totient = (n) => { let t = 0; for (let k = 1; k <= n; k++) if (gcd(k, n) === 1) t++; return t } const isPowerOfTwo = (n) => n >= 1 && (n & (n - 1)) === 0 const angleBuildable = (deg) => { const m = 360 / gcd(deg, 360); return isPowerOfTwo(m <= 2 ? 1 : totient(m) / 2) } const polygonBuildable = (n) => n >= 3 && isPowerOfTwo(totient(n)) const [P, Q] = circlesMeet([0, 0], 4, [4, 0], 4) ;[P.map((v) => +v.toFixed(4)), Q.map((v) => +v.toFixed(4))] // [[2, 3.4641], [2, -3.4641]] ;+(Math.atan2(P[1], P[0]) * 180 / Math.PI).toFixed(4) // 60 Array.from({ length: 30 }, (_, i) => i + 1).filter(angleBuildable) // [3, 6, 9, 12, 15, 18, 21, 24, 27, 30] Array.from({ length: 38 }, (_, i) => i + 3).filter(polygonBuildable) // [3, 4, 5, 6, 8, 10, 12, 15, 16, 17, 20, 24, 30, 32, 34, 40] circlesMeet([0, 0], 1, [5, 0], 1) // null: too far apart ``` ```cpp #include #include #include using namespace std; double px, py, qx, qy; // the two crossings, set by circlesMeet int circlesMeet(double x1, double y1, double r1, double x2, double y2, double r2) { double dx = x2 - x1; double dy = y2 - y1; double d = sqrt(dx * dx + dy * dy); if (d == 0 || d > r1 + r2 || d < fabs(r1 - r2)) return 0; double a = (r1 * r1 - r2 * r2 + d * d) / (2 * d); double h2 = r1 * r1 - a * a; double h = h2 > 0 ? sqrt(h2) : 0; // rounding can leave -1e-17 when the circles only touch double mx = x1 + a * dx / d; double my = y1 + a * dy / d; px = mx - h * dy / d; py = my + h * dx / d; qx = mx + h * dy / d; qy = my - h * dx / d; return 1; } int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); } int totient(int n) { int result = n; int m = n; for (int p = 2; p * p <= m; p++) { if (m % p == 0) { while (m % p == 0) m /= p; result -= result / p; } } if (m > 1) result -= result / m; return result; } int isPowerOfTwo(int n) { return n >= 1 && (n & (n - 1)) == 0; } int angleBuildable(int deg) { int m = 360 / gcd(deg, 360); return isPowerOfTwo(m <= 2 ? 1 : totient(m) / 2); } int main() { circlesMeet(0, 0, 4, 4, 0, 4); printf("%.4f %.4f %.4f %.4f\n", px, py, qx, qy); printf("%.1f\n", atan2(py, px) * 180.0 / 3.14159265358979323846); for (int d = 1; d <= 30; d++) if (angleBuildable(d)) printf("%d ", d); printf("\n"); for (int n = 3; n <= 40; n++) if (isPowerOfTwo(totient(n))) printf("%d ", n); printf("\n"); printf("%d\n", circlesMeet(0, 0, 1, 5, 0, 1)); return 0; } /* output: 2.0000 3.4641 2.0000 -3.4641 60.0 3 6 9 12 15 18 21 24 27 30 3 4 5 6 8 10 12 15 16 17 20 24 30 32 34 40 0 */ ``` ## Where do ruler-and-compass constructions come from? **Construction is the oldest way of doing geometry, and the question of what it can and cannot do took two thousand years to answer.** - **About 300 BC.** Euclid's Elements begins with the equilateral triangle and builds on the ruler and compass alone: bisecting an angle and a segment, perpendiculars, parallels, copying an angle, and the regular pentagon (Books I and IV). Book VI divides a segment into equal parts by the intercept theorem. - **About 250 BC.** Archimedes trisects an angle with a marked ruler. Greek geometers tried for centuries to trisect an angle, double a cube and square a circle with the ruler and compass alone. - **1672 and 1797.** Georg Mohr and, independently, Lorenzo Mascheroni show that every point that can be built with a ruler and compass can be built with the compass alone. - **1796.** Gauss, aged 18, builds the regular 17-gon, the first new regular polygon since antiquity, and publishes the general rule in 1801. - **1832.** Friedrich Richelot gives the construction of the 257-gon. - **1837.** Pierre Wantzel proves that the doubling of the cube and the trisection of a general angle are impossible, and that Gauss's list of polygons is complete. - **1882.** Ferdinand von Lindemann proves that $\pi$ is transcendental, which ends the squaring of the circle. - **1894.** Johann Gustav Hermes finishes the construction of the 65537-gon, after about ten years. ## What are the common mistakes in constructions? **The most common mistakes in constructions are the eight below, each with the correct statement.** | Mistake | Correct | |---|---| | ❌ Read a length off the ruler (“5 cm”) | The ruler only draws lines. Copy a length with the compass; it keeps its opening. | | ❌ Change the compass opening between the two arcs of a bisector | Keep one opening, so the four sides are equal and the figure is a rhombus. | | ❌ Use an opening too small for the arcs to cross | To find a midpoint the opening must be more than half the segment. | | ❌ Make $60^\circ$ with a protractor and call it a construction | Draw the equilateral triangle; its angles are exactly $60^\circ$ by SSS. | | ❌ A construction is “drawing carefully” | It is a list of allowed moves with a proof; careless pencil work does not change the proof. | | ❌ Any whole number of degrees can be built if you are careful | Only the multiples of $3$; $1^\circ$ and $20^\circ$ are impossible. | | ❌ Trisecting an angle is impossible with any tool | Only with a ruler and compass alone; a marked ruler or paper folding can do it. | | ❌ Every regular polygon can be built, such as the heptagon | Only when $n$ is a power of $2$ times different Fermat primes; $7$ and $9$ cannot. | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: constructions at a glance - **Rules:** an unmarked ruler and a compass; three moves (line through two points, circle around a point, point at a crossing); the construction is exact and has a proof. - **Copy a segment:** set the compass to its length and swing an arc from the new point; add and subtract by copying end to end or back. - **Perpendicular bisector and midpoint:** two circles of one radius around the ends, join their crossings; justified by a rhombus or by SSS. - **Angles:** equilateral triangle $\to60^\circ$; bisect with an arc and two equal arcs; copy by copying the chord; all by SSS. - **Perpendicular and parallel:** the perpendicular bisector of two marked points; the opposite side of a rhombus. - **Special angles:** $90^\circ$, $60^\circ$, $30^\circ$, $45^\circ$, $15^\circ$, $75^\circ$, $120^\circ$, $135^\circ$, $150^\circ$ from halving, adding and subtracting; with $72^\circ$, every whole number of degrees that is a multiple of $3$. - **Equal parts:** equal steps on a ray and parallels (intercept theorem). - **Impossible:** trisecting a general angle, doubling the cube, squaring the circle; the buildable numbers have degrees that are powers of $2$. - **Polygons:** the regular $n$-gon is buildable exactly when $\varphi(n)$ is a power of $2$, that is, $n$ is a power of $2$ times different Fermat primes. - **Code:** the crossing of two circles from $a=\frac{r_1^2-r_2^2+d^2}{2d}$ and $h=\sqrt{r_1^2-a^2}$; `max(h², 0)` and a tolerance. ## Glossary: key terms - **Geometric construction**: A figure drawn with only an unmarked ruler and a compass, where every new point is a crossing of lines and circles already drawn. - **Straightedge**: A ruler without any marks, used only to draw a straight line through two points. - **Perpendicular bisector**: The line that cuts a segment in half at a right angle; every point on it is equally far from the two ends. - **Angle bisector**: The ray from the vertex of an angle that divides it into two equal angles. - **Rhombus**: A quadrilateral with four equal sides; its diagonals bisect each other at right angles and bisect its angles. - **Constructible number**: A number that can be made as a length from a unit length with a ruler and compass; it is obtained from 1 by adding, subtracting, multiplying, dividing and taking square roots. - **Degree of a number**: The smallest degree of a polynomial with whole-number coefficients that has the number as a root; a constructible number has a degree that is a power of 2. - **Fermat prime**: A prime of the form 2 to the power 2^k, plus 1; only five are known: 3, 5, 17, 257 and 65537. - **Euler's totient function**: The number of whole numbers from 1 to n that have no common factor with n, written phi of n. - **Neusis**: A construction that uses a ruler with two marks, which can trisect any angle although a plain ruler and compass cannot. ## Frequently asked questions ### What tools are allowed in a geometric construction? Only an unmarked ruler (a straightedge) and a compass. The ruler draws a line through two points, the compass draws a circle, and a new point may only be made where lines and circles already drawn cross. ### How do you find the midpoint of a segment with a compass? Draw an arc of the same radius, more than half the segment, around each end, once above and once below. Join the two crossings with a ruler; the line meets the segment at its midpoint, at a right angle. ### How do you bisect an angle with a compass? Draw an arc around the vertex to cut both arms, then draw two arcs of the same radius around those two points so that they cross inside the angle. The ray from the vertex through that crossing bisects the angle. ### How do you construct a 60-degree angle? Draw a segment AB, then circles around A through B and around B through A. They cross at C, and triangle ABC has three equal sides, so every angle is 60 degrees. The angle at A is the 60-degree angle. ### How do you copy an angle with a compass and straightedge? Draw the same arc around the old vertex and the new one, measure the chord of the old angle with the compass, and mark it on the new arc. The ray through the mark makes an equal angle, because the triangles have three equal sides. ### Which angles can be constructed with a compass and straightedge? Starting from 60 and 90 degrees you can halve, add and subtract, and with the pentagon angle of 72 degrees you reach every whole number of degrees that is a multiple of 3. One degree and 20 degrees cannot be built. ### Why can an angle not be trisected with a compass and straightedge? A third of 60 degrees needs the cosine of 20 degrees, which is a root of a cubic with no simpler factor. A ruler and compass only reach numbers whose degree is a power of 2, and 3 is not, as Wantzel proved in 1837. ### Which regular polygons can be constructed? A regular polygon with n sides can be built when n is a power of 2 times different Fermat primes (3, 5, 17, 257, 65537). So the triangle, square, pentagon, hexagon, octagon and 17-gon can, but the heptagon and nonagon cannot. --- # Melukis Ruas Garis dan Sudut dengan Penggaris dan Jangka Source: https://nunada.my.id/artikel/melukis-ruas-garis-dan-sudut/ Updated: 2026-10-24 ## Jawaban singkat **Melukis dalam geometri berarti menggambar bangun hanya dengan penggaris tanpa skala dan jangka: penggaris menarik garis melalui dua titik, jangka menggambar lingkaran, dan setiap titik baru harus berupa perpotongan garis dan lingkaran yang sudah digambar.** Dengan keduanya kita dapat menyalin ruas garis atau sudut, mencari titik tengah, membagi dua sudut, membuat garis tegak lurus dan sejajar, serta membuat $60^\circ$, $90^\circ$, $30^\circ$, dan $45^\circ$ dengan tepat; sudut sembarang tidak dapat dibagi tiga. ### Poin penting - Lukisan memakai dua alat: penggaris tanpa angka dan jangka. Ada tiga langkah yang boleh: menarik garis melalui dua titik, menggambar lingkaran berpusat di satu titik melalui titik lain, dan menandai titik tempat dua garis atau lingkaran berpotongan. Lukisan itu tepat dan disertai bukti, sesuatu yang tidak dimiliki gambar dengan busur derajat. - Untuk menyalin ruas garis, atur jangka sepanjang ruas itu dan ayunkan busur dari titik yang baru. Untuk mencari titik tengah, gambar dua lingkaran berjari-jari sama di kedua ujung: garis melalui kedua titik potongnya adalah garis sumbu. Keduanya bertumpu pada satu fakta: titik pada garis sumbu sama jauh dari kedua ujung. - Segitiga sama sisi pada sebuah ruas garis memberi $60^\circ$. Untuk membagi dua sudut, gambar busur berpusat di titik sudut, lalu dua busur berjari-jari sama berpusat di titik tempat busur itu memotong kaki sudut. Untuk menyalin sudut, salin tali busurnya dengan jangka. Ketiganya dibuktikan dengan segitiga kongruen yang memiliki tiga sisi sama (SSS). - Garis tegak lurus adalah garis sumbu dari dua titik yang ditandai pada garis dengan lingkaran; garis sejajar adalah sisi berhadapan sebuah belah ketupat. Dari $60^\circ$, $90^\circ$, membagi dua, menambah, dan mengurangi diperoleh $30^\circ$, $45^\circ$, $15^\circ$, $75^\circ$ dan lainnya; dengan $72^\circ$ dari segi lima tercapai setiap derajat bulat kelipatan $3$ dan tidak ada yang lain. - Langkah-langkah sama panjang sepanjang sebuah sinar dan garis-garis sejajar membagi ruas garis menjadi $n$ bagian sama (teorema intersep). Tetapi penggaris dan jangka tidak dapat membagi tiga sudut sembarang, menggandakan kubus, atau mengkuadratkan lingkaran: keduanya hanya mencapai bilangan yang derajatnya atas bilangan rasional adalah pangkat dari $2$. Segi-$n$ beraturan dapat dilukis tepat bila $n$ adalah pangkat dari $2$ dikali bilangan prima Fermat yang berbeda. - Dalam kode, sebuah lukisan adalah perpotongan dua lingkaran: hitung kedua titik dengan jarak antarpusat, dan pakai `max(h², 0)` agar lingkaran yang bersinggungan tidak memberi akar dari bilangan negatif yang sangat kecil. Uji untuk sudut dan segi banyak yang dapat dilukis adalah fungsi $\varphi$ Euler. ## Apa artinya melukis sebuah bangun dalam geometri? **Lukisan geometri adalah gambar yang dibuat hanya dengan dua alat, penggaris tanpa skala dan jangka, dengan setiap titik baru harus berupa perpotongan garis dan lingkaran yang sudah digambar.** Penggaris (dalam geometri disebut straightedge) menarik garis lurus melalui dua titik; ia tidak punya angka, jadi tidak dapat mengukur. Jangka menggambar lingkaran, atau hanya busurnya, berpusat di sebuah titik, dengan jari-jari sama dengan jarak yang sudah kita punya. Selain itu tidak boleh: tidak ada busur derajat, tidak ada skala pada penggaris, dan tidak ada menaruh titik dengan perkiraan mata. Mengapa seketat itu? Karena lukisan itu tepat dan dapat dibuktikan. Bangun yang digambar dengan busur derajat hanya sebaik tebal garis pensilnya, sedangkan lukisan disertai alasan (biasanya dua segitiga memiliki tiga sisi sama) yang menunjukkan bahwa hasilnya tepat, secermat atau seceroboh apa pun kita menggambar. Begitulah Euklides membangun geometri dalam Elements sekitar 300 SM, dan itu sebabnya membagi dua sudut atau melukis garis sumbu masih menjadi hal pertama yang diajarkan pelajaran geometri. | | Menggambar dengan penggaris dan busur derajat | Melukis dengan penggaris dan jangka | |---|---|---| | Alat | penggaris berangka, busur derajat | penggaris tanpa angka, jangka | | Cara membuat panjang | diukur dalam cm | disalin dengan jangka | | Seberapa baik | sebaik pembacaan kita | tepat, dan terbukti | | Yang diajarkan | cara mengukur | mengapa itu benar | > **Tiga langkah yang diperbolehkan** > > - **Garis:** tarik garis melalui dua titik yang sudah ada. > - **Lingkaran:** gambar lingkaran berpusat di sebuah titik yang ada, dengan jari-jari sama dengan jarak antara dua titik yang ada (sering kali: melalui titik lain yang ada). > - **Titik:** tandai titik baru tempat dua garis atau lingkaran yang sudah digambar berpotongan. > > Setiap lukisan dalam artikel ini adalah daftar ketiga langkah itu dan tidak ada yang lain; gambar interaktif di bawah memeriksa aturan itu pada setiap langkah. > **Jangka yang menutup, atau yang tetap terbuka?** > > Jangka Euklides menutup ketika diangkat dari kertas, sehingga tidak dapat membawa panjang dari satu tempat ke tempat lain. Jangka sekolah mempertahankan bukaannya. Proposisi I.2 Euklides menunjukkan bahwa keduanya setara: apa yang dapat dibangun satu, dapat dibangun yang lain. Dalam artikel ini jangka mempertahankan bukaannya, sesuai cara alat itu bekerja. ## Bagaimana menyalin, menjumlahkan, dan mengurangkan ruas garis? **Untuk menyalin ruas garis $AB$ pada sinar yang berawal di $C$, bukalah jangka sampai kakinya di $A$ dan pensilnya di $B$, lalu letakkan kaki jangka di $C$ dan ayunkan busur memotong sinar: titik potong $D$ memberi $CD=AB$.** Penggaris hanya dipakai untuk menarik sinar. Jangka mengukur tanpa angka, karena ia mempertahankan bukaannya, sehingga setiap titik pada busur berjarak tepat $AB$ dari $C$. 1. Tarik sinar dari $C$ (atau pakai yang sudah ada). 2. Bukalah jangka dari $A$ sampai $B$. 3. Pertahankan bukaan itu, letakkan kaki jangka di $C$ dan gambar busur yang memotong sinar di $D$. Dengan satu langkah ini kita dapat berhitung dengan panjang: - **Menjumlahkan** dua ruas garis: salin yang pertama pada sinar dari $C$, berakhir di $D$; lalu letakkan kaki jangka di $D$ dan salin yang kedua lebih jauh sepanjang sinar yang sama, berakhir di $E$. Maka $CE$ adalah jumlahnya. - **Mengurangkan**: salin ruas garis yang lebih panjang pada sebuah sinar, lalu salin yang lebih pendek dari ujungnya kembali ke arah $C$. Sisanya adalah selisihnya. - **Mengalikan dengan bilangan bulat**: salin ruas garis yang sama ujung ke ujung, $2$, $3$, $4$ kali. Panjang di sini disalin, tidak dibaca: kita mungkin tidak tahu berapa sentimeter panjang $AB$, dan tidak perlu tahu. Bila satu ruas garis dipilih sebagai satuan, langkah yang sama menghasilkan panjang seperti $2$, $3$, atau $\frac{3}{2}$ kali satuan itu. ## Bagaimana mencari titik tengah dan garis sumbu sebuah ruas garis? **Gambar dua lingkaran berjari-jari sama berpusat di ujung $A$ dan $B$ ruas garis; garis melalui kedua titik potongnya $P$ dan $Q$ adalah garis sumbu $AB$, dan ia memotong $AB$ di titik tengahnya $M$.** Garis sumbu adalah garis yang membagi sebuah ruas garis menjadi dua sama panjang dengan sudut siku-siku; ia juga himpunan semua titik yang sama jauh dari $A$ dan dari $B$. 1. Bukalah jangka lebih dari setengah $AB$ (panjang $AB$ sendiri adalah pilihan yang baik). 2. Letakkan kaki jangka di $A$ dan gambar satu busur di atas ruas garis dan satu lagi di bawahnya. 3. Pertahankan bukaan yang sama, letakkan kaki jangka di $B$ dan gambar dua busur yang memotong kedua busur pertama, di $P$ di atas dan $Q$ di bawah. 4. Tarik garis $PQ$ dengan penggaris. Ia memotong $AB$ di titik tengah $M$ dan tegak lurus padanya. **Mengapa berhasil.** Kedua lingkaran berjari-jari sama, jadi $PA=PB=QA=QB$: segi empat $APBQ$ memiliki empat sisi sama panjang, sehingga merupakan belah ketupat. Diagonal belah ketupat saling membagi dua dan berpotongan siku-siku (lihat [sifat-sifat segi empat](https://nunada.my.id/artikel/segiempat/#properties)), dan diagonal-diagonal itu tepat $AB$ dan $PQ$. Cara lain melihatnya: segitiga $APQ$ dan $BPQ$ memiliki tiga sisi sama, jadi kongruen, dan sudut-sudut di $P$ sama besar. Lukisan ini sangat berguna. Mencari titik tengah sisi adalah langkah pertama menuju garis berat segitiga, dan garis sumbu dua sisi segitiga bertemu di pusat lingkaran luarnya (lihat [titik-titik penting segitiga](https://nunada.my.id/artikel/segitiga/#centers)). ## Bagaimana melukis 60°, membagi dua sudut, dan menyalin sudut? **Tiga lukisan sudut dasar semuanya memakai lingkaran berjari-jari satu saja, dan masing-masing dibuktikan oleh dua segitiga yang memiliki tiga sisi sama (SSS).** **Segitiga sama sisi memberi $60^\circ$.** Ini proposisi pertama Euklides. Gambar ruas garis $AB$, lalu lingkaran berpusat di $A$ melalui $B$ dan lingkaran berpusat di $B$ melalui $A$. Keduanya berpotongan di $C$, dan $CA=AB=CB$: tiga sisi sama panjang. Ketiga sudut segitiga sama sisi sama besar dan berjumlah $180^\circ$, jadi masing-masing $60^\circ$ (lihat [sudut-sudut segitiga](https://nunada.my.id/artikel/segitiga/#angle-sum)). **Untuk membagi dua sudut** $POQ$ dengan titik sudut $O$: 1. Letakkan kaki jangka di $O$ dan gambar busur yang memotong kedua kaki sudut, di $P$ dan $Q$. 2. Letakkan kaki jangka di $P$ dan gambar busur di dalam sudut. 3. Pertahankan bukaan yang sama, letakkan kaki jangka di $Q$ dan gambar busur yang memotong busur sebelumnya di $R$. 4. Tarik sinar $OR$. Ia membagi sudut menjadi dua sudut sama besar. Mengapa: segitiga $OPR$ dan $OQR$ memiliki $OP=OQ$ (busur pertama), $PR=QR$ (bukaan yang sama), dan sisi $OR$ yang dipakai bersama. Tiga sisi sama membuatnya kongruen, jadi sudut $POR$ dan $QOR$ sama besar. Bila busur kedua dan ketiga juga memakai jari-jari $OP$, maka $O$, $P$, $R$, $Q$ membentuk belah ketupat, dan diagonal belah ketupat membagi dua sudutnya. **Untuk menyalin sudut** $POQ$ pada sinar $ST$: 1. Dengan kaki jangka di $O$, gambar busur yang memotong kaki sudut di $P$ dan $Q$. Gambar busur yang sama (bukaan yang sama) berpusat di $S$, memotong sinar $ST$ di $U$. 2. Bukalah jangka sebesar jarak $PQ$. 3. Dengan kaki jangka di $U$, gambar busur yang memotong busur pertama di $V$. 4. Tarik sinar $SV$. Sudut $USV$ sama dengan $POQ$. Mengapa: segitiga $OPQ$ dan $SUV$ memiliki $OP=SU$, $OQ=SV$, dan $PQ=UV$, semuanya disalin dengan jangka, jadi kongruen menurut SSS dan sudut di $O$ dan $S$ sama besar. Membagi dua, menyalin, dan menjumlahkan sudut adalah satu-satunya langkah yang diperlukan untuk membangun sudut lain (lihat [cara sudut dinamai dan dijumlahkan](https://nunada.my.id/artikel/sudut/#types-and-pairs)). ## Bagaimana melukis garis tegak lurus dan garis sejajar? **Garis tegak lurus adalah garis sumbu dari dua titik yang kita tandai pada garis dengan sebuah lingkaran, dan garis sejajar adalah sisi berhadapan sebuah belah ketupat, jadi keduanya berasal dari lukisan di atas.** **Garis tegak lurus di titik $C$ pada sebuah garis.** 1. Letakkan kaki jangka di $C$ dan gambar lingkaran yang memotong garis di dua titik, $A$ di satu sisi dan $X$ di sisi lain. Keduanya sama jauh dari $C$. 2. Lukis garis sumbu $AX$ (dua lingkaran berjari-jari sama berpusat di $A$ dan $X$). 3. Garis sumbu itu melalui titik tengah $AX$, yaitu $C$, dan tegak lurus pada garis. Untuk membuat sudut siku-siku $90^\circ$ di ujung sebuah sinar, perpanjang sinar itu ke belakang dan ambil $C$ sebagai ujungnya. **Garis tegak lurus dari titik $C$ yang tidak berada pada garis.** 1. Gambar lingkaran berpusat di $C$ yang memotong garis di dua titik, $A$ dan $X$. 2. Lukis garis sumbu $AX$. Karena $CA=CX$, titik $C$ berada di atasnya. 3. Garis sumbu itu adalah garis tegak lurus dari $C$; ia memotong garis di kaki $F$, dan $CF$ adalah jalan terpendek dari $C$ ke garis. **Garis sejajar $AB$ melalui titik $C$ yang tidak berada di atasnya.** 1. Gambar lingkaran berpusat di $A$ melalui $C$. Ia memotong garis di $X$. 2. Dengan bukaan yang sama, gambar lingkaran berpusat di $X$ dan satu lagi berpusat di $C$. Keduanya berpotongan di $A$ dan di titik kedua $Q$. 3. Tarik garis $CQ$. Keempat titik $A$, $X$, $Q$, $C$ adalah titik sudut belah ketupat (empat sisi sama dengan satu bukaan), dan sisi berhadapan belah ketupat sejajar, jadi $CQ\parallel AB$. Cara kedua membuat garis sejajar adalah menyalin sudut: tarik sembarang garis melalui $C$ yang memotong $AB$, salin sudut yang dibentuknya dengan $AB$ sehingga menjadi sudut sehadap di $C$, dan pakai fakta bahwa sudut sehadap yang sama besar berarti garis sejajar (lihat [garis yang dipotong garis lintang](https://nunada.my.id/artikel/sudut/#parallel-lines)). ## Dapatkah kita melihat setiap lingkaran dan garis tiap lukisan? **Pilih sebuah lukisan, ikuti satu lingkaran atau garis pada satu waktu, dan ukur gambar yang sudah jadi.** Gambar ini menaati aturan tiga langkah: titik baru hanya dapat muncul di tempat dua hal yang sudah kita gambar berpotongan, dan program menolak langkah lain. Tekan gambar lain untuk menjalankan lukisan yang sama pada ruas garis atau sudut yang baru: pengukurannya tetap tepat karena buktinya tidak bergantung pada letak titik-titiknya. ## Sudut mana yang dapat dilukis dengan penggaris dan jangka? **Mulai dari $60^\circ$ dan $90^\circ$ dan hanya memakai membagi dua, menambah, dan mengurangi, kita dapat membangun $30^\circ$, $45^\circ$, $15^\circ$, $75^\circ$, $105^\circ$, $120^\circ$, $135^\circ$, $150^\circ$ dan banyak lagi, tetapi bukan $20^\circ$ atau $1^\circ$.** Setiap baris di bawah adalah beberapa langkah dari lukisan di atas. | Sudut | Cara | |---|---| | $90^\circ$ | garis tegak lurus | | $60^\circ$ | segitiga sama sisi | | $30^\circ$ | setengah dari $60^\circ$ | | $45^\circ$ | setengah dari $90^\circ$ | | $15^\circ$ | setengah dari $30^\circ$ | | $75^\circ$ | $60^\circ+15^\circ$ | | $105^\circ$ | $90^\circ+15^\circ$ | | $120^\circ$ | $60^\circ+60^\circ$ | | $135^\circ$ | $90^\circ+45^\circ$ | | $150^\circ$ | $90^\circ+60^\circ$ | Ada satu bahan lagi, yang ditemukan bangsa Yunani: segi lima beraturan. Sudut pusatnya $72^\circ$, karena $\cos72^\circ=\frac{\sqrt5-1}{4}$ dan akar kuadrat adalah sesuatu yang dapat dibuat jangka (lingkaran berjari-jari $\frac{\sqrt5}{2}$ berpusat di titik tengah sebuah jari-jari, dan dua pembagian dua lagi). Dari $72^\circ$ diperoleh $36^\circ$, $18^\circ$ dan, dengan mengurangkan $60^\circ$, $12^\circ$. Lalu $15^\circ-12^\circ=3^\circ$: **sudut satu derajat tidak terjangkau, tetapi tiga derajat terjangkau.** **Derajat bulat yang dapat dilukis tepat adalah kelipatan $3$.** Setiap kelipatan $3$ dicapai dengan menambah dan mengurangi salinan $3^\circ$. Untuk yang lain, misalkan $n^\circ$ dapat dilukis dengan $n$ bukan kelipatan $3$. Maka $n$ dan $3$ tidak punya faktor persekutuan, sehingga ada bilangan bulat $a$ dan $b$ dengan $an+3b=1$, dan menambah serta mengurangi salinan $n^\circ$ dan $3^\circ$ akan membuat $1^\circ$. Tetapi $1^\circ$ tidak dapat dilukis, seperti dijelaskan pada bagian tentang lukisan yang mustahil. Ketik sembarang bilangan bulat derajat di bawah dan kita mendapat resep termurah dan gambar jadinya, atau alasan mengapa resepnya tidak ada. ## Bagaimana membagi ruas garis menjadi bagian-bagian sama? **Untuk membagi $AB$ menjadi $n$ bagian sama, langkahkan $n$ panjang yang sama sepanjang sinar dari $A$, hubungkan tanda terakhir dengan $B$, dan tarik garis-garis sejajar dengan garis itu melalui tanda-tanda lainnya; garis-garis itu membagi $AB$ menjadi $n$ bagian sama.** Alasannya adalah teorema intersep: garis-garis sejajar yang memotong bagian sama dari satu garis lintang memotong bagian sama dari setiap garis lintang lainnya. Berikut lukisan untuk $n=3$. 1. Tarik sinar dari $A$ dengan sudut sembarang terhadap $AB$. 2. Pilih sembarang bukaan jangka dan langkahkan tiga panjang yang sama sepanjang sinar, dari $A$: tanda $D_1$, $D_2$, $D_3$. 3. Tarik garis $D_3B$. 4. Tarik garis-garis sejajar $D_3B$ melalui $D_2$ dan $D_1$ (lihat cara belah ketupat di atas). Keduanya memotong $AB$ di $K_2$ dan $K_1$. 5. $AK_1=K_1K_2=K_2B$. Langkah yang sama membagi ruas garis dengan perbandingan tertentu: untuk memotong $AB$ dengan perbandingan $2:3$, bagi menjadi $5$ bagian sama dan ambil tanda kedua. Membagi ruas garis menjadi dua bagian sama adalah garis sumbu, yang lebih cepat daripada cara ini. Dan karena kita dapat membuat $\frac{a}{n}$ dari panjang mana pun, panjang yang dapat dibuat dari satu ruas garis satuan mencakup setiap pecahan. Gambar di bawah memutar seluruh lukisan untuk $2$ sampai $10$ bagian; tabel di akhir mengukur setiap tanda terhadap $\frac{k}{n}$ perjalanan dari $A$ ke $B$. ## Apa yang tidak akan pernah dapat dilukis dengan penggaris dan jangka? **Sudut sembarang tidak dapat dibagi tiga sama besar, kubus tidak dapat digandakan, dan lingkaran tidak dapat dikuadratkan dengan penggaris dan jangka; ketiganya terbukti mustahil pada abad kesembilan belas.** Ketiga masalah itu terbuka selama lebih dari dua ribu tahun. Jawabannya bukan bahwa tak seorang pun cukup cerdas, melainkan bahwa alat-alat itu hanya mencapai bilangan tertentu. **Bilangan apa yang dapat dibuat?** Ambil satu panjang satuan. Tiga langkah itu hanya dapat menghasilkan bilangan yang diperoleh dari $1$ dengan menambah, mengurangi, mengalikan, membagi, dan menarik akar kuadrat, karena perpotongan garis dengan garis menghasilkan persamaan linear dan perpotongan garis atau lingkaran dengan lingkaran menghasilkan persamaan kuadrat. Setiap akar kuadrat paling banyak menggandakan derajat sebuah bilangan atas bilangan rasional (derajat terkecil polinomial berkoefisien bulat yang memiliki bilangan itu sebagai akar). Jadi bilangan yang dapat dibuat berderajat pangkat dari $2$: $1$, $2$, $4$, $8$, … Inilah teorema Wantzel (1837). **Mengapa $20^\circ$ tidak dapat dilukis.** Identitas sudut rangkap tiga berbunyi $\cos3\varphi=4\cos^3\varphi-3\cos\varphi$. Ambil $\varphi=20^\circ$ dan $\cos60^\circ=\frac12$, maka $x=\cos20^\circ$ memenuhi $8x^3-6x-1=0$. Polinomial kubik ini tidak punya akar rasional (kandidatnya hanya $\pm1$, $\pm\frac12$, $\pm\frac14$, $\pm\frac18$, dan tidak ada yang berhasil), sehingga tidak dapat dipecah, dan $\cos20^\circ$ berderajat $3$. Tiga bukan pangkat dari $2$, jadi $20^\circ$ tidak dapat dilukis, dan sudut $60^\circ$ tidak dapat dibagi tiga. Bila $1^\circ$ dapat dilukis, maka $20^\circ$ juga (dua puluh salinan), itulah sebabnya tidak ada derajat bulat di luar kelipatan $3$ yang dapat dilukis. **Tiga masalah klasik.** - **Membagi tiga sudut:** mungkin untuk sudut khusus ($90^\circ$ memberi $30^\circ$), mustahil secara umum ($60^\circ$ memberi $20^\circ$). - **Menggandakan kubus:** kubus bervolume dua kali lipat memerlukan rusuk $\sqrt[3]{2}$ kali rusuk lama, bilangan berderajat $3$. - **Mengkuadratkan lingkaran:** persegi yang luasnya sama dengan lingkaran berjari-jari $1$ memerlukan sisi $\sqrt\pi$. Lindemann membuktikan pada 1882 bahwa $\pi$ transenden, artinya bukan akar polinomial berkoefisien bulat mana pun, sehingga $\sqrt\pi$ juga tak terjangkau (lihat [π dan bilangan transenden](https://nunada.my.id/artikel/bilangan-irasional/#pi-e-transcendental)). **Alat lain dapat melakukannya.** Archimedes membagi tiga sudut mana pun dengan penggaris yang memiliki dua tanda berjarak satu satuan (penggaris bertanda, disebut neusis dalam bahasa Yunani). Letakkan penggaris melalui $B$ sehingga satu tanda berada di lingkaran di $C$ dan tanda lainnya di garis $AO$ yang diperpanjang, di $D$; sudut di $D$ tepat sepertiga sudut di $O$. Lipat kertas (origami) dan beberapa kurva lain juga dapat membagi tiga sebuah sudut. Kemustahilan itu hanya berlaku untuk penggaris dan jangka saja. Gambar di bawah memperlihatkan pembagian tiga Archimedes untuk sudut mana pun, dan menyatakan apakah penggaris dan jangka saja dapat melakukannya. ## Segi banyak beraturan mana yang dapat dilukis dengan penggaris dan jangka? **Segi banyak beraturan bersisi $n$ dapat dilukis tepat bila $n$ adalah pangkat dari $2$ dikali bilangan prima Fermat yang berbeda ($3$, $5$, $17$, $257$, $65537$); beberapa yang pertama adalah $3$, $4$, $5$, $6$, $8$, $10$, $12$, $15$, $16$, $17$.** Inilah teorema Gauss–Wantzel. Carl Friedrich Gauss menemukan pada usia 18 tahun bahwa segi tujuh belas beraturan dapat dilukis, menerbitkannya pada 1801, dan meminta satu di batu nisannya; Pierre Wantzel membuktikan pada 1837 bahwa tidak ada segi banyak beraturan lain yang dapat. Mengapa bilangan-bilangan itu? Melukis segi-$n$ berarti melukis sudut $\frac{360^\circ}{n}$, yaitu bilangan $\cos\frac{2\pi}{n}$, yang derajatnya atas bilangan rasional adalah $\frac{\varphi(n)}{2}$ untuk $n\ge3$. Di sini $\varphi(n)$ adalah fungsi Euler, banyaknya bilangan bulat dari $1$ sampai $n$ yang tidak punya faktor persekutuan dengan $n$. Derajat itu pangkat dari $2$ tepat bila $\varphi(n)$ demikian, dan $\varphi(n)$ pangkat dari $2$ tepat bila $n$ adalah pangkat dari $2$ dikali bilangan prima berbeda yang berbentuk $2^{2^k}+1$ (prima Fermat). Hanya lima yang diketahui: $3$, $5$, $17$, $257$, dan $65537$. - **Segi lima ($5$):** $\cos72^\circ=\frac{\sqrt5-1}{4}$, satu akar kuadrat. Dilukis bangsa Yunani. - **Segi tujuh ($7$) dan segi sembilan ($9$):** $\varphi(7)=6$ dan $\varphi(9)=6$ bukan pangkat dari $2$, jadi tidak dapat dilukis. Segi sembilan memerlukan pembagian tiga $120^\circ$, yang mustahil. - **Segi tujuh belas:** $\varphi(17)=16$, dan $\cos\frac{2\pi}{17}$ memerlukan tiga lapis akar kuadrat bersarang. - **Segi 257 dan segi 65537:** dilukis di atas kertas oleh Richelot (1832) dan oleh Hermes (1894, setelah sekitar sepuluh tahun kerja). Ketik banyak sisi untuk melihat mengapa sebuah segi banyak dapat atau tidak dapat dilukis. ## Bagaimana melakukan lukisan dalam kode? **Dalam program, sebuah lukisan adalah perpotongan dua lingkaran (atau garis dan lingkaran) yang dihitung dari jarak antarpusat.** Untuk lingkaran berjari-jari $r_1$ dan $r_2$ dengan pusat berjarak $d$, titik potongnya berada pada jarak $a=\frac{r_1^2-r_2^2+d^2}{2d}$ dari pusat pertama sepanjang garis antarpusat, dan pada tinggi $h=\sqrt{r_1^2-a^2}$ di kedua sisinya. Bila $d>r_1+r_2$ atau $d<|r_1-r_2|$ lingkaran saling melewati dan tidak ada titik. Dua hal penting dalam aritmetika floating-point (lihat [mengapa penjumlahan floating-point tidak tepat](https://nunada.my.id/artikel/bilangan-floating-point/)). Pertama, ketika lingkaran hanya bersinggungan, $r_1^2-a^2$ dapat bernilai $-10^{-17}$, jadi ambil `max(h², 0)` sebelum akar kuadrat. Kedua, jangan pernah membandingkan panjang dengan `==`: dua jarak yang sama di atas kertas berbeda di angka terakhir, jadi bandingkan dengan toleransi kecil, dan ukur sudut dengan `atan2`. Program membangun lensa garis sumbu untuk $A=(0,0)$ dan $B=(4,0)$, memeriksa bahwa titik potong atas membentuk segitiga sama sisi, dan menguji derajat bulat dan segi banyak mana yang dapat dilukis dengan fungsi $\varphi$ Euler. ```python import math def circles_meet(c1, r1, c2, r2): """The two points where two circles cross, the one on the left of c1 -> c2 first; None if they miss.""" dx, dy = c2[0] - c1[0], c2[1] - c1[1] d = math.hypot(dx, dy) if d == 0 or d > r1 + r2 or d < abs(r1 - r2): return None a = (r1 * r1 - r2 * r2 + d * d) / (2 * d) h = math.sqrt(max(r1 * r1 - a * a, 0.0)) # rounding can leave -1e-17 when the circles only touch mx, my = c1[0] + a * dx / d, c1[1] + a * dy / d return (mx - h * dy / d, my + h * dx / d), (mx + h * dy / d, my - h * dx / d) def totient(n): return sum(1 for k in range(1, n + 1) if math.gcd(k, n) == 1) def is_power_of_two(n): return n >= 1 and n & (n - 1) == 0 def angle_buildable(deg): """A whole number of degrees can be built when cos(deg) has a degree that is a power of two.""" m = 360 // math.gcd(deg, 360) return is_power_of_two(1 if m <= 2 else totient(m) // 2) def polygon_buildable(n): return n >= 3 and is_power_of_two(totient(n)) A, B = (0.0, 0.0), (4.0, 0.0) P, Q = circles_meet(A, 4, B, 4) # the lens of the perpendicular bisector print([round(v, 4) for v in P], [round(v, 4) for v in Q]) # [2.0, 3.4641] [2.0, -3.4641] print(round(math.dist(P, A), 4), round(math.dist(P, B), 4), round(math.dist(A, B), 4)) # 4.0 4.0 4.0 print(round(math.degrees(math.atan2(P[1] - A[1], P[0] - A[0])), 4)) # 60.0: the angle PAB print([d for d in range(1, 31) if angle_buildable(d)]) # [3, 6, 9, 12, 15, 18, 21, 24, 27, 30] print([n for n in range(3, 41) if polygon_buildable(n)]) # [3, 4, 5, 6, 8, 10, 12, 15, 16, 17, 20, 24, 30, 32, 34, 40] print(circles_meet((0, 0), 1, (5, 0), 1)) # None: too far apart ``` ```javascript const circlesMeet = ([x1, y1], r1, [x2, y2], r2) => { const dx = x2 - x1, dy = y2 - y1 const d = Math.hypot(dx, dy) if (d === 0 || d > r1 + r2 || d < Math.abs(r1 - r2)) return null const a = (r1 * r1 - r2 * r2 + d * d) / (2 * d) const h = Math.sqrt(Math.max(r1 * r1 - a * a, 0)) // rounding can leave -1e-17 when the circles only touch const mx = x1 + (a * dx) / d, my = y1 + (a * dy) / d return [[mx - (h * dy) / d, my + (h * dx) / d], [mx + (h * dy) / d, my - (h * dx) / d]] } const gcd = (a, b) => (b === 0 ? a : gcd(b, a % b)) const totient = (n) => { let t = 0; for (let k = 1; k <= n; k++) if (gcd(k, n) === 1) t++; return t } const isPowerOfTwo = (n) => n >= 1 && (n & (n - 1)) === 0 const angleBuildable = (deg) => { const m = 360 / gcd(deg, 360); return isPowerOfTwo(m <= 2 ? 1 : totient(m) / 2) } const polygonBuildable = (n) => n >= 3 && isPowerOfTwo(totient(n)) const [P, Q] = circlesMeet([0, 0], 4, [4, 0], 4) ;[P.map((v) => +v.toFixed(4)), Q.map((v) => +v.toFixed(4))] // [[2, 3.4641], [2, -3.4641]] ;+(Math.atan2(P[1], P[0]) * 180 / Math.PI).toFixed(4) // 60 Array.from({ length: 30 }, (_, i) => i + 1).filter(angleBuildable) // [3, 6, 9, 12, 15, 18, 21, 24, 27, 30] Array.from({ length: 38 }, (_, i) => i + 3).filter(polygonBuildable) // [3, 4, 5, 6, 8, 10, 12, 15, 16, 17, 20, 24, 30, 32, 34, 40] circlesMeet([0, 0], 1, [5, 0], 1) // null: too far apart ``` ```cpp #include #include #include using namespace std; double px, py, qx, qy; // the two crossings, set by circlesMeet int circlesMeet(double x1, double y1, double r1, double x2, double y2, double r2) { double dx = x2 - x1; double dy = y2 - y1; double d = sqrt(dx * dx + dy * dy); if (d == 0 || d > r1 + r2 || d < fabs(r1 - r2)) return 0; double a = (r1 * r1 - r2 * r2 + d * d) / (2 * d); double h2 = r1 * r1 - a * a; double h = h2 > 0 ? sqrt(h2) : 0; // rounding can leave -1e-17 when the circles only touch double mx = x1 + a * dx / d; double my = y1 + a * dy / d; px = mx - h * dy / d; py = my + h * dx / d; qx = mx + h * dy / d; qy = my - h * dx / d; return 1; } int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); } int totient(int n) { int result = n; int m = n; for (int p = 2; p * p <= m; p++) { if (m % p == 0) { while (m % p == 0) m /= p; result -= result / p; } } if (m > 1) result -= result / m; return result; } int isPowerOfTwo(int n) { return n >= 1 && (n & (n - 1)) == 0; } int angleBuildable(int deg) { int m = 360 / gcd(deg, 360); return isPowerOfTwo(m <= 2 ? 1 : totient(m) / 2); } int main() { circlesMeet(0, 0, 4, 4, 0, 4); printf("%.4f %.4f %.4f %.4f\n", px, py, qx, qy); printf("%.1f\n", atan2(py, px) * 180.0 / 3.14159265358979323846); for (int d = 1; d <= 30; d++) if (angleBuildable(d)) printf("%d ", d); printf("\n"); for (int n = 3; n <= 40; n++) if (isPowerOfTwo(totient(n))) printf("%d ", n); printf("\n"); printf("%d\n", circlesMeet(0, 0, 1, 5, 0, 1)); return 0; } /* output: 2.0000 3.4641 2.0000 -3.4641 60.0 3 6 9 12 15 18 21 24 27 30 3 4 5 6 8 10 12 15 16 17 20 24 30 32 34 40 0 */ ``` ## Dari mana lukisan dengan penggaris dan jangka berasal? **Melukis adalah cara tertua mengerjakan geometri, dan pertanyaan tentang apa yang bisa dan tidak bisa dilakukannya memerlukan dua ribu tahun untuk dijawab.** - **Sekitar 300 SM.** Elements Euklides diawali dengan segitiga sama sisi dan dibangun dengan penggaris dan jangka saja: membagi dua sudut dan ruas garis, garis tegak lurus, garis sejajar, menyalin sudut, dan segi lima beraturan (Buku I dan IV). Buku VI membagi ruas garis menjadi bagian sama dengan teorema intersep. - **Sekitar 250 SM.** Archimedes membagi tiga sebuah sudut dengan penggaris bertanda. Ahli geometri Yunani berabad-abad mencoba membagi tiga sudut, menggandakan kubus, dan mengkuadratkan lingkaran dengan penggaris dan jangka saja. - **1672 dan 1797.** Georg Mohr dan, secara terpisah, Lorenzo Mascheroni menunjukkan bahwa setiap titik yang dapat dilukis dengan penggaris dan jangka dapat dilukis dengan jangka saja. - **1796.** Gauss, berusia 18 tahun, melukis segi tujuh belas beraturan, segi banyak beraturan baru pertama sejak zaman kuno, dan menerbitkan aturan umumnya pada 1801. - **1832.** Friedrich Richelot memberikan lukisan segi 257. - **1837.** Pierre Wantzel membuktikan bahwa menggandakan kubus dan membagi tiga sudut sembarang adalah mustahil, dan bahwa daftar segi banyak Gauss sudah lengkap. - **1882.** Ferdinand von Lindemann membuktikan bahwa $\pi$ transenden, yang mengakhiri soal mengkuadratkan lingkaran. - **1894.** Johann Gustav Hermes menyelesaikan lukisan segi 65537, setelah sekitar sepuluh tahun. ## Apa kesalahan umum dalam melukis? **Kesalahan paling umum dalam melukis adalah delapan hal berikut, masing-masing dengan pernyataan yang benar.** | Kesalahan | Yang benar | |---|---| | ❌ Membaca panjang dari penggaris (“5 cm”) | Penggaris hanya menarik garis. Salin panjang dengan jangka; ia mempertahankan bukaannya. | | ❌ Mengubah bukaan jangka di antara kedua busur garis bagi | Pertahankan satu bukaan, sehingga keempat sisi sama dan bangunnya belah ketupat. | | ❌ Memakai bukaan yang terlalu kecil sehingga busur tidak berpotongan | Untuk mencari titik tengah, bukaan harus lebih dari setengah ruas garis. | | ❌ Membuat $60^\circ$ dengan busur derajat dan menyebutnya lukisan | Gambar segitiga sama sisi; sudutnya tepat $60^\circ$ menurut SSS. | | ❌ Melukis berarti “menggambar dengan hati-hati” | Lukisan adalah daftar langkah yang diperbolehkan disertai bukti; pensil yang ceroboh tidak mengubah buktinya. | | ❌ Setiap derajat bulat dapat dilukis bila kita teliti | Hanya kelipatan $3$; $1^\circ$ dan $20^\circ$ mustahil. | | ❌ Membagi tiga sudut mustahil dengan alat apa pun | Hanya dengan penggaris dan jangka saja; penggaris bertanda atau lipatan kertas dapat melakukannya. | | ❌ Setiap segi banyak beraturan dapat dilukis, misalnya segi tujuh | Hanya bila $n$ adalah pangkat dari $2$ dikali prima Fermat yang berbeda; $7$ dan $9$ tidak dapat. | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: lukisan sekilas - **Aturan:** penggaris tanpa skala dan jangka; tiga langkah (garis melalui dua titik, lingkaran berpusat di satu titik, titik di perpotongan); lukisan itu tepat dan memiliki bukti. - **Menyalin ruas garis:** atur jangka sepanjang ruas itu dan ayunkan busur dari titik yang baru; jumlahkan dan kurangkan dengan menyalin ujung ke ujung atau ke belakang. - **Garis sumbu dan titik tengah:** dua lingkaran berjari-jari sama di kedua ujung, hubungkan titik potongnya; dibenarkan oleh belah ketupat atau oleh SSS. - **Sudut:** segitiga sama sisi $\to60^\circ$; bagi dua dengan satu busur dan dua busur sama; salin dengan menyalin tali busur; semuanya dengan SSS. - **Tegak lurus dan sejajar:** garis sumbu dua titik yang ditandai; sisi berhadapan belah ketupat. - **Sudut istimewa:** $90^\circ$, $60^\circ$, $30^\circ$, $45^\circ$, $15^\circ$, $75^\circ$, $120^\circ$, $135^\circ$, $150^\circ$ dari membagi dua, menambah, dan mengurangi; dengan $72^\circ$, setiap derajat bulat kelipatan $3$. - **Bagian sama:** langkah sama panjang pada sinar dan garis sejajar (teorema intersep). - **Mustahil:** membagi tiga sudut sembarang, menggandakan kubus, mengkuadratkan lingkaran; bilangan yang dapat dilukis berderajat pangkat dari $2$. - **Segi banyak:** segi-$n$ beraturan dapat dilukis tepat bila $\varphi(n)$ pangkat dari $2$, yaitu $n$ pangkat dari $2$ dikali prima Fermat yang berbeda. - **Kode:** perpotongan dua lingkaran dari $a=\frac{r_1^2-r_2^2+d^2}{2d}$ dan $h=\sqrt{r_1^2-a^2}$; `max(h², 0)` dan toleransi. ## Glosarium: istilah penting - **Lukisan geometri**: Bangun yang digambar hanya dengan penggaris tanpa skala dan jangka, dengan setiap titik baru berupa perpotongan garis dan lingkaran yang sudah digambar. - **Penggaris tanpa skala**: Penggaris tanpa tanda apa pun, hanya dipakai untuk menarik garis lurus melalui dua titik. - **Garis sumbu**: Garis yang membagi sebuah ruas garis menjadi dua sama panjang dengan sudut siku-siku; setiap titik padanya sama jauh dari kedua ujung. - **Garis bagi sudut**: Sinar dari titik sudut sebuah sudut yang membaginya menjadi dua sudut sama besar. - **Belah ketupat**: Segi empat dengan empat sisi sama panjang; diagonalnya saling membagi dua secara siku-siku dan membagi dua sudutnya. - **Bilangan yang dapat dikonstruksi**: Bilangan yang dapat dibuat sebagai panjang dari panjang satuan dengan penggaris dan jangka; ia diperoleh dari 1 dengan menambah, mengurangi, mengalikan, membagi, dan menarik akar kuadrat. - **Derajat sebuah bilangan**: Derajat terkecil polinomial berkoefisien bilangan bulat yang memiliki bilangan itu sebagai akar; bilangan yang dapat dikonstruksi berderajat pangkat dari 2. - **Prima Fermat**: Bilangan prima berbentuk 2 pangkat 2^k, ditambah 1; hanya lima yang diketahui: 3, 5, 17, 257, dan 65537. - **Fungsi totien Euler**: Banyaknya bilangan bulat dari 1 sampai n yang tidak memiliki faktor persekutuan dengan n, ditulis phi dari n. - **Neusis**: Lukisan yang memakai penggaris dengan dua tanda, yang dapat membagi tiga sudut mana pun walaupun penggaris dan jangka biasa tidak dapat. ## Pertanyaan yang sering diajukan ### Alat apa yang diperbolehkan dalam lukisan geometri? Hanya penggaris tanpa skala dan jangka. Penggaris menarik garis melalui dua titik, jangka menggambar lingkaran, dan titik baru hanya boleh dibuat di tempat garis dan lingkaran yang sudah digambar berpotongan. ### Bagaimana mencari titik tengah ruas garis dengan jangka? Gambar busur berjari-jari sama, lebih dari setengah ruas garis, di sekitar masing-masing ujung, sekali di atas dan sekali di bawah. Hubungkan kedua titik potong dengan penggaris; garis itu memotong ruas garis di titik tengahnya, dengan sudut siku-siku. ### Bagaimana membagi dua sudut dengan jangka? Gambar busur berpusat di titik sudut untuk memotong kedua kaki sudut, lalu gambar dua busur berjari-jari sama berpusat di kedua titik itu sehingga berpotongan di dalam sudut. Sinar dari titik sudut melalui titik potong itu membagi dua sudut. ### Bagaimana melukis sudut 60 derajat? Gambar ruas garis AB, lalu lingkaran berpusat di A melalui B dan berpusat di B melalui A. Keduanya berpotongan di C, dan segitiga ABC memiliki tiga sisi sama, sehingga setiap sudutnya 60 derajat. Sudut di A adalah sudut 60 derajat itu. ### Bagaimana menyalin sudut dengan jangka dan penggaris? Gambar busur yang sama di sekitar titik sudut lama dan yang baru, ukur tali busur sudut lama dengan jangka, dan tandai pada busur baru. Sinar melalui tanda itu membentuk sudut yang sama, karena kedua segitiga memiliki tiga sisi sama. ### Sudut mana yang dapat dilukis dengan jangka dan penggaris? Mulai dari 60 dan 90 derajat kita dapat membagi dua, menambah, dan mengurangi, dan dengan sudut segi lima 72 derajat kita mencapai setiap derajat bulat kelipatan 3. Satu derajat dan 20 derajat tidak dapat dilukis. ### Mengapa sudut tidak dapat dibagi tiga dengan jangka dan penggaris? Sepertiga 60 derajat memerlukan kosinus 20 derajat, yang merupakan akar polinomial kubik yang tidak dapat difaktorkan. Penggaris dan jangka hanya mencapai bilangan berderajat pangkat dari 2, dan 3 bukan, seperti dibuktikan Wantzel pada 1837. ### Segi banyak beraturan mana yang dapat dilukis? Segi banyak beraturan bersisi n dapat dilukis bila n adalah pangkat dari 2 dikali bilangan prima Fermat yang berbeda (3, 5, 17, 257, 65537). Jadi segitiga, persegi, segi lima, segi enam, segi delapan, dan segi tujuh belas dapat, tetapi segi tujuh dan segi sembilan tidak. --- # Angles: Measuring, Types, Pairs and Parallel Lines Source: https://nunada.my.id/articles/angles/ Updated: 2026-10-23 ## Quick answer **An angle is the amount of turning between two rays that start at the same point, measured in degrees (a full turn is $360^\circ$), in radians (a full turn is $2\pi$) or in turns.** Angles are named by size (acute below $90^\circ$, right at $90^\circ$, obtuse between $90^\circ$ and $180^\circ$, straight at $180^\circ$, reflex above), and they come in pairs: complementary angles add up to $90^\circ$, supplementary ones to $180^\circ$, and vertical angles are equal. ### Key takeaways - An angle is formed by two rays with a common endpoint, the vertex. Its size is the turn from one ray to the other: positive counterclockwise, with a full turn of $360^\circ=2\pi$ radians $=400$ gradians $=1$ turn. To convert, multiply degrees by $\frac{\pi}{180}$ for radians. - Types by size: acute ($0^\circ$ to $90^\circ$), right ($90^\circ$), obtuse ($90^\circ$ to $180^\circ$), straight ($180^\circ$), reflex ($180^\circ$ to $360^\circ$). Pairs: complementary ($90^\circ$), supplementary ($180^\circ$), adjacent, a linear pair (adjacent and supplementary) and vertical angles (equal). - A line crossing two parallel lines makes eight angles that take only two values, $\alpha$ and $180^\circ-\alpha$. Corresponding, alternate interior, alternate exterior and vertical pairs are equal; co-interior, co-exterior and linear pairs add up to $180^\circ$. The lines are parallel exactly when such a pair is equal. - The interior angles of an $n$-sided polygon add up to $(n-2)\cdot180^\circ$, because it splits into $n-2$ triangles; the exterior angles always add up to $360^\circ$. A regular polygon has interior angles $\frac{(n-2)\cdot180^\circ}{n}$ and exterior angles $\frac{360^\circ}{n}$. - The hour hand turns $0.5^\circ$ a minute and the minute hand $6^\circ$, so the angle between them is $\left|30h-5.5m\right|$ (or $360^\circ$ minus that if it is larger than $180^\circ$). In twelve hours the hands overlap $11$ times and are at right angles $22$ times. A compass bearing is measured clockwise from north: bearing $=90^\circ-\theta$ for a direction $\theta$ counterclockwise from east. - In code, convert with `math.radians` and `math.degrees`, normalize with `% 360`, and find the angle between two vectors with `atan2(|a × b|, a · b)`: the arc cosine formula returns $0$ for an angle of $10^{-8}$ radians. ## What is an angle? **An angle is the figure made by two rays, called its sides or arms, that start at the same point, called its vertex; its size says how far you must turn one ray to land on the other.** Open a door, and the angle between the door and the frame grows; swing a clock hand, and it sweeps an angle. The size does not depend on how long the rays are drawn, only on the turn between them. **Naming.** An angle is written with three letters and the angle sign, with the vertex in the middle: $\angle ABC$ has its vertex at $B$ and its sides along $BA$ and $BC$. A single letter ($\angle B$) is enough when no other angle shares the vertex, and a Greek letter ($\theta$, $\alpha$) is often used for the size itself. **Direction.** In mathematics an angle is measured from a starting ray, the initial side, to a terminal side, and a turn **counterclockwise is positive** and clockwise is negative. So $-90^\circ$ is a quarter turn clockwise, and $450^\circ$ is a full turn plus a quarter: it ends in the same place as $90^\circ$. Euclid, in the Elements, described an angle as the inclination of two lines to one another in a plane, and for centuries geometry used only angles below a straight angle; the idea of an angle as an amount of turning, which can be added, negative or larger than a full turn, is what trigonometry, rotations and navigation need. **Why we measure.** Two angles can be compared and added: placing them side by side along a common ray gives the sum. To say how big they are we need a unit, and the next sections describe the units, the names of angles by size, and the rules that relate angles to each other and to lines, polygons, circles, clocks and vectors. ## How are angles measured in degrees, radians and turns? **A full turn is $360$ degrees, $2\pi$ radians, $400$ gradians or $1$ turn, and every unit is a way of cutting the same turn into equal parts.** | Unit | Full turn | Right angle | Used for | |---|---|---|---| | degree ($^\circ$) | $360$ | $90$ | everyday life, geometry, maps | | radian (rad) | $2\pi\approx6.283$ | $\frac{\pi}{2}$ | calculus, physics, programming | | gradian (gon) | $400$ | $100$ | surveying, some calculators | | turn | $1$ | $\frac14$ | rotations, frequency | **Degrees.** The degree is $\frac{1}{360}$ of a turn. The number $360$ comes from the Babylonians, who counted in sixties and whose year was close to $360$ days; it is divisible by $24$ numbers, which makes halves, thirds, quarters, fifths, sixths and eighths of a turn whole numbers. A degree is cut into $60$ minutes ($1^\circ=60'$) and a minute into $60$ seconds ($1'=60''$), as an hour is: $12^\circ30'15''=12+\frac{30}{60}+\frac{15}{3600}=12.504\overline{16}^\circ$. Latitude and longitude on maps are written this way. **Radians.** One radian is the angle at the center of a circle that cuts an arc as long as the radius. Since the circumference is $2\pi r$, a full turn is $2\pi$ radians, and an angle of $\theta$ radians cuts an arc of length $r\theta$ (see [arcs and sectors](https://nunada.my.id/articles/circles/#arcs-and-sectors) for the circle). Radians make the formulas of calculus clean (the derivative of $\sin x$ is $\cos x$ only when $x$ is in radians), so mathematicians and programming languages use them by default. **Converting.** Since $180^\circ=\pi$ radians, $$\text{radians}=\text{degrees}\cdot\frac{\pi}{180},\qquad\text{degrees}=\text{radians}\cdot\frac{180}{\pi}.$$ Common angles: $30^\circ=\frac{\pi}{6}$, $45^\circ=\frac{\pi}{4}$, $60^\circ=\frac{\pi}{3}$, $90^\circ=\frac{\pi}{2}$, $120^\circ=\frac{2\pi}{3}$, $135^\circ=\frac{3\pi}{4}$, $180^\circ=\pi$, $270^\circ=\frac{3\pi}{2}$, $360^\circ=2\pi$. One radian is $\frac{180}{\pi}\approx57.2958^\circ$, and one degree is about $0.017453$ radians. Type an angle in any unit below, or pick one of the common angles, and read it in all of them, with its name and its complement, supplement and explement (the angle that completes it to $360^\circ$). ## What are the types of angles and the pairs of angles? **Angles are named by their size, and two angles are named as a pair when their sizes are tied by a simple rule.** | Name | Size | |---|---| | zero angle | $0^\circ$ | | acute | more than $0^\circ$ and less than $90^\circ$ | | right | exactly $90^\circ$ (drawn with a small square) | | obtuse | more than $90^\circ$ and less than $180^\circ$ | | straight | exactly $180^\circ$ (the two sides form a line) | | reflex | more than $180^\circ$ and less than $360^\circ$ | | full | exactly $360^\circ$ | **Pairs.** - **Complementary angles** add up to $90^\circ$: the complement of $35^\circ$ is $55^\circ$. Only acute angles have a complement. - **Supplementary angles** add up to $180^\circ$: the supplement of $112^\circ$ is $68^\circ$. The word is supplement, not "complement", and the memory aid is C before S as $90$ before $180$. - **Explementary** (or conjugate) angles add up to $360^\circ$. - **Adjacent angles** share a vertex and one side and do not overlap. If their outer sides form a straight line they are a **linear pair**, and a linear pair is supplementary. - **Vertical angles** are the opposite angles where two lines cross, and **vertical angles are equal**. Proof: if the angles in order around the crossing are $a$, $b$, $a'$, $b'$, then $a+b=180^\circ$ and $b+a'=180^\circ$ (both are linear pairs), so $a=a'$; the same argument shows $b=b'$. Two lines that cross at a right angle are perpendicular. Around a point the angles add up to $360^\circ$, and along a line to $180^\circ$; most of the "find the missing angle" exercises are these two facts and the pairs above, used over and over. ## Which angles are equal when a line crosses two parallel lines? **A line, called a transversal, that crosses two parallel lines makes eight angles, and they take only two values: an angle $\alpha$ and its supplement $180^\circ-\alpha$.** Number them $1$ to $8$, the first four at the upper line and the other four at the lower line, each time in the order upper left, upper right, lower left, lower right. The interior angles are the four between the parallel lines ($3$, $4$, $5$, $6$) and the exterior angles the other four. | Pair | Which | Relation | |---|---|---| | corresponding | in the same place at each line: $1$ and $5$, $2$ and $6$, $3$ and $7$, $4$ and $8$ | equal | | alternate interior | inside, on opposite sides: $3$ and $6$, $4$ and $5$ | equal | | alternate exterior | outside, on opposite sides: $1$ and $8$, $2$ and $7$ | equal | | co-interior (same-side interior) | inside, on the same side: $3$ and $5$, $4$ and $6$ | add up to $180^\circ$ | | co-exterior | outside, on the same side: $1$ and $7$, $2$ and $8$ | add up to $180^\circ$ | | vertical | opposite at one crossing | equal | | linear pair | adjacent along a line | add up to $180^\circ$ | **The theorem and its converse.** If the two lines are parallel, corresponding angles are equal, and if a transversal makes equal corresponding angles, the two lines are parallel. This is the form in which Euclid's parallel postulate is used (Elements I.27 and I.29), and it is a way to prove lines parallel. The other pairs follow from the corresponding angles and the vertical angles: angle $3$ is vertical to $2$, and $2$ corresponds to $6$, so $3=6$, the alternate interior pair. The same chain gives the others. **Using it.** Given one angle, all eight are known: if $\angle2=65^\circ$ then $\angle1=\angle4=\angle5=\angle8=115^\circ$ and $\angle3=\angle6=\angle7=65^\circ$. The widget below lets you move the transversal and highlights the pairs of each kind with their values. The same reasoning proves that the angles of a triangle add up to $180^\circ$: draw a parallel to one side through the opposite vertex (see [the angle sum of a triangle](https://nunada.my.id/articles/triangles/#angle-sum)). ## What is the sum of the angles of any polygon? **The interior angles of a polygon with $n$ sides add up to $(n-2)\cdot180^\circ$, and its exterior angles add up to $360^\circ$, whatever the shape.** **Why $(n-2)\cdot180^\circ$.** Choose one vertex and draw all the diagonals from it. They cut the polygon into $n-2$ triangles (a quadrilateral into $2$, a pentagon into $3$), and the angles of the triangles together make up exactly the interior angles of the polygon. Each triangle contributes $180^\circ$. So $$\text{sum}=(n-2)\cdot180^\circ:\qquad 180^\circ,\ 360^\circ,\ 540^\circ,\ 720^\circ,\ \ldots\ \text{for}\ n=3,4,5,6,\ldots$$ (The triangle gives $180^\circ$ and the quadrilateral $360^\circ$, which are the facts of [the triangle](https://nunada.my.id/articles/triangles/#angle-sum) and [the quadrilateral](https://nunada.my.id/articles/quadrilaterals/#angle-sum).) This works for convex polygons and also for concave ones. **Exterior angles.** At each vertex the exterior angle is the turn you make when you walk around the polygon: it is $180^\circ$ minus the interior angle. After going once around you have turned a full turn, so **the exterior angles add up to $360^\circ$**, for any convex polygon. Check with the interior sum: $n\cdot180^\circ-(n-2)\cdot180^\circ=360^\circ$. **Regular polygons.** If all the angles are equal, each interior angle is $\frac{(n-2)\cdot180^\circ}{n}$ and each exterior angle is $\frac{360^\circ}{n}$: $60^\circ$ for a triangle, $90^\circ$ for a square, $108^\circ$ for a pentagon, $120^\circ$ for a hexagon, $135^\circ$ for an octagon. Given an angle you can find $n$: a regular polygon with exterior angle $24^\circ$ has $\frac{360}{24}=15$ sides. A polygon has $\frac{n(n-3)}{2}$ diagonals. **Tiling.** Copies of a regular polygon fit around a point without a gap exactly when the interior angle divides $360^\circ$. That happens for the triangle ($6$ around a point), the square ($4$) and the hexagon ($3$) only, which is why bathroom tiles are squares, triangles or hexagons, and why a honeycomb is hexagonal. Slide the number of sides below. ## How is an angle related to an arc of a circle? **An angle at the center of a circle is the fraction of the turn that its arc takes, and every length and area of the slice is that fraction of the whole.** If the central angle is $\theta$ radians, the arc has length $r\theta$, the sector has area $\frac12r^2\theta$ and the chord joining the ends has length $2r\sin\frac\theta2$. That the arc divided by the radius gives the angle is the definition of the radian. An angle with its vertex on the circle, between two chords, is an inscribed angle. For the chord $AB$ with a central angle of $\theta$, the inscribed angle at a point $P$ outside the arc from $A$ to $B$ is always $\frac\theta2$, wherever $P$ moves, and at a point on that arc it is $180^\circ-\frac\theta2$. When $AB$ is a diameter ($\theta=180^\circ$) the inscribed angle is always $90^\circ$ (Thales). The proofs and more theorems are in [the angle theorems of a circle](https://nunada.my.id/articles/circles/#angle-theorems). The widget below measures the angle at $P$ from the coordinates of the points, with no theorem, and compares it with half the central angle: they agree wherever you drag $P$. It also gives the arc, sector and chord for a radius you type. ## How do the hands of a clock make angles? **The minute hand turns $6^\circ$ every minute and the hour hand $0.5^\circ$ every minute, so at $h$ hours and $m$ minutes the angle between them is $|30h-5.5m|$, and if that is more than $180^\circ$ the angle is $360^\circ$ minus it.** Measure each hand clockwise from the $12$. The hour hand is at $30h+0.5m$ degrees: $30^\circ$ for each hour, plus the share of the next hour that has passed. The minute hand is at $6m$ degrees. Their difference is $$|30h+0.5m-6m|=|30h-5.5m|.$$ Examples: at $3{:}00$ it is $|90-0|=90^\circ$; at $2{:}30$ it is $|60-165|=105^\circ$; at $12{:}30$ it is $|0-165|=165^\circ$; at $6{:}00$ it is $180^\circ$. **How often.** The minute hand gains $5.5^\circ$ a minute on the hour hand, so it laps it every $\frac{360}{5.5}=65\frac{5}{11}$ minutes: the hands overlap $11$ times in twelve hours, first at $1{:}05{:}27\frac3{11}$ (and not at $1{:}05$ exactly), then at $2{:}10{:}54\frac6{11}$, and so on, and the eleventh overlap is at $12{:}00$ again. The relative angle runs through all values from $0^\circ$ to $360^\circ$ eleven times in twelve hours, so any angle strictly between $0^\circ$ and $180^\circ$ occurs $22$ times (twice per lap, once with each hand ahead): **the hands are at right angles $22$ times in twelve hours, $44$ times a day**, and exactly opposite $11$ times. The right angles are at $3{:}00$ and $9{:}00$ and at twenty other, awkward times such as $12{:}16{:}21\frac{9}{11}$. Move the hands below, and choose an angle to see all the times at which the hands make it, to the exact fraction of a second (click a time to set the clock). ## How do compass bearings relate to the angles of mathematics? **A compass bearing is an angle measured clockwise from north, while a mathematical angle is measured counterclockwise from east, so the two are related by bearing $=90^\circ-\theta$ (modulo $360^\circ$).** Mathematics puts angle $0^\circ$ along the positive $x$-axis (east) and turns toward $y$ (north). Navigators and surveyors start at north and turn the way a compass needle's markings run, clockwise. The conversion is a reflection and a shift: | Direction | Mathematical angle | Bearing | |---|---|---| | east | $0^\circ$ | $90^\circ$ | | north | $90^\circ$ | $0^\circ$ | | west | $180^\circ$ | $270^\circ$ | | south | $270^\circ$ | $180^\circ$ | | northwest | $135^\circ$ | $315^\circ$ | The sixteen points of the compass are $22.5^\circ$ apart: N, NNE, NE, ENE, E, ESE, SE, SSE, S, SSW, SW, WSW, W, WNW, NW, NNW. A bearing is usually written with three digits ($045^\circ$), and a back bearing (the reverse direction) is the bearing plus or minus $180^\circ$. Programs that draw on screens add a third convention: screen $y$ grows downward, so a counterclockwise angle needs its sine negated. The second mode of the widget at the end of the next section converts between the two systems and gives the compass name. ## How do you find the angle between two lines or two vectors? **Between two vectors the angle comes from the dot product, $\cos\theta=\frac{\mathbf a\cdot\mathbf b}{|\mathbf a||\mathbf b|}$, and between two lines from their slopes, $\tan\theta=\left|\frac{m_1-m_2}{1+m_1m_2}\right|$.** **Vectors.** For $\mathbf a=(a_1,a_2)$ and $\mathbf b=(b_1,b_2)$ the dot product is $a_1b_1+a_2b_2=|\mathbf a||\mathbf b|\cos\theta$ and the cross product $a_1b_2-a_2b_1=|\mathbf a||\mathbf b|\sin\theta$. The sign of the dot product tells the kind of angle: positive for acute, zero for a right angle, negative for obtuse. Dividing gives $\tan\theta$, which is why the angle can be computed as $$\theta=\operatorname{atan2}\bigl(|a_1b_2-a_2b_1|,\ a_1b_1+a_2b_2\bigr)$$ with no division and no square roots. Many programs instead write $\theta=\arccos\frac{\mathbf a\cdot\mathbf b}{|\mathbf a||\mathbf b|}$, which is right on paper but loses precision in floating point: the cosine of a tiny angle is $1$ to sixteen digits, so for $\theta=10^{-8}$ the arc cosine gets $\cos\theta=1$ exactly and answers $0$, and near $180^\circ$ it answers exactly $180^\circ$ (see [floating-point numbers](https://nunada.my.id/articles/floating-point-numbers/#cancellation)). Without the absolute value, the same expression is the directed angle in $(-180^\circ,180^\circ]$, positive counterclockwise. **Lines.** A line with slope $m$ makes the angle $\arctan m$ with the $x$-axis, so the angle between two lines is $\theta_1-\theta_2$, and the formula for the tangent of a difference gives $\tan\theta=\frac{m_1-m_2}{1+m_1m_2}$. The lines are perpendicular exactly when $m_1m_2=-1$, and parallel when $m_1=m_2$. For example the lines with slopes $1$ and $-1$ meet at $90^\circ$, and slopes $0$ and $\sqrt3$ at $60^\circ$. A vertical line has no slope: use its direction vector instead. Try two vectors below: the presets include an angle of $10^{-8}$ radians, where the two formulas differ. ## How do you work with angles in Python, JavaScript and C++? **Programs measure angles in radians, so convert degrees first, normalize results into a fixed range, and use `atan2` rather than `acos` for the angle between vectors.** The trigonometric functions of every language (`sin`, `cos`, `tan`) take radians, so `sin(30)` is the sine of $30$ radians, not of $30^\circ$. The remainder operator needs care: Python's `%` always gives a result with the sign of the divisor, so `-30 % 360` is `330`; JavaScript's and C++'s keep the sign of the dividend, so `-30 % 360` is `-30` and you add $360$ and take the remainder again (C++ uses `fmod` for decimals). And since a radian measure is a floating-point number, `sin(π)` is not $0$ but about $1.2\times10^{-16}$. The Python program below normalizes angles, finds the angle between vectors both ways, the angle between clock hands, the sum of the angles of polygons and a compass bearing. The JavaScript and C++ programs do the same in their way. ```python import math from fractions import Fraction def normalize(deg): """The same direction as an angle in [0, 360): Python's % already gives a non-negative result.""" return deg % 360 def angle_between(a, b): """The angle between two 2D vectors in degrees, from atan2: accurate for every angle.""" cross = a[0] * b[1] - a[1] * b[0] dot = a[0] * b[0] + a[1] * b[1] return math.degrees(math.atan2(abs(cross), dot)) def angle_between_acos(a, b): c = (a[0] * b[0] + a[1] * b[1]) / (math.hypot(*a) * math.hypot(*b)) return math.degrees(math.acos(max(-1.0, min(1.0, c)))) def clock_angle(h, m): """The angle between the hands at h:m, from 0 to 180 degrees.""" d = abs(30 * (h % 12) - 5.5 * m) % 360 return min(d, 360 - d) def interior_sum(n): return (n - 2) * 180 def bearing(math_angle): """Compass bearing (clockwise from north) of a direction given counterclockwise from east.""" return (90 - math_angle) % 360 print(normalize(-30), normalize(725), normalize(360)) print(angle_between((1, 0), (1, 1)), angle_between((1, 0), (0, 2)), angle_between((1, 0), (-1, 0))) print(angle_between((1, 0), (1, 1e-8)), angle_between_acos((1, 0), (1, 1e-8))) print(clock_angle(3, 0), clock_angle(2, 30), clock_angle(12, 30), clock_angle(6, 0)) print([interior_sum(n) for n in (3, 4, 5, 6, 10)], [(n - 2) * 180 / n for n in (3, 4, 5, 6, 8, 12)]) print(math.degrees(math.pi / 6), math.radians(180), Fraction(150, 180)) print(bearing(0), bearing(90), bearing(135), bearing(-90)) print(math.sin(math.radians(30)), math.cos(math.radians(60)), math.sin(math.pi)) # 330 5 0 # 45.0 90.0 180.0 # 5.729577951308232e-07 0.0 # 90.0 105.0 165.0 180.0 # [180, 360, 540, 720, 1440] [60.0, 90.0, 108.0, 120.0, 135.0, 150.0] # 29.999999999999996 3.141592653589793 5/6 # 90 0 315 180 # 0.49999999999999994 0.5000000000000001 1.2246467991473532e-16 ``` ```javascript const toDeg = (r) => (r * 180) / Math.PI const normalize = (d) => ((d % 360) + 360) % 360 // JavaScript's % keeps the sign of d, so fix it const angleBetween = (a, b) => toDeg(Math.atan2(Math.abs(a[0] * b[1] - a[1] * b[0]), a[0] * b[0] + a[1] * b[1])) const angleBetweenAcos = (a, b) => toDeg(Math.acos((a[0] * b[0] + a[1] * b[1]) / (Math.hypot(...a) * Math.hypot(...b)))) ;[-30 % 360, normalize(-30), normalize(725), normalize(360)] // [-30, 330, 5, 0] ;[angleBetween([1, 0], [1, 1]), angleBetween([1, 0], [0, 2])] // [45, 90] angleBetween([1, 0], [1, 1e-8]) // 5.729577951308232e-7 angleBetweenAcos([1, 0], [1, 1e-8]) // 0: the arc cosine lost the angle angleBetween([1, 0], [-1, 1e-8]) // 179.9999994270422 angleBetweenAcos([1, 0], [-1, 1e-8]) // 180 const clockAngle = (h, m) => { const d = Math.abs(30 * (h % 12) - 5.5 * m) % 360; return Math.min(d, 360 - d) } ;[clockAngle(3, 0), clockAngle(2, 30), clockAngle(12, 30)] // [90, 105, 165] const bearing = (mathAngle) => normalize(90 - mathAngle) ;[bearing(0), bearing(90), bearing(135)] // [90, 0, 315] ;[Math.sin(Math.PI / 6), Math.sin(30)] // [0.49999999999999994, -0.9880316240928618]: sin takes radians ;[Math.atan2(1, 1), Math.atan2(-1, -1)].map(toDeg) // [45, -135]: atan2 knows the quadrant, atan does not ``` ```cpp #include #include #include using namespace std; const double PI = 3.14159265358979323846; double degrees(double rad) { return rad * 180.0 / PI; } double angleBetween(double ax, double ay, double bx, double by) { double cross = ax * by - ay * bx; double dot = ax * bx + ay * by; return degrees(atan2(fabs(cross), dot)); } double clockAngle(int h, int m) { double d = fabs(30.0 * (h % 12) - 5.5 * m); while (d >= 360) d -= 360; return d > 180 ? 360 - d : d; } int main() { printf("%.1f\n", angleBetween(1, 0, 1, 1)); printf("%.1f\n", angleBetween(1, 0, 0, 2)); printf("%.1f %.1f %.1f\n", clockAngle(3, 0), clockAngle(2, 30), clockAngle(12, 30)); printf("%d\n", (5 - 2) * 180); // the angles of a pentagon double a = -30; printf("%.1f\n", a - 360.0 * floor(a / 360.0)); // for decimals: subtract whole turns, rounding down return 0; } /* output: 45.0 90.0 90.0 105.0 165.0 540 330.0 */ ``` ## Where do the degree and the angle come from? **The $360^\circ$ circle is Babylonian, the theory of angles is Greek, and the radian is a modern idea.** - **By the first millennium BC.** Babylonian astronomers, counting in base $60$, divided the circle into $360$ parts, close to the number of days in the year, and their sixtieths are the minutes and seconds we still use for angles and for time. - **About 300 BC.** Euclid's Elements defines the plane angle and the right angle, proves that vertical angles are equal, states the parallel postulate and proves that a transversal of parallel lines makes equal alternate angles (Book I). - **About 150 BC.** Hipparchus compiled the first table of chords, the ancestor of the sine table, dividing the circle into $360^\circ$ in the Greek world; Ptolemy used it in the Almagest (about 150 AD). - **About 500 AD.** Indian astronomers, such as Aryabhata, replaced chords by half-chords, the sine, which led to the trigonometry used today. - **1714.** Roger Cotes described measuring an angle by the arc it cuts on a circle of radius $1$, the idea of the radian, without giving it a name. - **1790s.** The French metric system proposed dividing the right angle into $100$ grades (gradians, now gons), still used in surveying. - **1873.** The name radian appeared in print, credited to the Irish engineer James Thomson, the brother of Lord Kelvin. - **1900s–today.** Angles became rotations: the unit of calculus, of complex numbers ($e^{i\theta}$), of computer graphics and robotics, and of the turn used for frequency. ## What are the common mistakes with angles? **The most common mistakes with angles are the nine below, each with the correct statement.** | Mistake | Correct | |---|---| | ❌ Mix up complementary and supplementary | Complementary adds up to $90^\circ$ (C before S, $90$ before $180$), supplementary to $180^\circ$. | | ❌ Call $90^\circ$ or $180^\circ$ acute or obtuse | An acute angle is below $90^\circ$ and an obtuse one is between $90^\circ$ and $180^\circ$; $90^\circ$ is right and $180^\circ$ is straight. | | ❌ Alternate and co-interior angles are always equal | Alternate interior angles are equal, co-interior angles add up to $180^\circ$, and only if the two lines are parallel. | | ❌ The angles of a polygon add up to $n\cdot180^\circ$ | They add up to $(n-2)\cdot180^\circ$, because $n-2$ triangles fill the polygon. | | ❌ The exterior angles grow with the number of sides | They always add up to $360^\circ$; each exterior angle of a regular polygon is $\frac{360^\circ}{n}$. | | ❌ At $2{:}30$ the clock hands are at $120^\circ$ or $90^\circ$ | The hour hand has moved halfway to the 3: the angle is $|30\cdot2-5.5\cdot30|=105^\circ$. | | ❌ Use `sin(30)` for the sine of $30^\circ$ in a program | Functions take radians: convert first, `sin(radians(30))`. | | ❌ Find an angle with `acos` of the normalized dot product | It fails for tiny angles and can give NaN for rounding above 1; use `atan2(abs(cross), dot)`. | | ❌ Use $\theta$ as a compass bearing as it is | A bearing is clockwise from north: bearing $=90^\circ-\theta$ (modulo $360^\circ$). | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: angles at a glance - **Angle:** the turn between two rays at a vertex; counterclockwise is positive; $360^\circ=2\pi$ rad $=400$ gradians $=1$ turn. - **Convert:** radians $=$ degrees $\cdot\frac{\pi}{180}$; $1$ rad $\approx57.2958^\circ$; degrees, minutes, seconds are sixtieths. - **Types:** acute $<90^\circ$, right $=90^\circ$, obtuse between $90^\circ$ and $180^\circ$, straight $=180^\circ$, reflex above. - **Pairs:** complementary $90^\circ$, supplementary $180^\circ$, vertical angles equal, a linear pair supplementary. - **Parallel lines:** corresponding, alternate and vertical pairs equal; co-interior and linear pairs add up to $180^\circ$; equal corresponding angles prove the lines parallel. - **Polygons:** interior sum $(n-2)\cdot180^\circ$, exterior sum $360^\circ$, regular interior $\frac{(n-2)\cdot180^\circ}{n}$; only the triangle, square and hexagon tile. - **Clock:** $|30h-5.5m|$; $11$ overlaps and $22$ right angles in twelve hours. - **Directions:** bearing $=90^\circ-\theta$; sixteen compass points $22.5^\circ$ apart. - **Vectors and lines:** $\operatorname{atan2}(|\text{cross}|,\text{dot})$, slopes with $\tan\theta=\left|\frac{m_1-m_2}{1+m_1m_2}\right|$. - **Code:** radians in trigonometric functions, normalize with $\%$ (watch the sign), prefer atan2 to acos. ## Glossary: key terms - **Angle**: The figure formed by two rays with a common endpoint, or the amount of turning from one ray to the other. - **Vertex**: The common endpoint of the two rays that form an angle. - **Degree**: A unit of angle equal to one 360th of a full turn, divided into 60 minutes of 60 seconds each. - **Complementary angles**: Two angles whose sizes add up to 90 degrees. - **Supplementary angles**: Two angles whose sizes add up to 180 degrees; a linear pair is supplementary. - **Vertical angles**: The opposite angles formed where two lines cross; they are equal. - **Transversal**: A line that crosses two or more other lines, making pairs of corresponding, alternate and co-interior angles. - **Exterior angle of a polygon**: The turn at a vertex when walking around the polygon, 180 degrees minus the interior angle; the exterior angles add up to 360 degrees. - **Bearing**: A direction measured as an angle clockwise from north, usually written with three digits. - **Protractor**: A semicircular or circular tool with a scale of degrees for measuring and drawing angles. ## Frequently asked questions ### What is an angle in geometry? An angle is the figure formed by two rays with the same endpoint, called the vertex. Its size is the amount of turning needed to bring one ray onto the other, measured in degrees or radians. ### How many degrees are in a full circle, and why 360? A full circle is 360 degrees. The number comes from the Babylonians, who counted in sixties, and it is handy because 360 has 24 divisors, so many fractions of a turn are whole numbers of degrees. ### How do you convert degrees to radians? Multiply the degrees by pi over 180. For example 90 degrees is pi over 2 and 180 degrees is pi. To go back, multiply the radians by 180 over pi. ### What is the difference between complementary and supplementary angles? Complementary angles add up to 90 degrees, supplementary angles to 180 degrees. The complement of 35 degrees is 55 degrees and its supplement is 145 degrees. Only an acute angle has a complement. ### Which angles are equal when a line crosses two parallel lines? Corresponding angles, alternate interior angles, alternate exterior angles and vertical angles are equal. Co-interior angles and the angles of a linear pair are not equal, they add up to 180 degrees. ### What is the sum of the interior angles of a polygon? For a polygon with n sides it is n minus 2, times 180 degrees, because the polygon splits into n minus 2 triangles. A hexagon has 720 degrees, and the exterior angles always add up to 360 degrees. ### How do you find the angle between the hands of a clock? Take the absolute value of 30 times the hour minus 5.5 times the minutes, and if it is more than 180 degrees subtract it from 360. At 2:30 this gives 105 degrees. ### How do you find the angle between two vectors? Use the dot product: the cosine of the angle is the dot product divided by the product of the lengths. In code, atan2 of the size of the cross product and the dot product is more accurate for very small angles. --- # Sudut: Pengukuran, Jenis, Pasangan, dan Garis Sejajar Source: https://nunada.my.id/artikel/sudut/ Updated: 2026-10-23 ## Jawaban singkat **Sudut adalah besarnya putaran antara dua sinar yang berawal dari titik yang sama, diukur dalam derajat (satu putaran penuh $360^\circ$), dalam radian (satu putaran penuh $2\pi$) atau dalam putaran.** Sudut dinamai menurut besarnya (lancip di bawah $90^\circ$, siku-siku $90^\circ$, tumpul antara $90^\circ$ dan $180^\circ$, lurus $180^\circ$, refleks di atasnya), dan datang berpasangan: sudut berpenyiku berjumlah $90^\circ$, berpelurus $180^\circ$, dan sudut bertolak belakang sama besar. ### Poin penting - Sudut dibentuk oleh dua sinar dengan titik ujung bersama, yaitu titik sudut. Besarnya adalah putaran dari satu sinar ke sinar lain: positif berlawanan arah jarum jam, dengan satu putaran penuh $360^\circ=2\pi$ radian $=400$ gradian $=1$ putaran. Untuk mengubah, kalikan derajat dengan $\frac{\pi}{180}$ untuk radian. - Jenis menurut besarnya: lancip ($0^\circ$ sampai $90^\circ$), siku-siku ($90^\circ$), tumpul ($90^\circ$ sampai $180^\circ$), lurus ($180^\circ$), refleks ($180^\circ$ sampai $360^\circ$). Pasangan: berpenyiku ($90^\circ$), berpelurus ($180^\circ$), bersisian, pasangan linear (bersisian dan berpelurus), dan sudut bertolak belakang (sama besar). - Sebuah garis yang memotong dua garis sejajar membuat delapan sudut yang hanya bernilai dua, $\alpha$ dan $180^\circ-\alpha$. Pasangan sehadap, dalam berseberangan, luar berseberangan, dan bertolak belakang sama besar; pasangan dalam sepihak, luar sepihak, dan berpelurus berjumlah $180^\circ$. Garis-garis itu sejajar tepat ketika pasangan seperti itu sama besar. - Sudut-sudut dalam segi-$n$ berjumlah $(n-2)\cdot180^\circ$, karena ia terbagi menjadi $n-2$ segitiga; sudut luarnya selalu berjumlah $360^\circ$. Segi banyak beraturan memiliki sudut dalam $\frac{(n-2)\cdot180^\circ}{n}$ dan sudut luar $\frac{360^\circ}{n}$. - Jarum jam berputar $0{,}5^\circ$ per menit dan jarum menit $6^\circ$, sehingga sudut di antaranya $\left|30h-5{,}5m\right|$ (atau $360^\circ$ dikurangi itu bila lebih dari $180^\circ$). Dalam dua belas jam kedua jarum bertumpuk $11$ kali dan membentuk sudut siku-siku $22$ kali. Bearing kompas diukur searah jarum jam dari utara: bearing $=90^\circ-\theta$ untuk arah $\theta$ berlawanan arah jarum jam dari timur. - Dalam kode, ubah dengan `math.radians` dan `math.degrees`, normalkan dengan `% 360`, dan cari sudut antara dua vektor dengan `atan2(|a × b|, a · b)`: rumus arc kosinus menghasilkan $0$ untuk sudut $10^{-8}$ radian. ## Apa itu sudut? **Sudut adalah bangun yang dibentuk oleh dua sinar, disebut sisi atau kaki-nya, yang berawal dari titik yang sama, disebut titik sudut-nya; besarnya menyatakan seberapa jauh satu sinar harus diputar untuk jatuh di atas yang lain.** Buka sebuah pintu, dan sudut antara pintu dan kusen membesar; ayunkan jarum jam, dan ia menyapu sebuah sudut. Besarnya tidak bergantung pada panjang sinar yang digambar, hanya pada putaran di antaranya. **Penamaan.** Sudut ditulis dengan tiga huruf dan tanda sudut, dengan titik sudut di tengah: $\angle ABC$ memiliki titik sudut di $B$ dan sisinya sepanjang $BA$ dan $BC$. Satu huruf ($\angle B$) cukup bila tidak ada sudut lain yang berbagi titik sudut, dan huruf Yunani ($\theta$, $\alpha$) sering dipakai untuk besarnya. **Arah.** Dalam matematika sudut diukur dari sebuah sinar awal, sisi awal, ke sisi akhir, dan putaran **berlawanan arah jarum jam adalah positif** dan searah jarum jam negatif. Jadi $-90^\circ$ adalah seperempat putaran searah jarum jam, dan $450^\circ$ adalah satu putaran penuh ditambah seperempat: ia berakhir di tempat yang sama dengan $90^\circ$. Euklides, dalam Elements, menguraikan sudut sebagai kemiringan dua garis satu terhadap yang lain dalam sebuah bidang, dan berabad-abad geometri hanya memakai sudut di bawah sudut lurus; gagasan sudut sebagai besarnya putaran, yang dapat dijumlahkan, negatif, atau lebih besar dari satu putaran penuh, adalah yang diperlukan trigonometri, rotasi, dan navigasi. **Mengapa mengukur.** Dua sudut dapat dibandingkan dan dijumlahkan: menaruhnya berdampingan sepanjang sinar bersama memberi jumlahnya. Untuk menyatakan seberapa besar diperlukan satuan, dan bagian berikutnya menguraikan satuan, nama sudut menurut besarnya, dan aturan yang menghubungkan sudut satu sama lain serta dengan garis, segi banyak, lingkaran, jam, dan vektor. ## Bagaimana sudut diukur dalam derajat, radian, dan putaran? **Satu putaran penuh adalah $360$ derajat, $2\pi$ radian, $400$ gradian, atau $1$ putaran, dan setiap satuan adalah cara memotong putaran yang sama menjadi bagian-bagian yang sama besar.** | Satuan | Satu putaran | Sudut siku-siku | Dipakai untuk | |---|---|---|---| | derajat ($^\circ$) | $360$ | $90$ | kehidupan sehari-hari, geometri, peta | | radian (rad) | $2\pi\approx6{,}283$ | $\frac{\pi}{2}$ | kalkulus, fisika, pemrograman | | gradian (gon) | $400$ | $100$ | survei, beberapa kalkulator | | putaran | $1$ | $\frac14$ | rotasi, frekuensi | **Derajat.** Derajat adalah $\frac{1}{360}$ putaran. Bilangan $360$ berasal dari bangsa Babilonia, yang menghitung dalam enam puluhan dan yang tahunnya mendekati $360$ hari; ia habis dibagi $24$ bilangan, sehingga setengah, sepertiga, seperempat, seperlima, seperenam, dan seperdelapan putaran menjadi bilangan bulat. Sebuah derajat dipotong menjadi $60$ menit ($1^\circ=60'$) dan sebuah menit menjadi $60$ detik ($1'=60''$), seperti pada jam: $12^\circ30'15''=12+\frac{30}{60}+\frac{15}{3600}=12{,}504\overline{16}^\circ$. Lintang dan bujur pada peta ditulis dengan cara ini. **Radian.** Satu radian adalah sudut di pusat lingkaran yang memotong busur sepanjang jari-jari. Karena kelilingnya $2\pi r$, satu putaran penuh adalah $2\pi$ radian, dan sudut $\theta$ radian memotong busur sepanjang $r\theta$ (lihat [busur dan juring](https://nunada.my.id/artikel/lingkaran/#arcs-and-sectors) untuk lingkarannya). Radian membuat rumus kalkulus bersih (turunan $\sin x$ adalah $\cos x$ hanya bila $x$ dalam radian), sehingga matematikawan dan bahasa pemrograman memakainya secara bawaan. **Mengubah.** Karena $180^\circ=\pi$ radian, $$\text{radian}=\text{derajat}\cdot\frac{\pi}{180},\qquad\text{derajat}=\text{radian}\cdot\frac{180}{\pi}.$$ Sudut yang umum: $30^\circ=\frac{\pi}{6}$, $45^\circ=\frac{\pi}{4}$, $60^\circ=\frac{\pi}{3}$, $90^\circ=\frac{\pi}{2}$, $120^\circ=\frac{2\pi}{3}$, $135^\circ=\frac{3\pi}{4}$, $180^\circ=\pi$, $270^\circ=\frac{3\pi}{2}$, $360^\circ=2\pi$. Satu radian adalah $\frac{180}{\pi}\approx57{,}2958^\circ$, dan satu derajat sekitar $0{,}017453$ radian. Ketik sudut dalam satuan apa pun di bawah, atau pilih salah satu sudut yang umum, dan baca dalam semuanya, dengan namanya serta penyiku, pelurus, dan pelengkap penuhnya (sudut yang melengkapinya menjadi $360^\circ$). ## Apa saja jenis sudut dan pasangan sudut? **Sudut dinamai menurut besarnya, dan dua sudut dinamai sebagai pasangan bila besarnya terikat oleh aturan sederhana.** | Nama | Besar | |---|---| | sudut nol | $0^\circ$ | | lancip | lebih dari $0^\circ$ dan kurang dari $90^\circ$ | | siku-siku | tepat $90^\circ$ (digambar dengan persegi kecil) | | tumpul | lebih dari $90^\circ$ dan kurang dari $180^\circ$ | | lurus | tepat $180^\circ$ (kedua sisinya membentuk garis) | | refleks | lebih dari $180^\circ$ dan kurang dari $360^\circ$ | | penuh | tepat $360^\circ$ | **Pasangan.** - **Sudut berpenyiku** berjumlah $90^\circ$: penyiku $35^\circ$ adalah $55^\circ$. Hanya sudut lancip yang punya penyiku. - **Sudut berpelurus** berjumlah $180^\circ$: pelurus $112^\circ$ adalah $68^\circ$. Pengingatnya penyiku lebih dulu daripada pelurus seperti $90$ sebelum $180$. - **Sudut pelengkap penuh** (atau konjugat) berjumlah $360^\circ$. - **Sudut bersisian** berbagi titik sudut dan satu sisi dan tidak tumpang tindih. Bila sisi luarnya membentuk garis lurus mereka adalah **pasangan linear**, dan pasangan linear berpelurus. - **Sudut bertolak belakang** adalah sudut yang berhadapan di tempat dua garis berpotongan, dan **sudut bertolak belakang sama besar**. Buktinya: bila sudut-sudut berurutan di sekitar perpotongan adalah $a$, $b$, $a'$, $b'$, maka $a+b=180^\circ$ dan $b+a'=180^\circ$ (keduanya pasangan linear), sehingga $a=a'$; argumen yang sama menunjukkan $b=b'$. Dua garis yang berpotongan siku-siku disebut tegak lurus. Di sekitar satu titik sudut-sudut berjumlah $360^\circ$, dan sepanjang garis $180^\circ$; kebanyakan latihan "cari sudut yang hilang" adalah kedua fakta ini dan pasangan di atas, dipakai berulang-ulang. ## Sudut mana yang sama besar ketika sebuah garis memotong dua garis sejajar? **Sebuah garis, disebut garis lintang (transversal), yang memotong dua garis sejajar membuat delapan sudut, dan mereka hanya bernilai dua: sebuah sudut $\alpha$ dan pelurusnya $180^\circ-\alpha$.** Beri nomor $1$ sampai $8$, empat pertama pada garis atas dan empat lainnya pada garis bawah, setiap kali dengan urutan kiri atas, kanan atas, kiri bawah, kanan bawah. Sudut dalam adalah keempat sudut di antara garis sejajar ($3$, $4$, $5$, $6$) dan sudut luar keempat lainnya. | Pasangan | Yang mana | Hubungan | |---|---|---| | sehadap | di tempat yang sama pada setiap garis: $1$ dan $5$, $2$ dan $6$, $3$ dan $7$, $4$ dan $8$ | sama besar | | dalam berseberangan | di dalam, pada sisi berlawanan: $3$ dan $6$, $4$ dan $5$ | sama besar | | luar berseberangan | di luar, pada sisi berlawanan: $1$ dan $8$, $2$ dan $7$ | sama besar | | dalam sepihak | di dalam, pada sisi yang sama: $3$ dan $5$, $4$ dan $6$ | berjumlah $180^\circ$ | | luar sepihak | di luar, pada sisi yang sama: $1$ dan $7$, $2$ dan $8$ | berjumlah $180^\circ$ | | bertolak belakang | berhadapan pada satu perpotongan | sama besar | | pasangan linear | bersisian sepanjang garis | berjumlah $180^\circ$ | **Teorema dan kebalikannya.** Jika kedua garis sejajar, sudut sehadap sama besar, dan jika sebuah garis lintang membuat sudut sehadap yang sama besar, kedua garis itu sejajar. Inilah bentuk yang dipakai postulat kesejajaran Euklides (Elements I.27 dan I.29), dan ia cara membuktikan garis sejajar. Pasangan lain mengikuti dari sudut sehadap dan sudut bertolak belakang: sudut $3$ bertolak belakang dengan $2$, dan $2$ sehadap dengan $6$, sehingga $3=6$, pasangan dalam berseberangan. Rantai yang sama memberi yang lain. **Memakainya.** Bila satu sudut diketahui, kedelapannya diketahui: jika $\angle2=65^\circ$ maka $\angle1=\angle4=\angle5=\angle8=115^\circ$ dan $\angle3=\angle6=\angle7=65^\circ$. Widget di bawah memungkinkan kamu menggeser garis lintang dan menyorot pasangan setiap jenis beserta nilainya. Penalaran yang sama membuktikan bahwa sudut-sudut segitiga berjumlah $180^\circ$: gambar garis sejajar salah satu sisi melalui titik sudut di seberangnya (lihat [jumlah sudut segitiga](https://nunada.my.id/artikel/segitiga/#angle-sum)). ## Berapa jumlah sudut segi banyak mana pun? **Sudut-sudut dalam segi banyak dengan $n$ sisi berjumlah $(n-2)\cdot180^\circ$, dan sudut luarnya berjumlah $360^\circ$, apa pun bentuknya.** **Mengapa $(n-2)\cdot180^\circ$.** Pilih satu titik sudut dan gambar semua diagonal dari situ. Mereka memotong segi banyak menjadi $n-2$ segitiga (segiempat menjadi $2$, segilima menjadi $3$), dan sudut-sudut segitiga itu bersama-sama tepat membentuk sudut dalam segi banyak. Setiap segitiga menyumbang $180^\circ$. Jadi $$\text{jumlah}=(n-2)\cdot180^\circ:\qquad 180^\circ,\ 360^\circ,\ 540^\circ,\ 720^\circ,\ \ldots\ \text{untuk}\ n=3,4,5,6,\ldots$$ (Segitiga memberi $180^\circ$ dan segiempat $360^\circ$, yang merupakan fakta [segitiga](https://nunada.my.id/artikel/segitiga/#angle-sum) dan [segiempat](https://nunada.my.id/artikel/segiempat/#angle-sum).) Ini berlaku untuk segi banyak cembung dan juga yang cekung. **Sudut luar.** Pada setiap titik sudut, sudut luar adalah belokan yang kamu buat ketika berjalan mengelilingi segi banyak: ia $180^\circ$ dikurangi sudut dalam. Setelah mengelilinginya sekali kamu telah berbelok satu putaran penuh, sehingga **sudut luar berjumlah $360^\circ$**, untuk segi banyak cembung mana pun. Periksa dengan jumlah sudut dalam: $n\cdot180^\circ-(n-2)\cdot180^\circ=360^\circ$. **Segi banyak beraturan.** Bila semua sudutnya sama, setiap sudut dalam adalah $\frac{(n-2)\cdot180^\circ}{n}$ dan setiap sudut luar $\frac{360^\circ}{n}$: $60^\circ$ untuk segitiga, $90^\circ$ untuk persegi, $108^\circ$ untuk segilima, $120^\circ$ untuk segienam, $135^\circ$ untuk segidelapan. Dari sebuah sudut kamu dapat mencari $n$: segi banyak beraturan dengan sudut luar $24^\circ$ memiliki $\frac{360}{24}=15$ sisi. Sebuah segi banyak memiliki $\frac{n(n-3)}{2}$ diagonal. **Pengubinan.** Salinan segi banyak beraturan muat mengelilingi satu titik tanpa celah tepat ketika sudut dalamnya membagi $360^\circ$. Itu terjadi hanya untuk segitiga ($6$ di sekeliling satu titik), persegi ($4$), dan segienam ($3$), itulah sebabnya ubin kamar mandi berupa persegi, segitiga, atau segienam, dan sarang lebah berbentuk segienam. Geser banyak sisi di bawah. ## Bagaimana sudut berhubungan dengan busur lingkaran? **Sudut di pusat lingkaran adalah pecahan putaran yang diambil busurnya, dan setiap panjang dan luas irisan itu adalah pecahan tersebut dari keseluruhan.** Jika sudut pusatnya $\theta$ radian, busurnya sepanjang $r\theta$, juringnya seluas $\frac12r^2\theta$ dan tali busur yang menghubungkan ujungnya sepanjang $2r\sin\frac\theta2$. Bahwa busur dibagi jari-jari memberi sudut adalah definisi radian. Sudut dengan titik sudut pada lingkaran, di antara dua tali busur, adalah sudut keliling. Untuk tali busur $AB$ dengan sudut pusat $\theta$, sudut keliling di titik $P$ di luar busur dari $A$ ke $B$ selalu $\frac\theta2$, ke mana pun $P$ bergerak, dan di titik pada busur itu ia $180^\circ-\frac\theta2$. Bila $AB$ adalah diameter ($\theta=180^\circ$) sudut kelilingnya selalu $90^\circ$ (Thales). Bukti dan teorema lainnya ada di [teorema sudut pada lingkaran](https://nunada.my.id/artikel/lingkaran/#angle-theorems). Widget di bawah mengukur sudut di $P$ dari koordinat titik-titiknya, tanpa teorema, dan membandingkannya dengan setengah sudut pusat: keduanya sesuai ke mana pun kamu menyeret $P$. Ia juga memberi busur, juring, dan tali busur untuk jari-jari yang kamu ketik. ## Bagaimana jarum jam membentuk sudut? **Jarum menit berputar $6^\circ$ setiap menit dan jarum jam $0{,}5^\circ$ setiap menit, sehingga pada jam $h$ dan menit $m$ sudut di antaranya adalah $|30h-5{,}5m|$, dan bila itu lebih dari $180^\circ$ sudutnya adalah $360^\circ$ dikurangi itu.** Ukur setiap jarum searah jarum jam dari angka $12$. Jarum jam berada pada $30h+0{,}5m$ derajat: $30^\circ$ untuk setiap jam, ditambah bagian jam berikutnya yang telah berlalu. Jarum menit berada pada $6m$ derajat. Selisihnya $$|30h+0{,}5m-6m|=|30h-5{,}5m|.$$ Contoh: pada $3{:}00$ nilainya $|90-0|=90^\circ$; pada $2{:}30$ nilainya $|60-165|=105^\circ$; pada $12{:}30$ nilainya $|0-165|=165^\circ$; pada $6{:}00$ nilainya $180^\circ$. **Seberapa sering.** Jarum menit mendahului jarum jam $5{,}5^\circ$ per menit, sehingga ia menyusulnya setiap $\frac{360}{5{,}5}=65\frac{5}{11}$ menit: kedua jarum bertumpuk $11$ kali dalam dua belas jam, pertama pada $1{:}05{:}27\frac3{11}$ (dan bukan tepat $1{:}05$), lalu pada $2{:}10{:}54\frac6{11}$, dan seterusnya, dan tumpukan kesebelas adalah pada $12{:}00$ lagi. Sudut relatifnya melewati semua nilai dari $0^\circ$ sampai $360^\circ$ sebanyak sebelas kali dalam dua belas jam, sehingga setiap sudut yang benar-benar di antara $0^\circ$ dan $180^\circ$ terjadi $22$ kali (dua kali per putaran, sekali dengan masing-masing jarum di depan): **kedua jarum membentuk sudut siku-siku $22$ kali dalam dua belas jam, $44$ kali sehari**, dan tepat berlawanan $11$ kali. Sudut siku-siku itu terjadi pada $3{:}00$ dan $9{:}00$ dan pada dua puluh waktu lain yang janggal seperti $12{:}16{:}21\frac{9}{11}$. Geser jarum di bawah, dan pilih sebuah sudut untuk melihat semua waktu ketika jarum membentuknya, sampai pecahan detik yang tepat (klik sebuah waktu untuk mengatur jam). ## Bagaimana bearing kompas berhubungan dengan sudut matematika? **Bearing kompas adalah sudut yang diukur searah jarum jam dari utara, sedangkan sudut matematika diukur berlawanan arah jarum jam dari timur, sehingga keduanya berhubungan dengan bearing $=90^\circ-\theta$ (modulo $360^\circ$).** Matematika menaruh sudut $0^\circ$ sepanjang sumbu-$x$ positif (timur) dan berputar menuju $y$ (utara). Navigator dan juru ukur mulai dari utara dan berputar searah jarum jam. Konversinya adalah pencerminan dan pergeseran: | Arah | Sudut matematika | Bearing | |---|---|---| | timur | $0^\circ$ | $90^\circ$ | | utara | $90^\circ$ | $0^\circ$ | | barat | $180^\circ$ | $270^\circ$ | | selatan | $270^\circ$ | $180^\circ$ | | barat laut | $135^\circ$ | $315^\circ$ | Enam belas titik kompas berjarak $22{,}5^\circ$: N, NNE, NE, ENE, E, ESE, SE, SSE, S, SSW, SW, WSW, W, WNW, NW, NNW. Bearing biasanya ditulis dengan tiga angka ($045^\circ$), dan bearing balik (arah sebaliknya) adalah bearing ditambah atau dikurangi $180^\circ$. Program yang menggambar di layar menambah konvensi ketiga: $y$ layar bertambah ke bawah, sehingga sudut berlawanan arah jarum jam memerlukan sinus yang dinegasikan. Mode kedua widget di akhir bagian berikutnya mengubah di antara kedua sistem dan memberi nama kompasnya. ## Bagaimana mencari sudut antara dua garis atau dua vektor? **Antara dua vektor sudut berasal dari hasil kali titik, $\cos\theta=\frac{\mathbf a\cdot\mathbf b}{|\mathbf a||\mathbf b|}$, dan antara dua garis dari gradiennya, $\tan\theta=\left|\frac{m_1-m_2}{1+m_1m_2}\right|$.** **Vektor.** Untuk $\mathbf a=(a_1,a_2)$ dan $\mathbf b=(b_1,b_2)$ hasil kali titiknya $a_1b_1+a_2b_2=|\mathbf a||\mathbf b|\cos\theta$ dan hasil kali silangnya $a_1b_2-a_2b_1=|\mathbf a||\mathbf b|\sin\theta$. Tanda hasil kali titik menunjukkan jenis sudutnya: positif untuk lancip, nol untuk siku-siku, negatif untuk tumpul. Membaginya memberi $\tan\theta$, itulah sebabnya sudut dapat dihitung sebagai $$\theta=\operatorname{atan2}\bigl(|a_1b_2-a_2b_1|,\ a_1b_1+a_2b_2\bigr)$$ tanpa pembagian dan tanpa akar. Banyak program sebaliknya menulis $\theta=\arccos\frac{\mathbf a\cdot\mathbf b}{|\mathbf a||\mathbf b|}$, yang benar di atas kertas tetapi kehilangan presisi dalam titik mengambang: kosinus sudut yang sangat kecil adalah $1$ sampai enam belas angka, sehingga untuk $\theta=10^{-8}$ arc kosinus mendapat $\cos\theta=1$ persis dan menjawab $0$, dan di dekat $180^\circ$ ia menjawab persis $180^\circ$ (lihat [bilangan titik mengambang](https://nunada.my.id/artikel/bilangan-floating-point/#cancellation)). Tanpa nilai mutlak, ungkapan yang sama adalah sudut berarah dalam $(-180^\circ,180^\circ]$, positif berlawanan arah jarum jam. **Garis.** Garis dengan gradien $m$ membuat sudut $\arctan m$ dengan sumbu-$x$, sehingga sudut antara dua garis adalah $\theta_1-\theta_2$, dan rumus tangen selisih memberi $\tan\theta=\frac{m_1-m_2}{1+m_1m_2}$. Garis-garis itu tegak lurus tepat ketika $m_1m_2=-1$, dan sejajar ketika $m_1=m_2$. Misalnya garis dengan gradien $1$ dan $-1$ bertemu pada $90^\circ$, dan gradien $0$ dan $\sqrt3$ pada $60^\circ$. Garis tegak tidak punya gradien: pakai vektor arahnya. Coba dua vektor di bawah: prasetnya mencakup sudut $10^{-8}$ radian, ketika kedua rumus berbeda. ## Bagaimana bekerja dengan sudut di Python, JavaScript, dan C++? **Program mengukur sudut dalam radian, jadi ubah derajat lebih dulu, normalkan hasilnya ke rentang tetap, dan pakai `atan2` bukan `acos` untuk sudut antara vektor.** Fungsi trigonometri setiap bahasa (`sin`, `cos`, `tan`) menerima radian, sehingga `sin(30)` adalah sinus $30$ radian, bukan $30^\circ$. Operator sisa perlu hati-hati: `%` Python selalu memberi hasil bertanda sama dengan pembagi, sehingga `-30 % 360` adalah `330`; milik JavaScript dan C++ mempertahankan tanda yang dibagi, sehingga `-30 % 360` adalah `-30` dan kamu menambah $360$ dan mengambil sisa lagi (C++ memakai `fmod` untuk desimal). Dan karena ukuran radian adalah bilangan titik mengambang, `sin(π)` bukan $0$ melainkan sekitar $1{,}2\times10^{-16}$. Program Python di bawah menormalkan sudut, mencari sudut antara vektor dengan kedua cara, sudut antara jarum jam, jumlah sudut segi banyak, dan bearing kompas. Program JavaScript dan C++ melakukan hal yang sama dengan caranya. ```python import math from fractions import Fraction def normalize(deg): """The same direction as an angle in [0, 360): Python's % already gives a non-negative result.""" return deg % 360 def angle_between(a, b): """The angle between two 2D vectors in degrees, from atan2: accurate for every angle.""" cross = a[0] * b[1] - a[1] * b[0] dot = a[0] * b[0] + a[1] * b[1] return math.degrees(math.atan2(abs(cross), dot)) def angle_between_acos(a, b): c = (a[0] * b[0] + a[1] * b[1]) / (math.hypot(*a) * math.hypot(*b)) return math.degrees(math.acos(max(-1.0, min(1.0, c)))) def clock_angle(h, m): """The angle between the hands at h:m, from 0 to 180 degrees.""" d = abs(30 * (h % 12) - 5.5 * m) % 360 return min(d, 360 - d) def interior_sum(n): return (n - 2) * 180 def bearing(math_angle): """Compass bearing (clockwise from north) of a direction given counterclockwise from east.""" return (90 - math_angle) % 360 print(normalize(-30), normalize(725), normalize(360)) print(angle_between((1, 0), (1, 1)), angle_between((1, 0), (0, 2)), angle_between((1, 0), (-1, 0))) print(angle_between((1, 0), (1, 1e-8)), angle_between_acos((1, 0), (1, 1e-8))) print(clock_angle(3, 0), clock_angle(2, 30), clock_angle(12, 30), clock_angle(6, 0)) print([interior_sum(n) for n in (3, 4, 5, 6, 10)], [(n - 2) * 180 / n for n in (3, 4, 5, 6, 8, 12)]) print(math.degrees(math.pi / 6), math.radians(180), Fraction(150, 180)) print(bearing(0), bearing(90), bearing(135), bearing(-90)) print(math.sin(math.radians(30)), math.cos(math.radians(60)), math.sin(math.pi)) # 330 5 0 # 45.0 90.0 180.0 # 5.729577951308232e-07 0.0 # 90.0 105.0 165.0 180.0 # [180, 360, 540, 720, 1440] [60.0, 90.0, 108.0, 120.0, 135.0, 150.0] # 29.999999999999996 3.141592653589793 5/6 # 90 0 315 180 # 0.49999999999999994 0.5000000000000001 1.2246467991473532e-16 ``` ```javascript const toDeg = (r) => (r * 180) / Math.PI const normalize = (d) => ((d % 360) + 360) % 360 // JavaScript's % keeps the sign of d, so fix it const angleBetween = (a, b) => toDeg(Math.atan2(Math.abs(a[0] * b[1] - a[1] * b[0]), a[0] * b[0] + a[1] * b[1])) const angleBetweenAcos = (a, b) => toDeg(Math.acos((a[0] * b[0] + a[1] * b[1]) / (Math.hypot(...a) * Math.hypot(...b)))) ;[-30 % 360, normalize(-30), normalize(725), normalize(360)] // [-30, 330, 5, 0] ;[angleBetween([1, 0], [1, 1]), angleBetween([1, 0], [0, 2])] // [45, 90] angleBetween([1, 0], [1, 1e-8]) // 5.729577951308232e-7 angleBetweenAcos([1, 0], [1, 1e-8]) // 0: the arc cosine lost the angle angleBetween([1, 0], [-1, 1e-8]) // 179.9999994270422 angleBetweenAcos([1, 0], [-1, 1e-8]) // 180 const clockAngle = (h, m) => { const d = Math.abs(30 * (h % 12) - 5.5 * m) % 360; return Math.min(d, 360 - d) } ;[clockAngle(3, 0), clockAngle(2, 30), clockAngle(12, 30)] // [90, 105, 165] const bearing = (mathAngle) => normalize(90 - mathAngle) ;[bearing(0), bearing(90), bearing(135)] // [90, 0, 315] ;[Math.sin(Math.PI / 6), Math.sin(30)] // [0.49999999999999994, -0.9880316240928618]: sin takes radians ;[Math.atan2(1, 1), Math.atan2(-1, -1)].map(toDeg) // [45, -135]: atan2 knows the quadrant, atan does not ``` ```cpp #include #include #include using namespace std; const double PI = 3.14159265358979323846; double degrees(double rad) { return rad * 180.0 / PI; } double angleBetween(double ax, double ay, double bx, double by) { double cross = ax * by - ay * bx; double dot = ax * bx + ay * by; return degrees(atan2(fabs(cross), dot)); } double clockAngle(int h, int m) { double d = fabs(30.0 * (h % 12) - 5.5 * m); while (d >= 360) d -= 360; return d > 180 ? 360 - d : d; } int main() { printf("%.1f\n", angleBetween(1, 0, 1, 1)); printf("%.1f\n", angleBetween(1, 0, 0, 2)); printf("%.1f %.1f %.1f\n", clockAngle(3, 0), clockAngle(2, 30), clockAngle(12, 30)); printf("%d\n", (5 - 2) * 180); // the angles of a pentagon double a = -30; printf("%.1f\n", a - 360.0 * floor(a / 360.0)); // for decimals: subtract whole turns, rounding down return 0; } /* output: 45.0 90.0 90.0 105.0 165.0 540 330.0 */ ``` ## Dari mana derajat dan sudut berasal? **Lingkaran $360^\circ$ berasal dari Babilonia, teori sudut dari Yunani, dan radian adalah gagasan modern.** - **Pada milenium pertama SM.** Astronom Babilonia, menghitung dalam basis $60$, membagi lingkaran menjadi $360$ bagian, dekat dengan banyak hari dalam setahun, dan seperenam puluhnya adalah menit dan detik yang masih kita pakai untuk sudut dan waktu. - **Sekitar 300 SM.** Elements Euklides mendefinisikan sudut bidang dan sudut siku-siku, membuktikan bahwa sudut bertolak belakang sama besar, menyatakan postulat kesejajaran, dan membuktikan bahwa garis lintang pada garis sejajar membuat sudut berseberangan yang sama (Buku I). - **Sekitar 150 SM.** Hipparchus menyusun tabel tali busur pertama, leluhur tabel sinus, membagi lingkaran menjadi $360^\circ$ di dunia Yunani; Ptolemeus memakainya dalam Almagest (sekitar 150 M). - **Sekitar 500 M.** Astronom India, seperti Aryabhata, mengganti tali busur dengan setengah tali busur, yaitu sinus, yang mengarah ke trigonometri yang dipakai sekarang. - **1714.** Roger Cotes menguraikan pengukuran sudut dengan busur yang dipotongnya pada lingkaran berjari-jari $1$, gagasan radian, tanpa memberinya nama. - **1790-an.** Sistem metrik Prancis mengusulkan membagi sudut siku-siku menjadi $100$ grade (gradian, kini gon), yang masih dipakai dalam survei. - **1873.** Nama radian muncul dalam cetakan, dikaitkan dengan insinyur Irlandia James Thomson, saudara Lord Kelvin. - **1900-an–kini.** Sudut menjadi rotasi: satuan kalkulus, bilangan kompleks ($e^{i\theta}$), grafika komputer dan robotika, dan putaran yang dipakai untuk frekuensi. ## Apa kesalahan umum pada sudut? **Kesalahan paling umum pada sudut adalah sembilan hal berikut, masing-masing dengan pernyataan yang benar.** | Kesalahan | Yang benar | |---|---| | ❌ Tertukar antara berpenyiku dan berpelurus | Berpenyiku berjumlah $90^\circ$ (penyiku sebelum pelurus, $90$ sebelum $180$), berpelurus $180^\circ$. | | ❌ Menyebut $90^\circ$ atau $180^\circ$ lancip atau tumpul | Sudut lancip di bawah $90^\circ$ dan sudut tumpul di antara $90^\circ$ dan $180^\circ$; $90^\circ$ adalah siku-siku dan $180^\circ$ adalah lurus. | | ❌ Sudut berseberangan dan sepihak selalu sama besar | Sudut dalam berseberangan sama besar, sudut dalam sepihak berjumlah $180^\circ$, dan hanya jika kedua garis sejajar. | | ❌ Sudut-sudut segi banyak berjumlah $n\cdot180^\circ$ | Mereka berjumlah $(n-2)\cdot180^\circ$, karena $n-2$ segitiga mengisi segi banyak itu. | | ❌ Sudut luar membesar seiring banyaknya sisi | Mereka selalu berjumlah $360^\circ$; setiap sudut luar segi banyak beraturan adalah $\frac{360^\circ}{n}$. | | ❌ Pada $2{:}30$ jarum jam membentuk $120^\circ$ atau $90^\circ$ | Jarum jam sudah bergerak setengah jalan ke angka 3: sudutnya $|30\cdot2-5{,}5\cdot30|=105^\circ$. | | ❌ Memakai `sin(30)` untuk sinus $30^\circ$ dalam program | Fungsi menerima radian: ubah dulu, `sin(radians(30))`. | | ❌ Mencari sudut dengan `acos` hasil kali titik ternormalisasi | Ia gagal untuk sudut kecil dan dapat memberi NaN karena pembulatan di atas 1; pakai `atan2(abs(cross), dot)`. | | ❌ Memakai $\theta$ sebagai bearing kompas apa adanya | Bearing searah jarum jam dari utara: bearing $=90^\circ-\theta$ (modulo $360^\circ$). | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: sudut sekilas - **Sudut:** putaran antara dua sinar di titik sudut; berlawanan arah jarum jam positif; $360^\circ=2\pi$ rad $=400$ gradian $=1$ putaran. - **Mengubah:** radian $=$ derajat $\cdot\frac{\pi}{180}$; $1$ rad $\approx57{,}2958^\circ$; derajat, menit, detik adalah seperenam puluhan. - **Jenis:** lancip $<90^\circ$, siku-siku $=90^\circ$, tumpul di antara $90^\circ$ dan $180^\circ$, lurus $=180^\circ$, refleks di atasnya. - **Pasangan:** berpenyiku $90^\circ$, berpelurus $180^\circ$, sudut bertolak belakang sama besar, pasangan linear berpelurus. - **Garis sejajar:** pasangan sehadap, berseberangan, dan bertolak belakang sama besar; pasangan dalam sepihak dan linear berjumlah $180^\circ$; sudut sehadap yang sama besar membuktikan garis sejajar. - **Segi banyak:** jumlah sudut dalam $(n-2)\cdot180^\circ$, jumlah sudut luar $360^\circ$, sudut dalam beraturan $\frac{(n-2)\cdot180^\circ}{n}$; hanya segitiga, persegi, dan segienam yang mengubin. - **Jam:** $|30h-5{,}5m|$; $11$ tumpukan dan $22$ sudut siku-siku dalam dua belas jam. - **Arah:** bearing $=90^\circ-\theta$; enam belas titik kompas berjarak $22{,}5^\circ$. - **Vektor dan garis:** $\operatorname{atan2}(|\text{silang}|,\text{titik})$, gradien dengan $\tan\theta=\left|\frac{m_1-m_2}{1+m_1m_2}\right|$. - **Kode:** radian dalam fungsi trigonometri, normalkan dengan $\%$ (perhatikan tandanya), pilih atan2 daripada acos. ## Glosarium: istilah penting - **Sudut**: Bangun yang dibentuk dua sinar dengan titik ujung bersama, atau besarnya putaran dari satu sinar ke sinar lain. - **Titik sudut**: Titik ujung bersama dari dua sinar yang membentuk sudut. - **Derajat**: Satuan sudut yang sama dengan sepertiga ratus enam puluh putaran penuh, dibagi menjadi 60 menit yang masing-masing 60 detik. - **Sudut berpenyiku**: Dua sudut yang besarnya berjumlah 90 derajat. - **Sudut berpelurus**: Dua sudut yang besarnya berjumlah 180 derajat; pasangan linear berpelurus. - **Sudut bertolak belakang**: Sudut berhadapan yang terbentuk di tempat dua garis berpotongan; mereka sama besar. - **Garis lintang**: Garis yang memotong dua garis atau lebih, membuat pasangan sudut sehadap, berseberangan, dan sepihak. - **Sudut luar segi banyak**: Belokan di sebuah titik sudut ketika berjalan mengelilingi segi banyak, 180 derajat dikurangi sudut dalam; sudut luar berjumlah 360 derajat. - **Bearing**: Arah yang diukur sebagai sudut searah jarum jam dari utara, biasanya ditulis dengan tiga angka. - **Busur derajat**: Alat setengah lingkaran atau lingkaran dengan skala derajat untuk mengukur dan menggambar sudut. ## Pertanyaan yang sering diajukan ### Apa itu sudut dalam geometri? Sudut adalah bangun yang dibentuk dua sinar dengan titik ujung yang sama, disebut titik sudut. Besarnya adalah jumlah putaran yang diperlukan untuk membawa satu sinar ke sinar lain, diukur dalam derajat atau radian. ### Berapa derajat dalam satu lingkaran penuh, dan mengapa 360? Satu lingkaran penuh adalah 360 derajat. Bilangan ini berasal dari bangsa Babilonia, yang menghitung dalam enam puluhan, dan ia praktis karena 360 memiliki 24 pembagi, sehingga banyak pecahan putaran berupa bilangan bulat derajat. ### Bagaimana mengubah derajat ke radian? Kalikan derajat dengan pi per 180. Misalnya 90 derajat adalah pi per 2 dan 180 derajat adalah pi. Untuk kembali, kalikan radian dengan 180 per pi. ### Apa beda sudut berpenyiku dan sudut berpelurus? Sudut berpenyiku berjumlah 90 derajat, sudut berpelurus 180 derajat. Penyiku 35 derajat adalah 55 derajat dan pelurusnya 145 derajat. Hanya sudut lancip yang punya penyiku. ### Sudut mana yang sama besar ketika garis memotong dua garis sejajar? Sudut sehadap, sudut dalam berseberangan, sudut luar berseberangan, dan sudut bertolak belakang sama besar. Sudut dalam sepihak dan sudut pasangan linear tidak sama, mereka berjumlah 180 derajat. ### Berapa jumlah sudut dalam sebuah segi banyak? Untuk segi banyak dengan n sisi jumlahnya n dikurangi 2, kali 180 derajat, karena segi banyak terbagi menjadi n dikurangi 2 segitiga. Segienam memiliki 720 derajat, dan sudut luar selalu berjumlah 360 derajat. ### Bagaimana mencari sudut antara jarum jam? Ambil nilai mutlak 30 kali jam dikurangi 5,5 kali menit, dan bila lebih dari 180 derajat kurangkan dari 360. Pada 2:30 ini memberi 105 derajat. ### Bagaimana mencari sudut antara dua vektor? Pakai hasil kali titik: kosinus sudutnya adalah hasil kali titik dibagi hasil kali panjangnya. Dalam kode, atan2 dari besar hasil kali silang dan hasil kali titik lebih akurat untuk sudut yang sangat kecil. --- # LaTeX: Writing Mathematics and Documents Source: https://nunada.my.id/articles/latex/ Updated: 2026-10-23 ## Quick answer **LaTeX is a typesetting system: you write a plain-text file with commands such as `\frac{a}{b}` and `\section{Introduction}`, and a program turns it into a cleanly formatted PDF.** It is the standard for mathematics, science and computing papers because it sets formulas beautifully, numbers pages, equations and citations automatically, and keeps the look of a document separate from its content. Mathematics goes between dollar signs, as in `$x^2+y^2=r^2$`. ### Key takeaways - LaTeX is marked-up text: you type the content and say what each part is (a section, a formula, a list), and the compiler chooses the typography. A document is a `.tex` file; compiling it with `pdflatex` gives a PDF. - Mathematics lives in math mode: `$...$` inside a sentence, `\[ ... \]` on its own line. Scripts take one character unless braced: `x^{10}`, not `x^10`. Fractions, roots and sums are `\frac{a}{b}`, `\sqrt{x}` and `\sum_{i=1}^{n}`. - Every document has a `\documentclass`, a preamble where the packages are loaded (`\usepackage{amsmath}`), and a body between `\begin{document}` and `\end{document}`. Environments such as `equation`, `align`, `pmatrix` and `itemize` always come in `\begin{...}` and `\end{...}` pairs. - Ten characters are special in LaTeX text: `# % & _ { } ~ ^ \` and the dollar sign. To print one, escape it (`\%`, `\&`, `\_`) or use a command such as `\textbackslash`. Labels and citations need several compilations: `pdflatex`, `bibtex`, `pdflatex`, `pdflatex`. - Read errors from the first one down: `Undefined control sequence` is a misspelled command or a missing package, `Missing $ inserted` is mathematics outside math mode (a `^` in text, or a lone `$`), `Missing } inserted` is an unbalanced brace. A linter can find most of them before you compile. - LaTeX is also the notation of the web and of code: MathJax and KaTeX draw it in browsers, Markdown and Jupyter notebooks accept `$...$`, Python's SymPy prints it with `latex()`, and Overleaf compiles documents online without installing anything. ## What is LaTeX? **LaTeX is a system for preparing documents in which you write the text and mark up its structure, and a program called a compiler lays it out and produces a PDF.** You do not drag a formula into place or choose a font size for a heading. You type `\section{Results}` and LaTeX decides how a section heading looks, how much space surrounds it, what number it gets and where it appears in the table of contents. This is "what you mean is what you get", as opposed to the "what you see is what you get" of a word processor. **Why people use it.** - **Mathematics.** Formulas are written in text and set with the care of a professional typesetter: the right spacing around operators, brackets that grow with their contents, and fractions and scripts of the correct sizes. - **Automatic numbering and references.** Sections, equations, figures and tables are numbered for you, and `\ref` and `\cite` keep every cross-reference and citation correct when you add or move something. - **Stability.** A source file is plain text: it opens anywhere, works with version control, and still compiles years later. - **Consistency.** The look is a property of the document class and the packages, so a thesis, a paper and a set of slides keep a uniform style, and a journal can supply a class that formats your paper the way it wants. **The names.** TeX (pronounced "tech", from the Greek letters τ ε χ) is the typesetting engine written by Donald Knuth. LaTeX (say "lah-tech" or "lay-tech") is a layer of commands on top of TeX, written by Leslie Lamport, that makes it easy to describe documents. People say "LaTeX" for both the system and the language. Overleaf is a website that compiles LaTeX in the browser; TeX Live and MiKTeX are the distributions you install on your own computer. **The workflow.** You write `main.tex`, run the compiler (`pdflatex main`), and open `main.pdf`. The compiler also writes a `.log` file with its messages and a `.aux` file where it remembers numbers for the next run. Here is the smallest complete document: ```latex \documentclass{article} \begin{document} Hello, \LaTeX! The area of a circle of radius $r$ is $A = \pi r^2$. \end{document} ``` The first line chooses the document class (`article`, `report`, `book`, `beamer` for slides, and so on). Everything between `\begin{document}` and `\end{document}` is the document. Anything before `\begin{document}` is the preamble: settings and packages, which you will meet next. A blank line starts a new paragraph; several spaces or a single line break count as one space. ## How do you write and compile your first LaTeX document? **Write a `.tex` file with a document class, a preamble and a body, then compile it with `pdflatex`; the quickest start is Overleaf, which needs no installation.** Either install a distribution (TeX Live on Linux, macOS and Windows; MiKTeX on Windows) and an editor, or make a free project on Overleaf, where the Compile button runs everything for you. **The skeleton of a real document.** A paper has a title, an author, the `\maketitle` command, sections, and usually an abstract: - `\documentclass[11pt,a4paper]{article}`: the class, with options for the font size and the paper. - `\usepackage{...}`: one line per package, in the preamble only. `amsmath` gives the better equation environments, `amssymb` extra symbols, `graphicx` pictures, `booktabs` nicer table rules, `geometry` the margins, and `hyperref` clickable links (load it last). - `\title`, `\author`, `\date`: the front matter, printed by `\maketitle`. - `\section`, `\subsection`: headings (a `report` or `book` also has `\chapter`). - `abstract`: a short summary, in the `article` and `report` classes (a `book` has none). **How many times to compile.** A cross-reference such as `\ref{eq:main}` is resolved from the `.aux` file written on the previous run, so the first compilation prints "??" and the second prints the number. A bibliography needs the sequence `pdflatex`, `bibtex`, `pdflatex`, `pdflatex`. The tool `latexmk -pdf main.tex` (and Overleaf) repeats the steps for you until nothing changes. Assemble one below. Choose the class, packages and parts, and read the source; it also lists the commands to compile it and the rules the page applied (for example, that `hyperref` goes last and that a book has no abstract). ## How do you write mathematics in LaTeX? **Put the mathematics in math mode: between single dollar signs inside a sentence, or between `\[` and `\]` for a formula on its own line.** In math mode letters are italic variables, spaces are ignored (LaTeX spaces the operators itself), and commands start with a backslash. The ones you use constantly: | You want | You type | You get | |---|---|---| | a superscript | `x^2` | $x^2$ | | a subscript | `a_n` | $a_n$ | | both | `x_i^2` | $x_i^2$ | | a fraction | `\frac{a}{b}` | $\frac{a}{b}$ | | a square root | `\sqrt{x}` | $\sqrt{x}$ | | an $n$th root | `\sqrt[3]{x}` | $\sqrt[3]{x}$ | | a Greek letter | `\alpha \beta \pi` | $\alpha\ \beta\ \pi$ | | a function name | `\sin x` | $\sin x$ | | a sum | `\sum_{i=1}^{n} i` | $\sum_{i=1}^{n} i$ | | an integral | `\int_0^1 x\,dx` | $\int_0^1 x\,dx$ | | a limit | `\lim_{x\to 0}` | $\lim_{x\to 0}$ | **Braces group.** A superscript or subscript takes one character. So `x^10` is $x^1$ followed by a zero, and `e^-x` puts only the minus sign up. Write `x^{10}` and `e^{-x}` to raise the whole group. Braces also delimit the arguments of `\frac`, `\sqrt` and the other commands. What the operations themselves mean is explained in [exponents and radicals](https://nunada.my.id/articles/exponents-and-radicals/#what-is-an-exponent) and in [algebraic fractions](https://nunada.my.id/articles/algebraic-expressions/#algebraic-fractions). **Brackets that fit.** `\left(` and `\right)` make brackets grow to the height of what is between them, as in `\left( \frac{a}{b} \right)`. Every `\left` needs a `\right` (write `\right.` for an invisible one). **Words, spacing and functions.** Text inside a formula goes in `\text{...}`, as in `x > 0 \text{ and } y > 0`. Add a small space with `\,`, a larger one with `\quad`. Write `\sin`, `\log`, `\lim` and `\max` for function names: typed as plain letters, `sin` would be the product $s\,i\,n$ of three variables set in italics, with the wrong spacing. **Numbering.** The `equation` environment numbers a formula, and `\label{eq:name}` lets you cite it with `\eqref{eq:name}` (from amsmath). Without a number, use `\[ ... \]` or the starred form `equation*`. The editor below draws a formula as you type and, like a careful teacher, points at the usual mistakes: a missing brace, `x^10`, a mismatched environment, an undefined command. Click the broken examples to see what it says. ```latex % in the preamble: \usepackage{amsmath} The roots of $ax^2 + bx + c = 0$ are given by the formula \[ x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}. \] \begin{equation} \label{eq:euler} e^{i\pi} + 1 = 0 \end{equation} Equation~\eqref{eq:euler} is Euler's identity. Functions are upright: $\sin^2 x + \cos^2 x = 1$, and $\lim_{x \to 0} \frac{\sin x}{x} = 1$. ``` ## Where do you find the command for a symbol? **Most symbols are named after what they are: `\alpha` is α, `\leq` is ≤, `\infty` is ∞, `\rightarrow` (or `\to`) is →.** The names follow a few patterns that make them easy to guess: - **Greek letters** are spelled out: `\alpha`, `\beta`, `\gamma` for lowercase and `\Gamma`, `\Delta`, `\Omega` for capitals (only the capitals that differ from Latin letters exist: there is no `\Alpha`, because it would be an A). `\epsilon` and `\varepsilon` are two shapes of the same letter, as are `\phi` and `\varphi`, and `\theta` and `\vartheta`. - **Relations** are abbreviated: `\leq` and `\geq` (less or equal, greater or equal), `\neq`, `\approx`, `\equiv`, `\sim`, `\propto`, `\in`, `\subset`. - **Negations** are made with `\not` in front of a relation, and many have a name of their own: `\notin` is ∉, `\neq` is ≠. - **Arrows** are `\to`, `\mapsto`, `\Rightarrow` (⇒), `\Leftrightarrow` (⇔). - **Big operators** `\sum`, `\prod`, `\int` grow in display style and take limits with `_` and `^`. - **Blackboard letters** for the number sets come from `\mathbb{R}`, `\mathbb{N}`, `\mathbb{Z}`, `\mathbb{Q}`, `\mathbb{C}` and need the `amssymb` (or `amsfonts`) package. A few symbols need a package: `\therefore` and `\because` need `amssymb`, and `\lVert` and `\rVert` (norm bars) need `amsmath`. If a symbol gives "Undefined control sequence", a missing package is the first suspect. **When you cannot remember the name,** look it up in the table below, which lists more than a hundred, or draw the symbol in a recognition tool such as Detexify, or search the Comprehensive LaTeX Symbol List, a PDF that lists thousands. ## How do you write matrices, aligned equations and piecewise functions? **Larger structures are environments: a block between `\begin{name}` and `\end{name}`, inside which `&` separates columns and `\\` ends a row.** The same pattern builds matrices, piecewise definitions and aligned equations. **Matrices.** The `amsmath` environments `pmatrix` (round brackets), `bmatrix` (square brackets) and `vmatrix` (vertical bars, a determinant) differ only in the brackets: `\begin{pmatrix} a & b \\ c & d \end{pmatrix}` gives $\begin{pmatrix} a & b \\ c & d \end{pmatrix}$, and `vmatrix` with the same entries gives the determinant $\begin{vmatrix} a & b \\ c & d \end{vmatrix}$. Use `\cdots`, `\vdots` and `\ddots` for the dots inside a large matrix. **Piecewise functions** use `cases`: each row has the value, `&`, and the condition: $$f(x) = \begin{cases} x^2 & x \ge 0 \\ -x & x < 0 \end{cases}$$ **Aligned equations.** Several lines that should line up at the equals signs go in `align` (numbered) or `align*` (unnumbered); put `&` just before the sign to align on it: - `(a+b)^2 &= a^2 + 2ab + b^2 \\` - `(a-b)^2 &= a^2 - 2ab + b^2` The `aligned` environment does the same inside a larger formula. Do not use `\\` or blank lines to space equations: leave that to LaTeX. The builder below fills in the code for the structures people look up most. Choose one, change the fields, and copy the result; the linter checks that the code is well formed. ```latex \begin{align} (a+b)^2 &= a^2 + 2ab + b^2 \\ (a-b)^2 &= a^2 - 2ab + b^2 \end{align} \[ A = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix}, \qquad \det A = \begin{vmatrix} 1 & 2 \\ 3 & 4 \end{vmatrix} = -2. \] ``` ## How do you write text, lists, tables and figures? **Everything that is not a formula follows the same idea: say what the thing is, and let LaTeX lay it out.** - **Paragraphs and lines.** A blank line starts a new paragraph. `\\` forces a line break and is rarely needed outside tables. - **Emphasis.** `\emph{word}` is italic (it switches back to upright inside italics), `\textbf{word}` is bold, `\texttt{code}` is monospace. - **Lists.** `itemize` makes bullets and `enumerate` numbers, with one `\item` per entry; they nest. - **Special characters.** Ten characters are commands in disguise: `#`, the dollar sign, `%` (a comment: the rest of the line is ignored), `&` (a column separator), `_` and `^` (scripts, only in math), `{`, `}` (groups), `~` (a non-breaking space) and the backslash. To print one, escape it with a backslash (`\%`, `\&`, `\#`, `\_`, `\{`, `\}`), or use `\textbackslash` for the backslash itself, `\textasciitilde` for the tilde and `\textasciicircum` for the caret. - **Quotes and dashes.** Open a quotation with two backticks and close it with two apostrophes (the typewriter quote `"` closes the wrong way); a hyphen is `-`, a range uses two hyphens (`10--20`) and a dash in a sentence uses three (`---`). - **Tables.** `tabular` takes a column specification, `l`, `c` and `r` for left, centered and right, and rows separated by `\\` with cells separated by `&`. `\hline` draws rules (or `\toprule`, `\midrule`, `\bottomrule` with `booktabs`). Wrap it in `table` to give it a caption and a label. - **Figures.** `\includegraphics[width=0.6\textwidth]{file.png}` (from `graphicx`) inside a `figure` environment with `\caption` and `\label`. - **References inside the text.** `\label{tab:prices}` right after the caption and `Table~\ref{tab:prices}` in the sentence. The tilde is a non-breaking space, so "Table" and its number are never split across lines. The code below shows a list, a table and a figure with their labels. ```latex \begin{enumerate} \item Write the source. \item Compile it \emph{twice} so that the references resolve. \end{enumerate} \begin{table}[ht] \centering \begin{tabular}{lr} \hline Item & Price (Rp) \\ \hline Notebook & 12\,500 \\ Pen \& ink & 4\,000 \\ \hline \end{tabular} \caption{Two prices.} \label{tab:prices} \end{table} Table~\ref{tab:prices} lists them; the ink costs 50\% less. \begin{figure}[ht] \centering \includegraphics[width=0.6\textwidth]{graph.png} \caption{A graph.} \label{fig:graph} \end{figure} ``` ## How do citations and bibliographies work? **Keep your sources in a `.bib` file, cite them by key with `\cite`, and let BibTeX or biblatex build the reference list.** Each source is one entry with a key you choose: ```latex % references.bib @book{knuth1984, author = {Donald E. Knuth}, title = {The {\TeX}book}, publisher = {Addison-Wesley}, year = {1984} } % main.tex, in the text: TeX was described by Knuth~\cite{knuth1984}. % main.tex, where the list should appear (usually at the end): \bibliographystyle{plain} \bibliography{references} ``` The build is a small pipeline. The first `pdflatex` run notes every `\cite` in the `.aux` file; `bibtex main` reads the `.bib` file and writes the formatted list; the next two `pdflatex` runs put the list in the document and fix the numbers. Keys are case-sensitive and must be unique. The braces in `{\TeX}` protect capital letters from being lowercased by the style. The newer biblatex with the biber program replaces BibTeX in many projects (the steps are `pdflatex`, `biber`, `pdflatex`), and gives more control over styles such as APA. `latexmk` and Overleaf run the right sequence automatically. ## What do the common LaTeX errors mean? **LaTeX reports a problem with a message and a line number; the first error is the one to fix, because later ones are often its echoes.** Read the line it names and the one before it. The most common messages: - `Undefined control sequence`: a command is misspelled (`\fraq`), or the package that defines it is not loaded (`\mathbb` without `amssymb`). - `Missing $ inserted`: mathematics was used outside math mode (a `^` or `_` in text, or a symbol such as `\alpha` without dollar signs), or a dollar sign is unmatched. - `Missing } inserted` and `Extra }, or forgotten $`: the braces do not balance; count the opening and closing braces of the line. - `Runaway argument`: a brace was never closed, so an argument ran on to the end of a paragraph. - `\begin{...} ended by \end{...}`: the names of an environment pair differ, or an inner environment was not closed. - `File ended while scanning use of...`: the same kind of problem, found at the end of the file. - `Misplaced alignment tab character &`: an ampersand outside a table, matrix or `align`; write `\&` to print one. - `LaTeX Error: File 'x.sty' not found`: a package is not installed; install it from your distribution, or use Overleaf. - `Overfull \hbox`: a warning, not an error: a line is too wide by the amount shown. **Habits that make them easy to find.** - Compile often, after each paragraph or formula, so a new error can only be in the new text. - Write `\begin{...}` and `\end{...}` together, then fill in between. - When stuck, make a minimal working example: delete everything that is not needed to reproduce the error. Half the time the mistake appears in the process, and if not, it is a perfect post for a forum. - Check formulas with the linter in the editor above before compiling: it finds unbalanced braces, `\left` without `\right`, mismatched environments, scripts like `x^10` and unknown commands. ## How do you use LaTeX from Python, JavaScript and Markdown? **LaTeX math is the common notation of the web and of scientific code: you can write it by hand, generate it from objects, or let a library draw it.** - **Markdown, notebooks and the web.** In Jupyter notebooks, Markdown renderers, many wikis and Wikipedia, `$...$` and `$$...$$` are drawn as formulas. In your own web pages, include **KaTeX** (fast, a subset of LaTeX) or **MathJax** (more complete) and write the same code. - **Python.** SymPy turns expressions into LaTeX with `latex()`; Matplotlib draws it in labels, as in `plt.title(r"$\alpha^2$")` (the `r` means raw string, so the backslash is kept); Pandoc converts Markdown with formulas into a PDF through LaTeX. - **Strings and backslashes.** In Python and JavaScript a backslash starts an escape, so `"\frac"` contains a form-feed character (`\f`) and `"\alpha"` is wrong. Use raw strings: `r"\frac"` in Python and `String.raw` in JavaScript. - **User text.** Text that comes from outside (names, titles, file contents) must be escaped before it goes into a LaTeX document, or a `%` or `&` in it breaks the build. The first Python program asks SymPy for the LaTeX of some expressions (as printed by SymPy `1.14`), and the second one escapes text and writes a table. The JavaScript program builds formulas as strings and shows the form-feed trap, and the C++ program escapes characters and prints a fraction. ```python from sympy import symbols, Integral, Sum, Rational, sqrt, oo, Matrix, latex, sin, pi, exp x, k, n = symbols("x k n") print(latex(Integral(x ** 2, (x, 0, 1)))) print(latex(Sum(1 / k ** 2, (k, 1, oo)))) print(latex(sqrt(x ** 2 + 1) / 2)) print(latex(Matrix([[1, 2], [3, 4]]))) print(latex(Rational(3, 4) * pi)) print(latex(exp(-x ** 2) * sin(x))) # \int\limits_{0}^{1} x^{2}\, dx # \sum_{k=1}^{\infty} \frac{1}{k^{2}} # \frac{\sqrt{x^{2} + 1}}{2} # \left[\begin{matrix}1 & 2\\3 & 4\end{matrix}\right] # \frac{3 \pi}{4} # e^{- x^{2}} \sin{\left(x \right)} ``` ```python SPECIAL = { "\\": r"\textbackslash{}", "&": r"\&", "%": r"\%", "$": r"\$", "#": r"\#", "_": r"\_", "{": r"\{", "}": r"\}", "~": r"\textasciitilde{}", "^": r"\textasciicircum{}", } def escape_latex(text): """Write the ten special characters so that LaTeX prints them as themselves.""" return "".join(SPECIAL.get(ch, ch) for ch in text) def latex_table(header, rows): """A tabular environment from a header and a list of rows of text.""" cols = "l" + "r" * (len(header) - 1) lines = [r"\begin{tabular}{" + cols + "}", r" \hline"] lines.append(" " + " & ".join(escape_latex(h) for h in header) + r" \\") lines.append(r" \hline") for row in rows: lines.append(" " + " & ".join(escape_latex(str(c)) for c in row) + r" \\") lines += [r" \hline", r"\end{tabular}"] return "\n".join(lines) print(escape_latex("50% of $5 & #1_a")) print(latex_table(["Item", "Price (Rp)"], [["Notebook", 12500], ["Pen & ink", 4000]])) print(r"\frac{%s}{%s}" % ("a+b", 2)) # 50\% of \$5 \& \#1\_a # \begin{tabular}{lr} # \hline # Item & Price (Rp) \\ # \hline # Notebook & 12500 \\ # Pen \& ink & 4000 \\ # \hline # \end{tabular} # \frac{a+b}{2} ``` ```javascript const special = { '\\': '\\textbackslash{}', '&': '\\&', '%': '\\%', $: '\\$', '#': '\\#', _: '\\_', '{': '\\{', '}': '\\}', '~': '\\textasciitilde{}', '^': '\\textasciicircum{}' } const escapeLatex = (text) => Array.from(text, (c) => special[c] ?? c).join('') escapeLatex('50% of $5 & #1_a') // '50\\% of \\$5 \\& \\#1\\_a' (each \\ is one backslash) // build formulas with ordinary strings: every backslash is written twice const frac = (a, b) => '\\frac{' + a + '}{' + b + '}' const sum = (v, from, to, body) => '\\sum_{' + v + '=' + from + '}^{' + to + '} ' + body frac('a+b', 2) // '\\frac{a+b}{2}' sum('i', 1, 'n', 'i^2') // '\\sum_{i=1}^{n} i^2' // a single backslash starts an escape: '\f' is a form feed, not a backslash followed by f '\frac'.length // 4: the form feed, r, a, c // String.raw in front of a template literal keeps every backslash, so you can write each one once ``` ```cpp #include #include using namespace std; int main() { char text[] = "50% of $5 & #1_a"; for (int i = 0; text[i] != 0; i++) { char c = text[i]; if (c == '%' || c == '&' || c == '$' || c == '#' || c == '_' || c == '{' || c == '}') printf("\\%c", c); // a backslash in front else printf("%c", c); } printf("\n"); int a = 3, b = 4; printf("\\frac{%d}{%d} = %.2f\n", a, b, (double)a / b); // in C++ source too, every backslash is written twice return 0; } /* output: 50\% of \$5 \& \#1\_a \frac{3}{4} = 0.75 */ ``` ## Where does LaTeX come from? **LaTeX grew out of one mathematician's dislike of how his book looked.** - **1976–1977.** Donald Knuth, finishing the second edition of volume 2 of The Art of Computer Programming, was dismayed by the proofs, which had been typeset by a new photographic process and looked far worse than the earlier metal type. He decided to write a system that would typeset mathematics as well as the best printers, and began TeX in 1977. - **1978–1982.** The first TeX (TeX78) was followed by the stable TeX82, together with the METAFONT language and the Computer Modern typefaces designed with it. Knuth documented the result in The TeXbook (1984). - **1984–1985.** Leslie Lamport wrote LaTeX, a set of macros on top of TeX that describes the structure of a document (sections, lists, equations) instead of the details of its layout; his book LaTeX: A Document Preparation System appeared in 1986. - **1992 and 1996.** The CTAN archive collected the packages in one place, and TeX Live began as a complete distribution. - **1994.** LaTeX2e, the version in use today, was released by a team led by Frank Mittelbach, and is still developed. - **1997–2007.** New engines followed: pdfTeX (PDF output directly, by Hàn Thế Thành), XeTeX (Unicode and system fonts, by Jonathan Kew, 2004) and LuaTeX (2007, scriptable in Lua). - **2009–2014.** MathJax (2009) and KaTeX (2014) brought LaTeX mathematics to web pages; Overleaf (2012) put the whole system in a browser. - **2021.** Knuth made the last scheduled update of TeX, version 3.141592653. The version number of TeX gets closer to π with every update, and Knuth has said it will become π at his death, when the program is to be frozen. For decades he has paid a reward, starting at 2.56 US dollars and doubling every year up to 327.68, for every error found in his programs. ## What mistakes do beginners make in LaTeX? **The most common beginner mistakes in LaTeX are the nine below, each with the correct statement.** | Mistake | Correct | |---|---| | ❌ Write `x^10` for ten | A script takes one character: write `x^{10}`, and `e^{-x}` rather than `e^-x`. | | ❌ Type a percent sign, ampersand, hash or underscore in text as it is | They are special: write `\%`, `\&`, `\#`, `\_` (and escape text that comes from outside). | | ❌ Leave a blank line inside a formula | A blank line ends the paragraph and the formula with it: delete it, or put the pieces in `align`. | | ❌ Use double dollar signs for displayed equations | Use `\[ ... \]` or an `equation` environment: they space the formula correctly. | | ❌ Use `\\` or several blank lines to add space | A blank line makes a paragraph and LaTeX spaces it; use `\vspace` only for a deliberate gap. | | ❌ Put `\usepackage` after `\begin{document}` | Packages are loaded in the preamble, before `\begin{document}`. | | ❌ Compile once and wonder about the "??" | References and citations need several runs: `pdflatex`, `bibtex`, `pdflatex`, `pdflatex`, or `latexmk`. | | ❌ Type straight quotes around a word | Open with two backticks and close with two apostrophes, so the quotes face the right way. | | ❌ Write `sin x` or `lim` as plain letters in a formula | Use `\sin x` and `\lim`: the commands give upright names with the right spacing. | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: LaTeX at a glance - **What it is:** plain text with commands, compiled by `pdflatex` into a PDF; TeX (Knuth) is the engine and LaTeX (Lamport) the commands. - **Document:** `\documentclass`, a preamble with `\usepackage`, and `\begin{document}` ... `\end{document}`. - **Math mode:** `$...$` inline, `\[ ... \]` displayed, `equation` for numbered; scripts take one character, so use braces: `x^{10}`. - **Commands:** `\frac{a}{b}`, `\sqrt[n]{x}`, `\sum_{i=1}^{n}`, `\int_a^b`, `\left( ... \right)`, Greek letters by name, `\sin` and `\lim` for functions. - **Environments:** `pmatrix`, `cases`, `align`, `itemize`, `tabular`, `figure`: `&` separates cells, `\\` ends a row. - **Special characters:** `# $ % & _ { } ~ ^ \` must be escaped; escape text that comes from outside. - **Builds:** several runs for labels and citations; `pdflatex`, `bibtex`, `pdflatex`, `pdflatex`, or `latexmk` and Overleaf. - **Errors:** read the first one; undefined control sequence, missing $, unbalanced braces; compile often and use a minimal example. - **Elsewhere:** KaTeX and MathJax on the web, SymPy `latex()`, raw strings for backslashes. ## Glossary: key terms - **LaTeX**: A system of commands on top of TeX for writing documents, in which you describe the structure and a compiler produces the layout. - **TeX**: The typesetting engine written by Donald Knuth, which LaTeX is built on. - **Compiler**: The program, such as pdflatex, that reads the source file and produces the PDF. - **Preamble**: The part of a LaTeX file before the begin document line, where the class, packages and settings are given. - **Package**: An add-on loaded with the usepackage command that provides new commands or changes how the document is built, such as amsmath. - **Environment**: A block between a begin command and an end command with the same name, such as equation, itemize or pmatrix. - **Math mode**: The state in which LaTeX reads formulas: between dollar signs inside text, or in a displayed equation. - **BibTeX**: A program that turns a bib file of sources into the formatted list of references cited in a document. - **Escape character**: The backslash that turns a special character into an ordinary one, as in the percent escape, so that it prints itself. ## Frequently asked questions ### What is LaTeX used for? It is used to write documents with a lot of mathematics or structure: research papers, theses, textbooks, problem sets and slides. It sets formulas well, numbers sections and equations automatically, manages citations, and keeps the style consistent. ### Is LaTeX a programming language? LaTeX is a markup language built from macros, and the TeX engine underneath it is capable of real computation. In practice you write documents, not programs, and you can ignore the programming side. ### What is the difference between TeX and LaTeX? TeX is the typesetting engine written by Donald Knuth. LaTeX is a set of commands on top of it, by Leslie Lamport, that lets you describe a document by its structure, with sections, lists and equations, instead of its layout. ### How do you write a fraction, a square root or a sum in LaTeX? Use frac with two braced arguments for a fraction, sqrt with one for a root, and sum with an underscore and a caret for the limits, all inside math mode between dollar signs. ### How do you compile a LaTeX document? Save it as main.tex and run pdflatex main, or press Compile on Overleaf. If the document has references or a bibliography, run it again, with bibtex in between for citations, or let latexmk repeat the steps. ### Why does LaTeX say "Undefined control sequence"? LaTeX met a command it does not know. Either the name is misspelled, or the package that defines it is not loaded in the preamble, as with mathbb without amssymb. Fix the first such error, since the others often follow from it. ### How do you write LaTeX in Markdown or on a website? Many Markdown tools, Jupyter notebooks and wikis draw formulas written between single or double dollar signs. On your own page, include KaTeX or MathJax, which read the same code and draw it in the browser. ### How does LaTeX compare with a word processor? A word processor shows the page as you type; LaTeX makes you describe the content and builds the page after. LaTeX wins for formulas, long documents and references; a word processor is quicker for short, visual, collaborative notes. --- # LaTeX: Menulis Matematika dan Dokumen Source: https://nunada.my.id/artikel/latex/ Updated: 2026-10-23 ## Jawaban singkat **LaTeX adalah sistem penyusunan huruf: kamu menulis berkas teks biasa dengan perintah seperti `\frac{a}{b}` dan `\section{Pendahuluan}`, dan sebuah program mengubahnya menjadi PDF yang rapi.** Ia menjadi standar untuk makalah matematika, sains, dan komputasi karena menyusun rumus dengan indah, menomori halaman, persamaan, dan kutipan secara otomatis, dan memisahkan tampilan dokumen dari isinya. Matematika ditaruh di antara tanda dolar, seperti `$x^2+y^2=r^2$`. ### Poin penting - LaTeX adalah teks bertanda: kamu mengetik isinya dan menyatakan bagian apa tiap bagian itu (bagian, rumus, daftar), dan kompilator memilih tipografinya. Dokumen adalah berkas `.tex`; mengompilasinya dengan `pdflatex` menghasilkan PDF. - Matematika berada dalam mode matematika: `$...$` di dalam kalimat, `\[ ... \]` pada barisnya sendiri. Skrip hanya mengambil satu karakter kecuali diberi kurung kurawal: `x^{10}`, bukan `x^10`. Pecahan, akar, dan jumlah adalah `\frac{a}{b}`, `\sqrt{x}`, dan `\sum_{i=1}^{n}`. - Setiap dokumen memiliki `\documentclass`, sebuah preamble tempat paket dimuat (`\usepackage{amsmath}`), dan isi di antara `\begin{document}` dan `\end{document}`. Lingkungan seperti `equation`, `align`, `pmatrix`, dan `itemize` selalu berpasangan `\begin{...}` dan `\end{...}`. - Sepuluh karakter bersifat khusus dalam teks LaTeX: `# % & _ { } ~ ^ \` dan tanda dolar. Untuk mencetaknya, beri escape (`\%`, `\&`, `\_`) atau pakai perintah seperti `\textbackslash`. Label dan kutipan memerlukan beberapa kali kompilasi: `pdflatex`, `bibtex`, `pdflatex`, `pdflatex`. - Baca galat dari yang pertama ke bawah: `Undefined control sequence` adalah perintah yang salah eja atau paket yang hilang, `Missing $ inserted` adalah matematika di luar mode matematika (`^` dalam teks, atau `$` yang sendirian), `Missing } inserted` adalah kurung kurawal yang tidak seimbang. Sebuah linter dapat menemukan kebanyakannya sebelum kamu mengompilasi. - LaTeX juga adalah notasi web dan kode: MathJax dan KaTeX menggambarnya di peramban, Markdown dan notebook Jupyter menerima `$...$`, SymPy Python mencetaknya dengan `latex()`, dan Overleaf mengompilasi dokumen secara daring tanpa memasang apa pun. ## Apa itu LaTeX? **LaTeX adalah sistem untuk menyiapkan dokumen yang di dalamnya kamu menulis teks dan menandai strukturnya, dan sebuah program bernama kompilator menata letaknya dan menghasilkan PDF.** Kamu tidak menyeret rumus ke tempatnya atau memilih ukuran huruf untuk judul bagian. Kamu mengetik `\section{Hasil}` dan LaTeX menentukan seperti apa judul bagian itu, berapa ruang di sekelilingnya, nomor berapa yang ia dapat, dan di mana ia muncul dalam daftar isi. Ini adalah "yang kamu maksud adalah yang kamu dapat", berlawanan dengan "yang kamu lihat adalah yang kamu dapat" pada pengolah kata. **Mengapa orang memakainya.** - **Matematika.** Rumus ditulis dalam teks dan disusun dengan ketelitian penyusun huruf profesional: spasi yang tepat di sekitar operator, kurung yang membesar mengikuti isinya, dan pecahan serta skrip berukuran benar. - **Penomoran dan rujukan otomatis.** Bagian, persamaan, gambar, dan tabel dinomori untukmu, dan `\ref` serta `\cite` menjaga setiap rujukan silang dan kutipan tetap benar ketika kamu menambah atau memindahkan sesuatu. - **Stabilitas.** Berkas sumber adalah teks biasa: ia terbuka di mana saja, cocok dengan kontrol versi, dan masih dapat dikompilasi bertahun-tahun kemudian. - **Konsistensi.** Tampilannya adalah sifat kelas dokumen dan paket, sehingga tesis, makalah, dan seperangkat slide mempertahankan gaya yang seragam, dan sebuah jurnal dapat menyediakan kelas yang memformat makalahmu sesuai keinginannya. **Namanya.** TeX (dibaca "tek", dari huruf Yunani τ ε χ) adalah mesin penyusunan huruf yang ditulis Donald Knuth. LaTeX (baca "la-tek" atau "lei-tek") adalah lapisan perintah di atas TeX, ditulis Leslie Lamport, yang memudahkan menguraikan dokumen. Orang menyebut "LaTeX" untuk sistem maupun bahasanya. Overleaf adalah situs yang mengompilasi LaTeX di peramban; TeX Live dan MiKTeX adalah distribusi yang kamu pasang di komputermu sendiri. **Alur kerjanya.** Kamu menulis `main.tex`, menjalankan kompilator (`pdflatex main`), dan membuka `main.pdf`. Kompilator juga menulis berkas `.log` berisi pesannya dan berkas `.aux` tempat ia mengingat nomor untuk pengerjaan berikutnya. Inilah dokumen lengkap yang terkecil: ```latex \documentclass{article} \begin{document} Hello, \LaTeX! The area of a circle of radius $r$ is $A = \pi r^2$. \end{document} ``` Baris pertama memilih kelas dokumen (`article`, `report`, `book`, `beamer` untuk slide, dan seterusnya). Segala sesuatu di antara `\begin{document}` dan `\end{document}` adalah dokumennya. Apa pun sebelum `\begin{document}` adalah preamble: pengaturan dan paket, yang akan kamu temui berikutnya. Baris kosong memulai paragraf baru; beberapa spasi atau satu pergantian baris dihitung satu spasi. ## Bagaimana menulis dan mengompilasi dokumen LaTeX pertamamu? **Tulis berkas `.tex` dengan kelas dokumen, preamble, dan isi, lalu kompilasi dengan `pdflatex`; awal tercepat adalah Overleaf, yang tidak perlu dipasang.** Pasang distribusi (TeX Live di Linux, macOS, dan Windows; MiKTeX di Windows) dan sebuah editor, atau buat proyek gratis di Overleaf, tempat tombol Compile menjalankan semuanya untukmu. **Kerangka dokumen sungguhan.** Makalah memiliki judul, penulis, perintah `\maketitle`, bagian, dan biasanya abstrak: - `\documentclass[11pt,a4paper]{article}`: kelasnya, dengan opsi untuk ukuran huruf dan kertas. - `\usepackage{...}`: satu baris per paket, hanya di preamble. `amsmath` memberi lingkungan persamaan yang lebih baik, `amssymb` simbol tambahan, `graphicx` gambar, `booktabs` garis tabel yang lebih indah, `geometry` margin, dan `hyperref` tautan yang dapat diklik (muat paling akhir). - `\title`, `\author`, `\date`: bagian depan, dicetak oleh `\maketitle`. - `\section`, `\subsection`: judul bagian (`report` atau `book` juga memiliki `\chapter`). - `abstract`: ringkasan singkat, di kelas `article` dan `report` (`book` tidak memilikinya). **Berapa kali mengompilasi.** Rujukan silang seperti `\ref{eq:main}` diselesaikan dari berkas `.aux` yang ditulis pada pengerjaan sebelumnya, sehingga kompilasi pertama mencetak "??" dan yang kedua mencetak nomornya. Daftar pustaka memerlukan urutan `pdflatex`, `bibtex`, `pdflatex`, `pdflatex`. Alat `latexmk -pdf main.tex` (dan Overleaf) mengulang langkah-langkah itu untukmu sampai tidak ada yang berubah. Rakit satu di bawah. Pilih kelas, paket, dan bagian, lalu baca sumbernya; ia juga mendaftar perintah untuk mengompilasinya dan aturan yang diterapkan halaman ini (misalnya `hyperref` paling akhir dan buku tidak memiliki abstrak). ## Bagaimana menulis matematika di LaTeX? **Taruh matematika dalam mode matematika: di antara tanda dolar tunggal di dalam kalimat, atau di antara `\[` dan `\]` untuk rumus pada barisnya sendiri.** Dalam mode matematika huruf adalah peubah miring, spasi diabaikan (LaTeX mengatur spasi operator sendiri), dan perintah dimulai dengan garis miring terbalik. Yang kamu pakai terus-menerus: | Kamu ingin | Kamu mengetik | Kamu mendapat | |---|---|---| | superskrip | `x^2` | $x^2$ | | subskrip | `a_n` | $a_n$ | | keduanya | `x_i^2` | $x_i^2$ | | pecahan | `\frac{a}{b}` | $\frac{a}{b}$ | | akar kuadrat | `\sqrt{x}` | $\sqrt{x}$ | | akar pangkat $n$ | `\sqrt[3]{x}` | $\sqrt[3]{x}$ | | huruf Yunani | `\alpha \beta \pi` | $\alpha\ \beta\ \pi$ | | nama fungsi | `\sin x` | $\sin x$ | | jumlah | `\sum_{i=1}^{n} i` | $\sum_{i=1}^{n} i$ | | integral | `\int_0^1 x\,dx` | $\int_0^1 x\,dx$ | | limit | `\lim_{x\to 0}` | $\lim_{x\to 0}$ | **Kurung kurawal mengelompokkan.** Superskrip atau subskrip mengambil satu karakter. Jadi `x^10` adalah $x^1$ diikuti nol, dan `e^-x` hanya menaikkan tanda minusnya. Tulis `x^{10}` dan `e^{-x}` untuk menaikkan seluruh kelompok. Kurung kurawal juga membatasi argumen `\frac`, `\sqrt`, dan perintah lain. Arti operasi itu sendiri dijelaskan dalam [eksponen dan akar](https://nunada.my.id/artikel/eksponen-dan-akar/#what-is-an-exponent) dan dalam [pecahan aljabar](https://nunada.my.id/artikel/bentuk-aljabar/#algebraic-fractions). **Kurung yang pas.** `\left(` dan `\right)` membuat kurung membesar setinggi isi di antaranya, seperti pada `\left( \frac{a}{b} \right)`. Setiap `\left` memerlukan `\right` (tulis `\right.` untuk yang tak terlihat). **Kata, spasi, dan fungsi.** Teks di dalam rumus ditaruh dalam `\text{...}`, seperti `x > 0 \text{ dan } y > 0`. Tambahkan spasi kecil dengan `\,`, yang lebih besar dengan `\quad`. Tulis `\sin`, `\log`, `\lim`, dan `\max` untuk nama fungsi: bila diketik sebagai huruf biasa, `sin` akan menjadi hasil kali $s\,i\,n$ dari tiga peubah bercetak miring, dengan spasi yang salah. **Penomoran.** Lingkungan `equation` menomori sebuah rumus, dan `\label{eq:nama}` memungkinkan kamu mengutipnya dengan `\eqref{eq:nama}` (dari amsmath). Tanpa nomor, pakai `\[ ... \]` atau bentuk berbintang `equation*`. Editor di bawah menggambar rumus saat kamu mengetik dan, seperti guru yang teliti, menunjuk kesalahan yang lazim: kurung kurawal hilang, `x^10`, lingkungan yang tidak cocok, perintah tak terdefinisi. Klik contoh yang rusak untuk melihat apa katanya. ```latex % in the preamble: \usepackage{amsmath} The roots of $ax^2 + bx + c = 0$ are given by the formula \[ x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}. \] \begin{equation} \label{eq:euler} e^{i\pi} + 1 = 0 \end{equation} Equation~\eqref{eq:euler} is Euler's identity. Functions are upright: $\sin^2 x + \cos^2 x = 1$, and $\lim_{x \to 0} \frac{\sin x}{x} = 1$. ``` ## Di mana mencari perintah untuk sebuah simbol? **Kebanyakan simbol dinamai menurut wujudnya: `\alpha` adalah α, `\leq` adalah ≤, `\infty` adalah ∞, `\rightarrow` (atau `\to`) adalah →.** Namanya mengikuti beberapa pola yang membuatnya mudah ditebak: - **Huruf Yunani** dieja: `\alpha`, `\beta`, `\gamma` untuk huruf kecil dan `\Gamma`, `\Delta`, `\Omega` untuk huruf kapital (hanya kapital yang berbeda dari huruf Latin yang ada: tidak ada `\Alpha`, karena itu akan berupa A). `\epsilon` dan `\varepsilon` adalah dua bentuk huruf yang sama, demikian pula `\phi` dan `\varphi`, serta `\theta` dan `\vartheta`. - **Relasi** disingkat: `\leq` dan `\geq` (kurang atau sama, lebih atau sama), `\neq`, `\approx`, `\equiv`, `\sim`, `\propto`, `\in`, `\subset`. - **Negasi** dibuat dengan `\not` di depan sebuah relasi, dan banyak yang punya nama sendiri: `\notin` adalah ∉, `\neq` adalah ≠. - **Panah** adalah `\to`, `\mapsto`, `\Rightarrow` (⇒), `\Leftrightarrow` (⇔). - **Operator besar** `\sum`, `\prod`, `\int` membesar dalam gaya tampilan dan menerima batas dengan `_` dan `^`. - **Huruf papan tulis** untuk himpunan bilangan berasal dari `\mathbb{R}`, `\mathbb{N}`, `\mathbb{Z}`, `\mathbb{Q}`, `\mathbb{C}` dan memerlukan paket `amssymb` (atau `amsfonts`). Beberapa simbol memerlukan paket: `\therefore` dan `\because` memerlukan `amssymb`, dan `\lVert` serta `\rVert` (garis norma) memerlukan `amsmath`. Jika sebuah simbol memberi "Undefined control sequence", paket yang hilang adalah tersangka pertama. **Bila kamu tidak ingat namanya,** cari di tabel di bawah, yang mendaftar lebih dari seratus, atau gambar simbolnya pada alat pengenal seperti Detexify, atau cari di Comprehensive LaTeX Symbol List, PDF yang mendaftar ribuan. ## Bagaimana menulis matriks, persamaan sejajar, dan fungsi sepotong-sepotong? **Struktur yang lebih besar adalah lingkungan: blok di antara `\begin{nama}` dan `\end{nama}`, yang di dalamnya `&` memisahkan kolom dan `\\` mengakhiri baris.** Pola yang sama membangun matriks, definisi sepotong-sepotong, dan persamaan sejajar. **Matriks.** Lingkungan `amsmath` `pmatrix` (kurung bulat), `bmatrix` (kurung siku), dan `vmatrix` (garis tegak, determinan) hanya berbeda pada kurungnya: `\begin{pmatrix} a & b \\ c & d \end{pmatrix}` menghasilkan $\begin{pmatrix} a & b \\ c & d \end{pmatrix}$, dan `vmatrix` dengan entri yang sama menghasilkan determinan $\begin{vmatrix} a & b \\ c & d \end{vmatrix}$. Pakai `\cdots`, `\vdots`, dan `\ddots` untuk titik-titik di dalam matriks besar. **Fungsi sepotong-sepotong** memakai `cases`: setiap baris memuat nilai, `&`, dan syaratnya: $$f(x) = \begin{cases} x^2 & x \ge 0 \\ -x & x < 0 \end{cases}$$ **Persamaan sejajar.** Beberapa baris yang harus rata pada tanda sama dengan ditaruh dalam `align` (bernomor) atau `align*` (tanpa nomor); taruh `&` tepat sebelum tanda itu untuk meratakan padanya: - `(a+b)^2 &= a^2 + 2ab + b^2 \\` - `(a-b)^2 &= a^2 - 2ab + b^2` Lingkungan `aligned` melakukan hal yang sama di dalam rumus yang lebih besar. Jangan pakai `\\` atau baris kosong untuk memberi spasi antarpersamaan: serahkan itu pada LaTeX. Penyusun di bawah mengisi kode untuk struktur yang paling sering dicari orang. Pilih satu, ubah kolomnya, dan salin hasilnya; linter memeriksa bahwa kodenya terbentuk dengan baik. ```latex \begin{align} (a+b)^2 &= a^2 + 2ab + b^2 \\ (a-b)^2 &= a^2 - 2ab + b^2 \end{align} \[ A = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix}, \qquad \det A = \begin{vmatrix} 1 & 2 \\ 3 & 4 \end{vmatrix} = -2. \] ``` ## Bagaimana menulis teks, daftar, tabel, dan gambar? **Segala yang bukan rumus mengikuti gagasan yang sama: sebutkan apa bendanya, dan biarkan LaTeX menatanya.** - **Paragraf dan baris.** Baris kosong memulai paragraf baru. `\\` memaksa pergantian baris dan jarang diperlukan di luar tabel. - **Penekanan.** `\emph{kata}` miring (ia kembali tegak di dalam huruf miring), `\textbf{kata}` tebal, `\texttt{kode}` monospasi. - **Daftar.** `itemize` membuat butir dan `enumerate` menomori, dengan satu `\item` per entri; keduanya dapat bersarang. - **Karakter khusus.** Sepuluh karakter adalah perintah yang menyamar: `#`, tanda dolar, `%` (komentar: sisa baris diabaikan), `&` (pemisah kolom), `_` dan `^` (skrip, hanya dalam matematika), `{`, `}` (kelompok), `~` (spasi yang tidak dapat dipatahkan), dan garis miring terbalik. Untuk mencetaknya, beri escape dengan garis miring terbalik (`\%`, `\&`, `\#`, `\_`, `\{`, `\}`), atau pakai `\textbackslash` untuk garis miring terbalik itu sendiri, `\textasciitilde` untuk tilde dan `\textasciicircum` untuk tanda sisipan. - **Kutipan dan tanda hubung.** Buka kutipan dengan dua tanda petik balik dan tutup dengan dua apostrof (tanda kutip mesin tik `"` menutup ke arah yang salah); tanda hubung adalah `-`, rentang memakai dua tanda hubung (`10--20`) dan tanda pisah dalam kalimat memakai tiga (`---`). - **Tabel.** `tabular` menerima spesifikasi kolom, `l`, `c`, dan `r` untuk rata kiri, tengah, dan kanan, dan baris yang dipisah `\\` dengan sel yang dipisah `&`. `\hline` menggambar garis (atau `\toprule`, `\midrule`, `\bottomrule` dengan `booktabs`). Bungkus dalam `table` untuk memberinya keterangan dan label. - **Gambar.** `\includegraphics[width=0.6\textwidth]{berkas.png}` (dari `graphicx`) di dalam lingkungan `figure` dengan `\caption` dan `\label`. - **Rujukan di dalam teks.** `\label{tab:harga}` tepat setelah keterangan dan `Tabel~\ref{tab:harga}` dalam kalimat. Tilde adalah spasi yang tidak dapat dipatahkan, sehingga "Tabel" dan nomornya tidak pernah terpisah di dua baris. Kode di bawah memperlihatkan daftar, tabel, dan gambar beserta labelnya. ```latex \begin{enumerate} \item Write the source. \item Compile it \emph{twice} so that the references resolve. \end{enumerate} \begin{table}[ht] \centering \begin{tabular}{lr} \hline Item & Price (Rp) \\ \hline Notebook & 12\,500 \\ Pen \& ink & 4\,000 \\ \hline \end{tabular} \caption{Two prices.} \label{tab:prices} \end{table} Table~\ref{tab:prices} lists them; the ink costs 50\% less. \begin{figure}[ht] \centering \includegraphics[width=0.6\textwidth]{graph.png} \caption{A graph.} \label{fig:graph} \end{figure} ``` ## Bagaimana kutipan dan daftar pustaka bekerja? **Simpan sumbermu dalam berkas `.bib`, kutip dengan kunci memakai `\cite`, dan biarkan BibTeX atau biblatex menyusun daftar pustaka.** Setiap sumber adalah satu entri dengan kunci yang kamu pilih: ```latex % references.bib @book{knuth1984, author = {Donald E. Knuth}, title = {The {\TeX}book}, publisher = {Addison-Wesley}, year = {1984} } % main.tex, in the text: TeX was described by Knuth~\cite{knuth1984}. % main.tex, where the list should appear (usually at the end): \bibliographystyle{plain} \bibliography{references} ``` Pembangunannya adalah saluran kecil. Pengerjaan `pdflatex` pertama mencatat setiap `\cite` dalam berkas `.aux`; `bibtex main` membaca berkas `.bib` dan menulis daftar yang terformat; dua pengerjaan `pdflatex` berikutnya menaruh daftar itu dalam dokumen dan memperbaiki nomornya. Kunci peka huruf besar-kecil dan harus unik. Kurung kurawal pada `{\TeX}` melindungi huruf kapital dari diubah menjadi huruf kecil oleh gayanya. biblatex yang lebih baru dengan program biber menggantikan BibTeX pada banyak proyek (langkahnya `pdflatex`, `biber`, `pdflatex`), dan memberi lebih banyak kendali atas gaya seperti APA. `latexmk` dan Overleaf menjalankan urutan yang benar secara otomatis. ## Apa arti galat LaTeX yang umum? **LaTeX melaporkan masalah dengan pesan dan nomor baris; galat pertama adalah yang harus diperbaiki, karena yang berikutnya sering hanya gemanya.** Baca baris yang ia sebut dan baris sebelumnya. Pesan yang paling umum: - `Undefined control sequence`: sebuah perintah salah eja (`\fraq`), atau paket yang mendefinisikannya belum dimuat (`\mathbb` tanpa `amssymb`). - `Missing $ inserted`: matematika dipakai di luar mode matematika (`^` atau `_` dalam teks, atau simbol seperti `\alpha` tanpa tanda dolar), atau sebuah tanda dolar tidak berpasangan. - `Missing } inserted` dan `Extra }, or forgotten $`: kurung kurawal tidak seimbang; hitung kurung kurawal pembuka dan penutup pada baris itu. - `Runaway argument`: sebuah kurung kurawal tidak pernah ditutup, sehingga argumen berlanjut sampai akhir paragraf. - `\begin{...} ended by \end{...}`: nama pasangan lingkungan berbeda, atau lingkungan dalam tidak ditutup. - `File ended while scanning use of...`: masalah sejenis, ditemukan di akhir berkas. - `Misplaced alignment tab character &`: ampersand di luar tabel, matriks, atau `align`; tulis `\&` untuk mencetaknya. - `LaTeX Error: File 'x.sty' not found`: sebuah paket tidak terpasang; pasang dari distribusimu, atau pakai Overleaf. - `Overfull \hbox`: peringatan, bukan galat: sebuah baris terlalu lebar sebesar yang ditunjukkan. **Kebiasaan yang memudahkan menemukannya.** - Kompilasi sering, setelah setiap paragraf atau rumus, sehingga galat baru hanya mungkin ada di teks baru. - Tulis `\begin{...}` dan `\end{...}` bersama-sama, lalu isi di antaranya. - Bila buntu, buat contoh minimal yang berfungsi: hapus semua yang tidak diperlukan untuk mereproduksi galat. Separuh waktu kesalahannya muncul dalam prosesnya, dan bila tidak, itu bahan yang sempurna untuk sebuah forum. - Periksa rumus dengan linter pada editor di atas sebelum mengompilasi: ia menemukan kurung kurawal tak seimbang, `\left` tanpa `\right`, lingkungan yang tidak cocok, skrip seperti `x^10`, dan perintah tak dikenal. ## Bagaimana memakai LaTeX dari Python, JavaScript, dan Markdown? **Matematika LaTeX adalah notasi umum web dan kode ilmiah: kamu dapat menulisnya dengan tangan, membangkitkannya dari objek, atau membiarkan pustaka menggambarnya.** - **Markdown, notebook, dan web.** Di notebook Jupyter, penerjemah Markdown, banyak wiki, dan Wikipedia, `$...$` dan `$$...$$` digambar sebagai rumus. Di halaman webmu sendiri, sertakan **KaTeX** (cepat, bagian dari LaTeX) atau **MathJax** (lebih lengkap) dan tulis kode yang sama. - **Python.** SymPy mengubah ungkapan menjadi LaTeX dengan `latex()`; Matplotlib menggambarnya pada label, seperti `plt.title(r"$\alpha^2$")` (`r` berarti raw string, sehingga garis miring terbalik dipertahankan); Pandoc mengubah Markdown berisi rumus menjadi PDF lewat LaTeX. - **String dan garis miring terbalik.** Di Python dan JavaScript garis miring terbalik memulai escape, sehingga `"\frac"` memuat karakter form-feed (`\f`) dan `"\alpha"` salah. Pakai raw string: `r"\frac"` di Python dan `String.raw` di JavaScript. - **Teks pengguna.** Teks yang datang dari luar (nama, judul, isi berkas) harus di-escape sebelum masuk ke dokumen LaTeX, atau `%` atau `&` di dalamnya merusak pembangunan. Program Python pertama meminta SymPy memberi LaTeX untuk beberapa ungkapan (seperti dicetak SymPy `1.14`), dan yang kedua meng-escape teks dan menulis tabel. Program JavaScript membangun rumus sebagai string dan memperlihatkan jebakan form-feed, dan program C++ meng-escape karakter dan mencetak sebuah pecahan. ```python from sympy import symbols, Integral, Sum, Rational, sqrt, oo, Matrix, latex, sin, pi, exp x, k, n = symbols("x k n") print(latex(Integral(x ** 2, (x, 0, 1)))) print(latex(Sum(1 / k ** 2, (k, 1, oo)))) print(latex(sqrt(x ** 2 + 1) / 2)) print(latex(Matrix([[1, 2], [3, 4]]))) print(latex(Rational(3, 4) * pi)) print(latex(exp(-x ** 2) * sin(x))) # \int\limits_{0}^{1} x^{2}\, dx # \sum_{k=1}^{\infty} \frac{1}{k^{2}} # \frac{\sqrt{x^{2} + 1}}{2} # \left[\begin{matrix}1 & 2\\3 & 4\end{matrix}\right] # \frac{3 \pi}{4} # e^{- x^{2}} \sin{\left(x \right)} ``` ```python SPECIAL = { "\\": r"\textbackslash{}", "&": r"\&", "%": r"\%", "$": r"\$", "#": r"\#", "_": r"\_", "{": r"\{", "}": r"\}", "~": r"\textasciitilde{}", "^": r"\textasciicircum{}", } def escape_latex(text): """Write the ten special characters so that LaTeX prints them as themselves.""" return "".join(SPECIAL.get(ch, ch) for ch in text) def latex_table(header, rows): """A tabular environment from a header and a list of rows of text.""" cols = "l" + "r" * (len(header) - 1) lines = [r"\begin{tabular}{" + cols + "}", r" \hline"] lines.append(" " + " & ".join(escape_latex(h) for h in header) + r" \\") lines.append(r" \hline") for row in rows: lines.append(" " + " & ".join(escape_latex(str(c)) for c in row) + r" \\") lines += [r" \hline", r"\end{tabular}"] return "\n".join(lines) print(escape_latex("50% of $5 & #1_a")) print(latex_table(["Item", "Price (Rp)"], [["Notebook", 12500], ["Pen & ink", 4000]])) print(r"\frac{%s}{%s}" % ("a+b", 2)) # 50\% of \$5 \& \#1\_a # \begin{tabular}{lr} # \hline # Item & Price (Rp) \\ # \hline # Notebook & 12500 \\ # Pen \& ink & 4000 \\ # \hline # \end{tabular} # \frac{a+b}{2} ``` ```javascript const special = { '\\': '\\textbackslash{}', '&': '\\&', '%': '\\%', $: '\\$', '#': '\\#', _: '\\_', '{': '\\{', '}': '\\}', '~': '\\textasciitilde{}', '^': '\\textasciicircum{}' } const escapeLatex = (text) => Array.from(text, (c) => special[c] ?? c).join('') escapeLatex('50% of $5 & #1_a') // '50\\% of \\$5 \\& \\#1\\_a' (each \\ is one backslash) // build formulas with ordinary strings: every backslash is written twice const frac = (a, b) => '\\frac{' + a + '}{' + b + '}' const sum = (v, from, to, body) => '\\sum_{' + v + '=' + from + '}^{' + to + '} ' + body frac('a+b', 2) // '\\frac{a+b}{2}' sum('i', 1, 'n', 'i^2') // '\\sum_{i=1}^{n} i^2' // a single backslash starts an escape: '\f' is a form feed, not a backslash followed by f '\frac'.length // 4: the form feed, r, a, c // String.raw in front of a template literal keeps every backslash, so you can write each one once ``` ```cpp #include #include using namespace std; int main() { char text[] = "50% of $5 & #1_a"; for (int i = 0; text[i] != 0; i++) { char c = text[i]; if (c == '%' || c == '&' || c == '$' || c == '#' || c == '_' || c == '{' || c == '}') printf("\\%c", c); // a backslash in front else printf("%c", c); } printf("\n"); int a = 3, b = 4; printf("\\frac{%d}{%d} = %.2f\n", a, b, (double)a / b); // in C++ source too, every backslash is written twice return 0; } /* output: 50\% of \$5 \& \#1\_a \frac{3}{4} = 0.75 */ ``` ## Dari mana LaTeX berasal? **LaTeX tumbuh dari ketidaksukaan seorang matematikawan pada penampilan bukunya.** - **1976–1977.** Donald Knuth, ketika menyelesaikan edisi kedua jilid 2 The Art of Computer Programming, kecewa pada contoh cetaknya, yang disusun dengan proses fotografi baru dan tampak jauh lebih buruk daripada huruf logam sebelumnya. Ia memutuskan menulis sistem yang akan menyusun matematika sebaik percetakan terbaik, dan memulai TeX pada 1977. - **1978–1982.** TeX pertama (TeX78) disusul TeX82 yang stabil, bersama bahasa METAFONT dan huruf Computer Modern yang dirancang dengannya. Knuth mendokumentasikan hasilnya dalam The TeXbook (1984). - **1984–1985.** Leslie Lamport menulis LaTeX, seperangkat makro di atas TeX yang menguraikan struktur dokumen (bagian, daftar, persamaan) alih-alih rincian tata letaknya; bukunya LaTeX: A Document Preparation System terbit pada 1986. - **1992 dan 1996.** Arsip CTAN mengumpulkan paket di satu tempat, dan TeX Live dimulai sebagai distribusi lengkap. - **1994.** LaTeX2e, versi yang dipakai sekarang, dirilis oleh tim yang dipimpin Frank Mittelbach, dan masih dikembangkan. - **1997–2007.** Mesin baru menyusul: pdfTeX (keluaran PDF langsung, oleh Hàn Thế Thành), XeTeX (Unicode dan huruf sistem, oleh Jonathan Kew, 2004), dan LuaTeX (2007, dapat diprogram dengan Lua). - **2009–2014.** MathJax (2009) dan KaTeX (2014) membawa matematika LaTeX ke halaman web; Overleaf (2012) menaruh seluruh sistem di peramban. - **2021.** Knuth membuat pembaruan terjadwal terakhir TeX, versi 3,141592653. Nomor versi TeX makin dekat ke π pada setiap pembaruan, dan Knuth berkata ia akan menjadi π pada saat ia meninggal, ketika program itu dibekukan. Selama puluhan tahun ia membayar hadiah, dimulai dari 2,56 dolar AS dan berlipat dua setiap tahun sampai 327,68, untuk setiap galat yang ditemukan pada programnya. ## Kesalahan apa yang sering dibuat pemula di LaTeX? **Kesalahan pemula yang paling umum di LaTeX adalah sembilan hal berikut, masing-masing dengan pernyataan yang benar.** | Kesalahan | Yang benar | |---|---| | ❌ Menulis `x^10` untuk sepuluh | Skrip mengambil satu karakter: tulis `x^{10}`, dan `e^{-x}` bukan `e^-x`. | | ❌ Mengetik tanda persen, ampersand, pagar, atau garis bawah dalam teks apa adanya | Mereka khusus: tulis `\%`, `\&`, `\#`, `\_` (dan beri escape pada teks yang datang dari luar). | | ❌ Membiarkan baris kosong di dalam rumus | Baris kosong mengakhiri paragraf dan rumus bersamanya: hapus, atau taruh potongannya dalam `align`. | | ❌ Memakai dua tanda dolar untuk persamaan tampilan | Pakai `\[ ... \]` atau lingkungan `equation`: keduanya mengatur spasi rumus dengan benar. | | ❌ Memakai `\\` atau beberapa baris kosong untuk menambah ruang | Baris kosong membuat paragraf dan LaTeX mengatur spasinya; pakai `\vspace` hanya untuk jarak yang disengaja. | | ❌ Menaruh `\usepackage` setelah `\begin{document}` | Paket dimuat di preamble, sebelum `\begin{document}`. | | ❌ Mengompilasi sekali dan heran pada "??" | Rujukan dan kutipan memerlukan beberapa kali jalan: `pdflatex`, `bibtex`, `pdflatex`, `pdflatex`, atau `latexmk`. | | ❌ Mengetik tanda kutip lurus di sekeliling kata | Buka dengan dua tanda petik balik dan tutup dengan dua apostrof, agar tanda kutip menghadap arah yang benar. | | ❌ Menulis `sin x` atau `lim` sebagai huruf biasa dalam rumus | Pakai `\sin x` dan `\lim`: perintah itu memberi nama tegak dengan spasi yang benar. | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: LaTeX sekilas - **Apa itu:** teks biasa dengan perintah, dikompilasi `pdflatex` menjadi PDF; TeX (Knuth) adalah mesinnya dan LaTeX (Lamport) perintahnya. - **Dokumen:** `\documentclass`, preamble dengan `\usepackage`, dan `\begin{document}` ... `\end{document}`. - **Mode matematika:** `$...$` sebaris, `\[ ... \]` tampilan, `equation` untuk yang bernomor; skrip mengambil satu karakter, jadi pakai kurung kurawal: `x^{10}`. - **Perintah:** `\frac{a}{b}`, `\sqrt[n]{x}`, `\sum_{i=1}^{n}`, `\int_a^b`, `\left( ... \right)`, huruf Yunani menurut nama, `\sin` dan `\lim` untuk fungsi. - **Lingkungan:** `pmatrix`, `cases`, `align`, `itemize`, `tabular`, `figure`: `&` memisahkan sel, `\\` mengakhiri baris. - **Karakter khusus:** `# $ % & _ { } ~ ^ \` harus di-escape; beri escape pada teks yang datang dari luar. - **Pembangunan:** beberapa kali jalan untuk label dan kutipan; `pdflatex`, `bibtex`, `pdflatex`, `pdflatex`, atau `latexmk` dan Overleaf. - **Galat:** baca yang pertama; undefined control sequence, missing $, kurung kurawal tak seimbang; kompilasi sering dan pakai contoh minimal. - **Di tempat lain:** KaTeX dan MathJax di web, `latex()` SymPy, raw string untuk garis miring terbalik. ## Glosarium: istilah penting - **LaTeX**: Sistem perintah di atas TeX untuk menulis dokumen, yang di dalamnya kamu menguraikan struktur dan kompilator menghasilkan tata letaknya. - **TeX**: Mesin penyusunan huruf yang ditulis Donald Knuth, tempat LaTeX dibangun. - **Kompilator**: Program, seperti pdflatex, yang membaca berkas sumber dan menghasilkan PDF. - **Preamble**: Bagian berkas LaTeX sebelum baris begin document, tempat kelas, paket, dan pengaturan diberikan. - **Paket**: Tambahan yang dimuat dengan perintah usepackage yang menyediakan perintah baru atau mengubah cara dokumen dibangun, seperti amsmath. - **Lingkungan**: Blok di antara perintah begin dan perintah end dengan nama yang sama, seperti equation, itemize, atau pmatrix. - **Mode matematika**: Keadaan ketika LaTeX membaca rumus: di antara tanda dolar dalam teks, atau dalam persamaan tampilan. - **BibTeX**: Program yang mengubah berkas bib berisi sumber menjadi daftar pustaka terformat yang dikutip dalam dokumen. - **Karakter escape**: Garis miring terbalik yang mengubah karakter khusus menjadi biasa, seperti pada escape persen, agar ia tercetak apa adanya. ## Pertanyaan yang sering diajukan ### Untuk apa LaTeX dipakai? Ia dipakai untuk menulis dokumen yang banyak matematika atau strukturnya: makalah penelitian, tesis, buku teks, kumpulan soal, dan slide. Ia menyusun rumus dengan baik, menomori bagian dan persamaan secara otomatis, mengelola kutipan, dan menjaga gaya tetap konsisten. ### Apakah LaTeX bahasa pemrograman? LaTeX adalah bahasa markah yang dibangun dari makro, dan mesin TeX di bawahnya mampu melakukan komputasi sungguhan. Dalam praktik kamu menulis dokumen, bukan program, dan kamu dapat mengabaikan sisi pemrogramannya. ### Apa beda TeX dan LaTeX? TeX adalah mesin penyusunan huruf yang ditulis Donald Knuth. LaTeX adalah seperangkat perintah di atasnya, oleh Leslie Lamport, yang memungkinkan kamu menguraikan dokumen menurut strukturnya, dengan bagian, daftar, dan persamaan, bukan tata letaknya. ### Bagaimana menulis pecahan, akar kuadrat, atau jumlah di LaTeX? Pakai frac dengan dua argumen berkurung kurawal untuk pecahan, sqrt dengan satu untuk akar, dan sum dengan garis bawah dan tanda sisipan untuk batasnya, semuanya dalam mode matematika di antara tanda dolar. ### Bagaimana mengompilasi dokumen LaTeX? Simpan sebagai main.tex dan jalankan pdflatex main, atau tekan Compile di Overleaf. Jika dokumen memiliki rujukan atau daftar pustaka, jalankan lagi, dengan bibtex di antaranya untuk kutipan, atau biarkan latexmk mengulang langkahnya. ### Mengapa LaTeX berkata "Undefined control sequence"? LaTeX menemui perintah yang tidak dikenalnya. Entah namanya salah eja, atau paket yang mendefinisikannya belum dimuat di preamble, seperti mathbb tanpa amssymb. Perbaiki galat pertama seperti itu, karena yang lain sering mengikutinya. ### Bagaimana menulis LaTeX di Markdown atau di situs web? Banyak alat Markdown, notebook Jupyter, dan wiki menggambar rumus yang ditulis di antara tanda dolar tunggal atau ganda. Di halamanmu sendiri, sertakan KaTeX atau MathJax, yang membaca kode yang sama dan menggambarnya di peramban. ### Bagaimana LaTeX dibandingkan dengan pengolah kata? Pengolah kata menampilkan halaman saat kamu mengetik; LaTeX membuat kamu menguraikan isi dan menyusun halaman sesudahnya. LaTeX unggul untuk rumus, dokumen panjang, dan rujukan; pengolah kata lebih cepat untuk catatan pendek, visual, dan kolaboratif. --- # Tower of Hanoi Source: https://nunada.my.id/articles/tower-of-hanoi/ Updated: 2026-10-22 ## Quick answer **The Tower of Hanoi asks you to move a stack of $n$ discs of different sizes from one of three pegs to another, one disc at a time, never putting a larger disc on a smaller one; the best solution takes exactly $2^n-1$ moves.** The idea is recursive: move the top $n-1$ discs to the spare peg, move the largest disc, then move the $n-1$ discs back on top, so $T(n)=2T(n-1)+1$. Three discs need $7$ moves; $64$ discs need $18\,446\,744\,073\,709\,551\,615$. ### Key takeaways - The rules: three pegs, $n$ discs of different sizes on the first, move one disc at a time, never a larger disc on a smaller one. The goal is the whole tower on another peg. Every assignment of discs to pegs is a legal position, so there are $3^n$ positions. - Recursive solution: solve $n-1$ discs onto the spare peg, move the largest, solve $n-1$ discs onto the target. The number of moves obeys $T(n)=2T(n-1)+1$, so $T(n)+1=2^n$ and $T(n)=2^n-1$: $7,15,31,63,\ldots$ - $2^n-1$ is the best possible: the largest disc must move at least once, and before that the other $n-1$ discs must all sit on the third peg, and after it they must all be moved again. So $T(n)\ge2T(n-1)+1$. The same argument shows that the shortest solution is unique. - Disc number $k$ (the smallest is $1$) moves $2^{n-k}$ times. Move number $m$ moves disc number $v+1$, where $2^v$ is the largest power of two dividing $m$: $1,2,1,3,1,2,1,4,\ldots$ This gives a solution without recursion: always move the smallest disc one step the same way around, and in between make the only other legal move. - At one move a second, $64$ discs take about $5.85\times10^{11}$ years, $42$ times the age of the universe; at a billion moves a second, about $585$ years. The positions and moves form a graph that is a Sierpiński triangle, and the best solution is one side of it. - With four pegs the Frame–Stewart numbers $1,3,5,9,13,17,25,\ldots$ take over (proved optimal in 2014): $64$ discs need only $18\,433$ moves instead of $2^{64}-1$. The puzzle was published by Édouard Lucas in 1883. ## What is the Tower of Hanoi puzzle? **The Tower of Hanoi is a puzzle with three pegs and a stack of discs of different sizes, and the task is to move the whole stack to another peg following two rules.** At the start the discs sit on the first peg, the largest at the bottom and the smallest on top, like a cone. The rules are 1. move **one disc at a time**, the top disc of a peg; and 2. **never put a larger disc on a smaller one**. The goal is the same tower on a different peg. With $3$ discs it takes $7$ moves. Call the pegs $A$, $B$ and $C$, and the discs $1$ (smallest), $2$ and $3$, moving from $A$ to $C$: | Move | 1 | 2 | 3 | 4 | 5 | 6 | 7 | |---|---|---|---|---|---|---|---| | Disc | 1 | 2 | 1 | 3 | 1 | 2 | 1 | | From → to | A → C | A → B | C → B | A → C | B → A | B → C | A → C | Look at the table: the biggest disc moves once, in the middle, and the smallest disc moves at every other move. Both facts will turn out to be general. **Positions.** Because a peg holds its discs in order of size, a position is completely described by saying which peg each disc is on. Any choice is legal, so with $n$ discs there are exactly $3^n$ positions: $27$ for three discs, $243$ for five. Play it below with three to seven discs. Click a peg (or use the buttons) to take the top disc, then click the peg to put it on. The hint button always makes the best next move from whatever position you are in. ## How does the recursive solution work? **To move $n$ discs from $A$ to $C$, first move the top $n-1$ discs to $B$, then move the largest disc to $C$, then move the $n-1$ discs from $B$ onto $C$.** The largest disc cannot move until everything above it is out of the way, and it can only go to a peg that is empty or holds larger discs, which means a peg with no smaller disc on it. So all the other $n-1$ discs have to be on the third peg at that moment. That is the whole idea, and the two moves of the $n-1$ discs are the same puzzle again, with a smaller tower and with the pegs playing different roles: - move $n-1$ discs from the source to the **spare** peg, using the target as the spare; - move the largest disc from the source to the target; - move $n-1$ discs from the spare peg to the **target**, using the source as the spare. The recursion stops at $0$ discs, where there is nothing to do. For three discs the recipe expands into the seven moves of the table: move $2$ discs $A\to B$ (three moves: $1$ to $C$, $2$ to $B$, $1$ onto $B$), move disc $3$ to $C$, move $2$ discs $B\to C$ (three more). **Counting the moves.** Let $T(n)$ be the number of moves of this solution. The two sub-solutions take $T(n-1)$ each and the largest disc one move, so $$T(0)=0,\qquad T(n)=2\,T(n-1)+1.$$ Add $1$ to both sides: $T(n)+1=2\,(T(n-1)+1)$, so $T(n)+1$ doubles at every step, starting from $T(0)+1=1$. Hence $$T(n)+1=2^n,\qquad T(n)=2^n-1.$$ Check: $T(1)=1$, $T(2)=3$, $T(3)=7$, $T(4)=15$, $T(5)=31$, $T(10)=1023$. Another way to see it: disc number $k$ (the smallest is $1$) moves $2^{n-k}$ times, and $1+2+4+\cdots+2^{n-1}=2^n-1$ is a [geometric series](https://nunada.my.id/articles/geometric-sequences-and-series/#sum-of-a-geometric-series). **What the computer does.** The function calls itself twice, so it makes $2^{n+1}-1$ calls in all, but the depth of the recursion is only $n$: at any time the call stack holds one call for each size from $n$ down to the current one. So a program can solve $25$ discs (33 million moves) without running out of stack, though it will take its time. This is unlike the naive recursion for [Fibonacci numbers](https://nunada.my.id/articles/fibonacci-numbers/#computing), which can be rescued by remembering values: here the answer itself contains $2^n-1$ moves, so no program can be faster than that. ## Why can no solution use fewer moves? **The recursive solution is not just good, it is the best possible: no solution has fewer than $2^n-1$ moves, and no other solution has exactly that many.** The proof uses the largest disc, as the construction did. Let $M(n)$ be the least number of moves of any legal solution with $n$ discs. Look at a solution and at the largest disc. It must move at least once. At the moment of its first move, it goes from the first peg to another peg, and for that to be allowed every other disc must be on the third peg. So before that moment the $n-1$ smaller discs have been moved from the first peg to the third one, which is the same puzzle with $n-1$ discs, and takes at least $M(n-1)$ moves. After the last move of the largest disc it sits on the target peg, and the $n-1$ smaller discs, which are on another peg, still have to be moved onto it: at least $M(n-1)$ moves again. Adding the largest disc's own move, $$M(n)\ge2\,M(n-1)+1,\qquad M(1)=1.$$ So $M(n)\ge2^n-1$, which the recursive solution reaches. **The best solution has exactly $2^n-1$ moves.** **It is unique.** If a solution has exactly $2^n-1$ moves, every inequality above must be an equality: the largest disc moves exactly once (otherwise there would be an extra move), and the moves before and after it are each a shortest solution for $n-1$ discs. By induction on $n$ there is only one such solution: the recursive one. A shortest solution needs no choice at all, which also explains why the hint button in the puzzle never has to pick between two best moves. **From any position.** The same idea solves the puzzle from any position, not only from a full tower. Find the largest disc that is not yet where it should be; move the smaller discs to the third peg, move that disc, and rebuild a perfect tower on top of it. The number of moves is smallest possible, and the largest distance between any two positions of $n$ discs is $2^n-1$, between two of the three "corner" positions with everything on one peg. ## How long would the 64-disc tower take? **Far longer than the universe has existed: at one move a second, $2^{64}-1$ moves take about $5.85\times10^{11}$ years.** In the story Lucas's leaflet told in 1883, and a French science magazine retold in 1884, monks in a temple at Benares are moving $64$ golden discs between three diamond needles, one move at a time, and when they finish the world will end. The number of moves is $$2^{64}-1=18\,446\,744\,073\,709\,551\,615.$$ At one move a second that is $585$ billion years, about $42$ times the age of the universe ($13.8$ billion years). The doubling is what hurts: every extra disc doubles the time. At one move a second $10$ discs take $17$ minutes, $20$ discs $12$ days, $30$ discs $34$ years and $40$ discs $34\,800$ years. Even a computer that makes a billion moves a second would need $585$ years for $64$ discs. This is the standard picture of **exponential growth** (see [Big-O notation](https://nunada.my.id/articles/big-o-notation/#recurrences) for the growth classes): adding one disc multiplies the work by $2$, whereas for a polynomial cost like $n^2$ it would add a little. It is also why the legend is only a legend. Move the slider below to see the time for any number of discs, and how often each disc moves. ## How is the Tower of Hanoi connected to binary numbers? **The disc that moves at move number $m$ is read off the binary form of $m$: it is the position of the lowest $1$ bit.** Number the moves $1,2,3,\ldots,2^n-1$ and the discs $1$ (smallest) to $n$. Then move $m$ moves disc $v+1$, where $2^v$ is the largest power of two that divides $m$ (the number of zeros at the right end of $m$ in binary). The sequence of discs is the ruler sequence $$1,2,1,3,1,2,1,4,1,2,1,3,1,2,1,5,\ldots$$ Odd moves ($m$ ends in $1$) move disc $1$; moves $2,6,10,\ldots$ move disc $2$; move $8$ moves disc $4$; move $2^{n-1}$ moves the largest disc $n$, once, in the middle. The count of moves of each disc, $2^{n-k}$ for disc $k$, is the count of numbers up to $2^n-1$ with exactly $k-1$ trailing zeros. **A solution without recursion.** Because of that, the solution can be run as a loop: 1. On odd moves, move the smallest disc one peg onward, always in the same direction around the three pegs: $A\to C\to B\to A\to\cdots$ if $n$ is odd, $A\to B\to C\to A\to\cdots$ if $n$ is even. 2. On even moves, make the only legal move that does not involve the smallest disc. This makes exactly the same moves as the recursion. It also lets a program write down the move number $m$ of a $64$-disc tower in a few steps, without making the $m-1$ moves before it. **The position after $m$ moves.** The recursion can be unrolled once per disc, from the largest down. If $m$ is below $2^{n-1}$ the largest disc has not moved yet, and the smaller discs are on their way to the spare peg; otherwise it is on the target, $2^{n-1}$ is taken off $m$, and the smaller discs are on their way to the target from the spare peg. The result gives the peg of each of the $n$ discs after any number of moves in $n$ steps, as the widget below does for up to $64$ discs. **Gray code.** Write each $m$ as its reflected binary Gray code $m\oplus\lfloor m/2\rfloor$ (the exclusive or of $m$ with itself shifted right). Consecutive Gray codes differ in exactly one bit, and the bit that changes at move $m$ is bit number $v$, the same ruler sequence. So bit $k$ of the Gray code of $m$ is $1$ when disc $k+1$ has moved an odd number of times so far. Frank Gray used the same code in a patent for telegraph signals (filed in 1947); Gray codes are used for position sensors, where only one bit may change at a time. Type any move number below, or step through the moves. ## What does the graph of all positions look like? **Draw every position as a dot and join two dots by a line when one move turns one position into the other, and you get a Sierpiński triangle.** For one disc the graph is a triangle: the disc can be on $A$, $B$ or $C$, and it can move between any two pegs. For $n$ discs, split the positions by the peg of the largest disc: three groups, each a copy of the graph for $n-1$ discs (with the large disc fixed, the smaller ones move as before). The three copies are joined by only three lines, one for each move of the largest disc, which can happen only when all smaller discs are on the third peg. Repeating this gives the triangle of triangles of triangles. The graph has these properties, which the widget lets you check by eye: - **$3^n$ points**, all the positions; - **$\frac{3^{n+1}-3}{2}$ lines**, since every position allows three moves except the three corner positions, where all discs are on one peg and only the top disc can move, to either of two pegs: $39$ lines for $3$ discs; - **three corners**: all discs on $A$, on $B$ or on $C$; - **the best solution is a path along one side** of the big triangle, from the top corner to the bottom right one, with $2^n-1$ steps, and it is the only shortest path between those corners: the number of moves cannot be shortened because there is nothing shorter to take; - the **distance** between two positions is the length of a shortest path, and the largest distance in the graph is $2^n-1$. This explains the self-similarity of the recursion. It also links the puzzle to the Sierpiński triangle and to Pascal's triangle taken mod $2$, as the same pattern in different disguises. Choose the number of discs below and click any dot to see the position and its distance from a finished tower on each peg. ## What if there are four or more pegs? **With a fourth peg the puzzle becomes much easier, and the best number of moves is given by a recurrence of Frame and Stewart that was proved optimal for four pegs only in 2014.** The idea: move the top $k$ discs to a spare peg using all four pegs, then move the remaining $n-k$ discs to the target using only three pegs (one is occupied by the $k$ small discs), then move the $k$ discs onto the target, using all four pegs again. If $F(n,p)$ is the number of moves with $p$ pegs, $$F(n,3)=2^n-1,\qquad F(n,p)=\min_{1\le k { if (n === 0) return moves hanoi(n - 1, from, via, to, moves) moves.push([n, from, to]) hanoi(n - 1, via, to, from, moves) return moves } hanoi(3).map(([d, a, b]) => d + ':' + a + b).join(' ') // '1:AC 2:AB 1:CB 3:AC 1:BA 2:BC 1:AC' hanoi(10).length // 1023 // the disc of move m is the position of the lowest set bit: m & -m keeps only that bit const disc = (m) => Math.log2(m & -m) + 1 Array.from({ length: 15 }, (_, i) => disc(i + 1)) // [1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1] 2n ** 64n - 1n // 18446744073709551615n: BigInt, since a double would round it Number(2n ** 64n - 1n) / 1e9 / (365.25 * 24 * 3600) // 584.54...: years at a billion moves a second // the stack only holds n calls at a time, although 2^n - 1 moves are made let count = 0 const go = (n) => { if (n === 0) return; go(n - 1); count++; go(n - 1) } go(20) count // 1048575 ``` ```cpp #include #include using namespace std; int moves = 0; int show = 1; void hanoi(int n, char from, char to, char via) { if (n == 0) return; hanoi(n - 1, from, via, to); moves++; if (show) printf("disc %d: %c -> %c\n", n, from, to); hanoi(n - 1, via, to, from); } int main() { hanoi(3, 'A', 'C', 'B'); show = 0; moves = 0; hanoi(12, 'A', 'C', 'B'); printf("%d\n", moves); // 2^12 - 1 for (int m = 1; m <= 15; m++) { // the disc of move m: trailing zeros of m, plus one int d = 1, x = m; while (x % 2 == 0) { x = x / 2; d++; } printf("%d%c", d, m == 15 ? '\n' : ','); } return 0; } /* output: disc 1: A -> C disc 2: A -> B disc 1: C -> B disc 3: A -> C disc 1: B -> A disc 2: B -> C disc 1: A -> C 4095 1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 */ ``` ## Where does the Tower of Hanoi come from? **The Tower of Hanoi is a French invention of 1883, wrapped in a legend that is itself part of the invention.** - **1883.** The mathematician Édouard Lucas put the puzzle on sale as La Tour d'Hanoï, véritable casse-tête annamite ("the Tower of Hanoi, a true Vietnamese brain-teaser"), with eight discs, under the invented name N. Claus (de Siam), mandarin of the Li-Sou-Stian college. The names are anagrams: N. Claus de Siam is Lucas d'Amiens (he came from Amiens) and Li-Sou-Stian is Saint-Louis, the school where he taught. The leaflet carried the legend of the temple in Benares and the end of the world. - **1884.** Henri de Parville retold the story in the magazine La Nature and helped it spread; W. W. Rouse Ball's Mathematical Recreations and Essays carried it into English. - **1907.** Henry Dudeney published a four-peg version, "Reve's puzzle", in The Canterbury Puzzles. - **1939–1941.** A problem in the American Mathematical Monthly about four pegs led J. S. Frame and B. M. Stewart to the recurrence that bears their names. - **1950s.** The Gray code of Frank Gray (patented in 1953) turned out to describe the sequence of discs. - **1970s.** Psychologists, among them Herbert Simon, used the puzzle to study how people plan and solve problems; versions of it are used in tests of planning ability. - **1989–1990s.** Andreas Hinz and others studied the graph of positions and its relation to the Sierpiński triangle, and the average distance between positions. - **2014.** Thierry Bousch proved that the Frame–Stewart numbers are optimal for four pegs. ## What mistakes do people make with the Tower of Hanoi? **The most common mistakes with the Tower of Hanoi are the nine below, each with the correct statement.** | Mistake | Correct | |---|---| | ❌ The least number of moves for $n$ discs is about $n^2$ or $2n$ | It is $2^n-1$: $7$ for three discs, $1023$ for ten, and every extra disc doubles it. | | ❌ Start by moving the largest disc | It cannot move until the $n-1$ smaller discs are all on the third peg: solve those first. | | ❌ A larger disc may rest on a smaller one if it is only for a moment | Never: the rule holds at every moment, so the largest disc needs a peg with no smaller disc. | | ❌ The recursion needs a stack of $2^n$ calls | It makes $2^{n+1}-1$ calls but is never more than $n$ deep. | | ❌ The 64-disc tower will be finished soon | At one move a second it takes $585$ billion years, $42$ times the age of the universe. | | ❌ There are many shortest solutions | With three pegs exactly one: every inequality in the proof must be an equality. | | ❌ Every position is $2^n-1$ moves from the goal | The distance depends on the position: after $m$ moves of the best solution, only $2^n-1-m$ remain, and the largest disc not yet in place decides the rest. | | ❌ A fourth peg saves only a little | Ten discs take $49$ moves instead of $1023$, and $64$ discs take $18\,433$ moves instead of $2^{64}-1$. | | ❌ In the loop version the smallest disc changes direction | It always steps the same way around the pegs, towards the target first if $n$ is odd and towards the spare if $n$ is even. | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: the Tower of Hanoi at a glance - **Rules:** three pegs, one disc at a time, never a larger disc on a smaller one; $3^n$ positions. - **Recursion:** solve $n-1$ onto the spare peg, move the largest, solve $n-1$ onto it; $T(n)=2T(n-1)+1$, so $T(n)=2^n-1$. - **Optimal and unique:** the largest disc must move, with all others on the third peg before and the same work again after: $M(n)\ge2M(n-1)+1$. - **Time:** $64$ discs, $2^{64}-1$ moves, $585$ billion years at one move a second; the recursion is $n$ deep. - **Binary:** move $m$ moves disc $v+1$ for the lowest set bit $2^v$ of $m$; disc $k$ moves $2^{n-k}$ times; the loop version moves the smallest disc the same way around every other move; Gray code. - **Graph:** the $3^n$ positions form a Sierpiński triangle, and the best solution is one side of it. - **More pegs:** Frame–Stewart $F(n,p)=\min(2F(k,p)+F(n-k,p-1))$, optimal for $p=4$ (2014): $64$ discs in $18\,433$ moves. - **History:** Lucas 1883, Dudeney 1907, Frame and Stewart 1941, Bousch 2014. ## Glossary: key terms - **Tower of Hanoi**: A puzzle of moving a stack of discs between three pegs, one disc at a time, never putting a larger disc on a smaller one. - **Recursion**: A method of solving a problem by solving smaller copies of the same problem and combining the results. - **Recurrence relation of moves**: The equation T(n) = 2T(n−1) + 1 for the number of moves of the best solution with n discs. - **Exponential growth**: Growth in which each extra unit of input multiplies the cost by a constant, as each extra disc doubles the number of moves. - **Ruler sequence**: The sequence 1, 2, 1, 3, 1, 2, 1, 4, … in which the term at position m is one plus the number of trailing zeros of m in binary. - **Gray code**: A binary numbering in which consecutive numbers differ in exactly one bit. - **Sierpiński triangle**: A fractal made of three half-size copies of itself placed at the corners of a triangle; the graph of positions of the Tower of Hanoi has this shape. - **Frame–Stewart numbers**: The number of moves of the best known solutions of the Tower of Hanoi with four or more pegs, found by splitting the tower at the best place. ## Frequently asked questions ### What is the minimum number of moves in the Tower of Hanoi? With three pegs and n discs the minimum is two to the power n minus one. Three discs take 7 moves, four take 15 and ten take 1023, and no solution can do better because the largest disc forces the work to repeat. ### How do you solve the Tower of Hanoi step by step? Move the top n minus 1 discs to the spare peg, move the largest disc to the target, then move the n minus 1 discs from the spare peg onto the target. Each of the two big moves is the same puzzle with fewer discs. ### Is there an iterative solution to the Tower of Hanoi? Yes. On odd moves shift the smallest disc one peg in a fixed direction around the pegs, and on even moves make the only legal move that does not involve the smallest disc. It makes exactly the same moves as the recursion. ### Is the shortest Tower of Hanoi solution unique? With three pegs, yes. A solution with exactly two to the n minus one moves must move the largest disc once, and the moves before and after it must each be a shortest solution for one disc fewer, so induction leaves only one. ### How long would it take to solve the 64-disc Tower of Hanoi? It needs 18,446,744,073,709,551,615 moves. At one move a second that is about 585 billion years, roughly 42 times the age of the universe, and even a billion moves a second would still take about 585 years. ### How are the Tower of Hanoi and Gray code related? The disc moved at move m is given by the lowest set bit of m, the ruler sequence, and the same sequence tells which bit changes between consecutive Gray codes. So bit k of the Gray code of m shows whether disc k plus one has moved an odd number of times. ### What is the Frame–Stewart conjecture? It says the fewest moves with four or more pegs come from moving the top k discs to a spare peg, the rest with one fewer peg, then the k discs again, with the best k. It is proved for four pegs, and open for more. ### Why is recursion a natural way to solve the Tower of Hanoi? Because moving n discs contains two smaller copies of the same task, moving n minus 1 discs, with only the roles of the pegs changed. The recursion is never deeper than n, even though it makes about two to the n calls. --- # Menara Hanoi Source: https://nunada.my.id/artikel/menara-hanoi/ Updated: 2026-10-22 ## Jawaban singkat **Menara Hanoi meminta kamu memindahkan tumpukan $n$ cakram berukuran berbeda dari satu di antara tiga tiang ke tiang lain, satu cakram sekali waktu, tanpa pernah menaruh cakram yang lebih besar di atas yang lebih kecil; solusi terbaiknya memerlukan tepat $2^n-1$ langkah.** Gagasannya rekursif: pindahkan $n-1$ cakram teratas ke tiang cadangan, pindahkan cakram terbesar, lalu pindahkan $n-1$ cakram itu kembali ke atasnya, sehingga $T(n)=2T(n-1)+1$. Tiga cakram memerlukan $7$ langkah; $64$ cakram memerlukan $18\,446\,744\,073\,709\,551\,615$. ### Poin penting - Aturannya: tiga tiang, $n$ cakram berukuran berbeda di tiang pertama, pindahkan satu cakram sekali waktu, tidak pernah cakram besar di atas yang kecil. Tujuannya seluruh menara di tiang lain. Setiap penugasan cakram ke tiang adalah posisi yang sah, sehingga ada $3^n$ posisi. - Solusi rekursif: selesaikan $n-1$ cakram ke tiang cadangan, pindahkan yang terbesar, selesaikan $n-1$ cakram ke tiang tujuan. Banyaknya langkah memenuhi $T(n)=2T(n-1)+1$, sehingga $T(n)+1=2^n$ dan $T(n)=2^n-1$: $7,15,31,63,\ldots$ - $2^n-1$ adalah yang terbaik: cakram terbesar harus bergerak sedikitnya sekali, dan sebelumnya $n-1$ cakram lain harus semuanya berada di tiang ketiga, dan sesudahnya semuanya harus dipindahkan lagi. Jadi $T(n)\ge2T(n-1)+1$. Argumen yang sama menunjukkan solusi terpendeknya tunggal. - Cakram nomor $k$ (yang terkecil $1$) bergerak $2^{n-k}$ kali. Langkah nomor $m$ memindahkan cakram nomor $v+1$, dengan $2^v$ pangkat dua terbesar yang membagi $m$: $1,2,1,3,1,2,1,4,\ldots$ Ini memberi solusi tanpa rekursi: selalu pindahkan cakram terkecil satu langkah searah, dan di antaranya lakukan satu-satunya langkah sah yang lain. - Pada satu langkah per detik, $64$ cakram memerlukan sekitar $5{,}85\times10^{11}$ tahun, $42$ kali usia alam semesta; pada semiliar langkah per detik, sekitar $585$ tahun. Posisi dan langkah membentuk graf yang merupakan segitiga Sierpiński, dan solusi terbaik adalah satu sisinya. - Dengan empat tiang bilangan Frame–Stewart $1,3,5,9,13,17,25,\ldots$ berlaku (terbukti optimal pada 2014): $64$ cakram hanya memerlukan $18\,433$ langkah, bukan $2^{64}-1$. Teka-teki ini diterbitkan oleh Édouard Lucas pada 1883. ## Apa itu teka-teki Menara Hanoi? **Menara Hanoi adalah teka-teki dengan tiga tiang dan tumpukan cakram berukuran berbeda, dan tugasnya memindahkan seluruh tumpukan ke tiang lain dengan mengikuti dua aturan.** Pada awalnya cakram berada di tiang pertama, yang terbesar di dasar dan yang terkecil di atas, seperti kerucut. Aturannya 1. pindahkan **satu cakram sekali waktu**, cakram teratas sebuah tiang; dan 2. **jangan pernah menaruh cakram yang lebih besar di atas yang lebih kecil**. Tujuannya menara yang sama di tiang yang berbeda. Dengan $3$ cakram diperlukan $7$ langkah. Sebut tiangnya $A$, $B$, dan $C$, dan cakramnya $1$ (terkecil), $2$, dan $3$, memindahkan dari $A$ ke $C$: | Langkah | 1 | 2 | 3 | 4 | 5 | 6 | 7 | |---|---|---|---|---|---|---|---| | Cakram | 1 | 2 | 1 | 3 | 1 | 2 | 1 | | Dari → ke | A → C | A → B | C → B | A → C | B → A | B → C | A → C | Lihat tabelnya: cakram terbesar bergerak sekali, di tengah, dan cakram terkecil bergerak setiap dua langkah. Kedua fakta itu ternyata berlaku umum. **Posisi.** Karena sebuah tiang memegang cakramnya terurut menurut ukuran, sebuah posisi sepenuhnya dijelaskan dengan menyebut tiang tempat setiap cakram berada. Pilihan apa pun sah, sehingga dengan $n$ cakram ada tepat $3^n$ posisi: $27$ untuk tiga cakram, $243$ untuk lima. Mainkan di bawah dengan tiga sampai tujuh cakram. Klik sebuah tiang (atau pakai tombolnya) untuk mengambil cakram teratas, lalu klik tiang tempat menaruhnya. Tombol petunjuk selalu melakukan langkah terbaik berikutnya dari posisi mana pun yang sedang kamu tempati. ## Bagaimana solusi rekursif bekerja? **Untuk memindahkan $n$ cakram dari $A$ ke $C$, pindahkan dulu $n-1$ cakram teratas ke $B$, lalu pindahkan cakram terbesar ke $C$, lalu pindahkan $n-1$ cakram itu dari $B$ ke atas $C$.** Cakram terbesar tidak dapat bergerak sebelum semua yang di atasnya menyingkir, dan ia hanya dapat pergi ke tiang yang kosong atau berisi cakram yang lebih besar, yaitu tiang yang tidak memiliki cakram lebih kecil. Jadi semua $n-1$ cakram lain harus berada di tiang ketiga pada saat itu. Itulah seluruh gagasannya, dan dua kali pemindahan $n-1$ cakram adalah teka-teki yang sama lagi, dengan menara yang lebih kecil dan dengan tiang yang berperan berbeda: - pindahkan $n-1$ cakram dari asal ke tiang **cadangan**, memakai tujuan sebagai cadangan; - pindahkan cakram terbesar dari asal ke tujuan; - pindahkan $n-1$ cakram dari tiang cadangan ke **tujuan**, memakai asal sebagai cadangan. Rekursi berhenti pada $0$ cakram, yang tidak ada yang dikerjakan. Untuk tiga cakram resep itu terurai menjadi tujuh langkah pada tabel: pindahkan $2$ cakram $A\to B$ (tiga langkah: $1$ ke $C$, $2$ ke $B$, $1$ ke atas $B$), pindahkan cakram $3$ ke $C$, pindahkan $2$ cakram $B\to C$ (tiga lagi). **Menghitung langkahnya.** Misalkan $T(n)$ banyaknya langkah solusi ini. Kedua sub-solusi masing-masing $T(n-1)$ dan cakram terbesar satu langkah, sehingga $$T(0)=0,\qquad T(n)=2\,T(n-1)+1.$$ Tambahkan $1$ ke kedua ruas: $T(n)+1=2\,(T(n-1)+1)$, sehingga $T(n)+1$ berlipat dua pada setiap langkah, dimulai dari $T(0)+1=1$. Jadi $$T(n)+1=2^n,\qquad T(n)=2^n-1.$$ Periksa: $T(1)=1$, $T(2)=3$, $T(3)=7$, $T(4)=15$, $T(5)=31$, $T(10)=1023$. Cara lain melihatnya: cakram nomor $k$ (yang terkecil $1$) bergerak $2^{n-k}$ kali, dan $1+2+4+\cdots+2^{n-1}=2^n-1$ adalah [deret geometri](https://nunada.my.id/artikel/barisan-dan-deret-geometri/#sum-of-a-geometric-series). **Apa yang dilakukan komputer.** Fungsi itu memanggil dirinya dua kali, sehingga ia membuat $2^{n+1}-1$ panggilan seluruhnya, tetapi kedalaman rekursinya hanya $n$: pada setiap saat tumpukan panggilan memuat satu panggilan untuk setiap ukuran dari $n$ turun ke yang sekarang. Jadi program dapat menyelesaikan $25$ cakram (33 juta langkah) tanpa kehabisan tumpukan, walau akan memakan waktu. Ini berbeda dari rekursi naif untuk [bilangan Fibonacci](https://nunada.my.id/artikel/bilangan-fibonacci/#computing), yang dapat diselamatkan dengan mengingat nilai: di sini jawabannya sendiri memuat $2^n-1$ langkah, sehingga tidak ada program yang bisa lebih cepat daripada itu. ## Mengapa tidak ada solusi yang memakai langkah lebih sedikit? **Solusi rekursif bukan sekadar baik, ia yang terbaik: tidak ada solusi yang memiliki kurang dari $2^n-1$ langkah, dan tidak ada solusi lain yang memiliki tepat sebanyak itu.** Buktinya memakai cakram terbesar, seperti pada konstruksinya. Misalkan $M(n)$ banyaknya langkah paling sedikit dari solusi sah mana pun dengan $n$ cakram. Lihat sebuah solusi dan cakram terbesarnya. Ia harus bergerak sedikitnya sekali. Pada saat gerakan pertamanya, ia pergi dari tiang pertama ke tiang lain, dan agar itu diizinkan setiap cakram lain harus berada di tiang ketiga. Jadi sebelum saat itu $n-1$ cakram yang lebih kecil sudah dipindahkan dari tiang pertama ke tiang ketiga, yaitu teka-teki yang sama dengan $n-1$ cakram, dan memerlukan sedikitnya $M(n-1)$ langkah. Setelah gerakan terakhir cakram terbesar ia berada di tiang tujuan, dan $n-1$ cakram yang lebih kecil, yang berada di tiang lain, masih harus dipindahkan ke atasnya: sedikitnya $M(n-1)$ langkah lagi. Ditambah gerakan cakram terbesar itu sendiri, $$M(n)\ge2\,M(n-1)+1,\qquad M(1)=1.$$ Jadi $M(n)\ge2^n-1$, yang dicapai oleh solusi rekursif. **Solusi terbaik memiliki tepat $2^n-1$ langkah.** **Ia tunggal.** Jika sebuah solusi memiliki tepat $2^n-1$ langkah, setiap ketaksamaan di atas harus berupa kesamaan: cakram terbesar bergerak tepat sekali (jika tidak akan ada langkah ekstra), dan langkah sebelum dan sesudahnya masing-masing adalah solusi terpendek untuk $n-1$ cakram. Dengan induksi pada $n$ hanya ada satu solusi seperti itu: yang rekursif. Solusi terpendek sama sekali tidak memerlukan pilihan, yang juga menjelaskan mengapa tombol petunjuk pada teka-teki tidak pernah harus memilih di antara dua langkah terbaik. **Dari posisi mana pun.** Gagasan yang sama menyelesaikan teka-teki dari posisi mana pun, bukan hanya dari menara penuh. Cari cakram terbesar yang belum berada di tempat seharusnya; pindahkan cakram yang lebih kecil ke tiang ketiga, pindahkan cakram itu, dan bangun menara sempurna di atasnya. Banyaknya langkah sesedikit mungkin, dan jarak terbesar antara dua posisi $n$ cakram adalah $2^n-1$, di antara dua dari tiga posisi "sudut" dengan semuanya di satu tiang. ## Berapa lama menara 64 cakram? **Jauh lebih lama daripada keberadaan alam semesta: pada satu langkah per detik, $2^{64}-1$ langkah memerlukan sekitar $5{,}85\times10^{11}$ tahun.** Dalam cerita yang dituturkan selebaran Lucas pada 1883, dan diceritakan ulang majalah sains Prancis pada 1884, para biksu di sebuah kuil di Benares memindahkan $64$ cakram emas di antara tiga jarum berlian, satu langkah sekali waktu, dan ketika mereka selesai dunia akan berakhir. Banyaknya langkah adalah $$2^{64}-1=18\,446\,744\,073\,709\,551\,615.$$ Pada satu langkah per detik itu $585$ miliar tahun, sekitar $42$ kali usia alam semesta ($13{,}8$ miliar tahun). Penggandaannya yang menyakitkan: setiap cakram tambahan melipatduakan waktunya. Pada satu langkah per detik $10$ cakram memerlukan $17$ menit, $20$ cakram $12$ hari, $30$ cakram $34$ tahun, dan $40$ cakram $34\,800$ tahun. Bahkan komputer yang membuat semiliar langkah per detik memerlukan $585$ tahun untuk $64$ cakram. Ini gambaran baku **pertumbuhan eksponensial** (lihat [notasi Big-O](https://nunada.my.id/artikel/notasi-big-o/#recurrences) untuk kelas pertumbuhan): menambah satu cakram mengalikan kerja dengan $2$, sedangkan untuk biaya polinomial seperti $n^2$ ia hanya menambah sedikit. Itu juga sebabnya legenda hanyalah legenda. Geser penggeser di bawah untuk melihat waktu untuk sembarang banyak cakram, dan seberapa sering tiap cakram bergerak. ## Bagaimana Menara Hanoi berhubungan dengan bilangan biner? **Cakram yang bergerak pada langkah nomor $m$ dibaca dari bentuk biner $m$: ia adalah posisi bit $1$ terendah.** Beri nomor langkah $1,2,3,\ldots,2^n-1$ dan cakram $1$ (terkecil) sampai $n$. Maka langkah $m$ memindahkan cakram $v+1$, dengan $2^v$ pangkat dua terbesar yang membagi $m$ (banyaknya nol di ujung kanan $m$ dalam biner). Barisan cakramnya adalah barisan penggaris $$1,2,1,3,1,2,1,4,1,2,1,3,1,2,1,5,\ldots$$ Langkah ganjil ($m$ berakhir $1$) memindahkan cakram $1$; langkah $2,6,10,\ldots$ memindahkan cakram $2$; langkah $8$ memindahkan cakram $4$; langkah $2^{n-1}$ memindahkan cakram terbesar $n$, sekali, di tengah. Banyaknya langkah tiap cakram, $2^{n-k}$ untuk cakram $k$, adalah banyaknya bilangan sampai $2^n-1$ yang memiliki tepat $k-1$ nol di ujung. **Solusi tanpa rekursi.** Karena itu, solusinya dapat dijalankan sebagai perulangan: 1. Pada langkah ganjil, pindahkan cakram terkecil satu tiang ke depan, selalu dengan arah yang sama mengelilingi tiga tiang: $A\to C\to B\to A\to\cdots$ jika $n$ ganjil, $A\to B\to C\to A\to\cdots$ jika $n$ genap. 2. Pada langkah genap, lakukan satu-satunya langkah sah yang tidak melibatkan cakram terkecil. Ini membuat langkah yang persis sama dengan rekursi. Ia juga memungkinkan program menuliskan langkah nomor $m$ menara $64$ cakram dalam beberapa langkah, tanpa membuat $m-1$ langkah sebelumnya. **Posisi setelah $m$ langkah.** Rekursi dapat diurai sekali per cakram, dari yang terbesar ke bawah. Jika $m$ di bawah $2^{n-1}$ cakram terbesar belum bergerak, dan cakram yang lebih kecil sedang menuju tiang cadangan; jika tidak ia berada di tujuan, $2^{n-1}$ dikurangkan dari $m$, dan cakram yang lebih kecil sedang menuju tujuan dari tiang cadangan. Hasilnya memberi tiang setiap dari $n$ cakram setelah sembarang banyak langkah dalam $n$ langkah, seperti yang dilakukan widget di bawah untuk sampai $64$ cakram. **Kode Gray.** Tulis setiap $m$ sebagai kode Gray biner berpantulnya $m\oplus\lfloor m/2\rfloor$ (xor $m$ dengan dirinya yang digeser ke kanan). Kode Gray berurutan berbeda tepat satu bit, dan bit yang berubah pada langkah $m$ adalah bit nomor $v$, barisan penggaris yang sama. Jadi bit $k$ kode Gray $m$ bernilai $1$ bila cakram $k+1$ sudah bergerak sebanyak ganjil kali sejauh ini. Frank Gray memakai kode yang sama dalam paten untuk sinyal telegraf (diajukan 1947); kode Gray dipakai pada sensor posisi, yang hanya boleh berubah satu bit sekali waktu. Ketik nomor langkah mana pun di bawah, atau telusuri langkah-langkahnya. ## Seperti apa graf semua posisi? **Gambar setiap posisi sebagai titik dan hubungkan dua titik dengan garis bila satu langkah mengubah satu posisi menjadi yang lain, dan kamu mendapatkan segitiga Sierpiński.** Untuk satu cakram grafnya segitiga: cakram dapat berada di $A$, $B$, atau $C$, dan dapat berpindah di antara dua tiang mana pun. Untuk $n$ cakram, bagi posisi menurut tiang cakram terbesar: tiga kelompok, masing-masing salinan graf untuk $n-1$ cakram (dengan cakram besar tetap, yang lebih kecil bergerak seperti sebelumnya). Ketiga salinan dihubungkan hanya oleh tiga garis, satu untuk setiap gerakan cakram terbesar, yang hanya dapat terjadi bila semua cakram yang lebih kecil berada di tiang ketiga. Mengulang ini memberi segitiga dari segitiga dari segitiga. Graf itu memiliki sifat-sifat ini, yang dapat kamu periksa dengan mata lewat widget: - **$3^n$ titik**, semua posisi; - **$\frac{3^{n+1}-3}{2}$ garis**, karena setiap posisi mengizinkan tiga langkah kecuali tiga posisi sudut, yang semua cakramnya di satu tiang dan hanya cakram teratas yang dapat bergerak, ke salah satu dari dua tiang: $39$ garis untuk $3$ cakram; - **tiga sudut**: semua cakram di $A$, di $B$, atau di $C$; - **solusi terbaik adalah jalur di sepanjang satu sisi** segitiga besar, dari sudut atas ke sudut kanan bawah, dengan $2^n-1$ langkah, dan ia satu-satunya jalur terpendek di antara kedua sudut itu: banyaknya langkah tidak dapat dipersingkat karena tidak ada yang lebih pendek untuk diambil; - **jarak** antara dua posisi adalah panjang jalur terpendek, dan jarak terbesar dalam graf adalah $2^n-1$. Ini menjelaskan keserupaan-diri rekursi. Ia juga menghubungkan teka-teki ini dengan segitiga Sierpiński dan segitiga Pascal mod $2$, sebagai pola yang sama dalam samaran berbeda. Pilih banyak cakram di bawah dan klik titik mana pun untuk melihat posisinya dan jaraknya dari menara selesai di setiap tiang. ## Bagaimana jika ada empat tiang atau lebih? **Dengan tiang keempat teka-teki menjadi jauh lebih mudah, dan banyaknya langkah terbaik diberikan oleh rekurensi Frame dan Stewart yang baru terbukti optimal untuk empat tiang pada 2014.** Gagasannya: pindahkan $k$ cakram teratas ke tiang cadangan dengan memakai keempat tiang, lalu pindahkan $n-k$ cakram sisanya ke tujuan hanya dengan tiga tiang (satu ditempati $k$ cakram kecil), lalu pindahkan $k$ cakram itu ke tujuan, memakai keempat tiang lagi. Jika $F(n,p)$ adalah banyaknya langkah dengan $p$ tiang, $$F(n,3)=2^n-1,\qquad F(n,p)=\min_{1\le k { if (n === 0) return moves hanoi(n - 1, from, via, to, moves) moves.push([n, from, to]) hanoi(n - 1, via, to, from, moves) return moves } hanoi(3).map(([d, a, b]) => d + ':' + a + b).join(' ') // '1:AC 2:AB 1:CB 3:AC 1:BA 2:BC 1:AC' hanoi(10).length // 1023 // the disc of move m is the position of the lowest set bit: m & -m keeps only that bit const disc = (m) => Math.log2(m & -m) + 1 Array.from({ length: 15 }, (_, i) => disc(i + 1)) // [1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1] 2n ** 64n - 1n // 18446744073709551615n: BigInt, since a double would round it Number(2n ** 64n - 1n) / 1e9 / (365.25 * 24 * 3600) // 584.54...: years at a billion moves a second // the stack only holds n calls at a time, although 2^n - 1 moves are made let count = 0 const go = (n) => { if (n === 0) return; go(n - 1); count++; go(n - 1) } go(20) count // 1048575 ``` ```cpp #include #include using namespace std; int moves = 0; int show = 1; void hanoi(int n, char from, char to, char via) { if (n == 0) return; hanoi(n - 1, from, via, to); moves++; if (show) printf("disc %d: %c -> %c\n", n, from, to); hanoi(n - 1, via, to, from); } int main() { hanoi(3, 'A', 'C', 'B'); show = 0; moves = 0; hanoi(12, 'A', 'C', 'B'); printf("%d\n", moves); // 2^12 - 1 for (int m = 1; m <= 15; m++) { // the disc of move m: trailing zeros of m, plus one int d = 1, x = m; while (x % 2 == 0) { x = x / 2; d++; } printf("%d%c", d, m == 15 ? '\n' : ','); } return 0; } /* output: disc 1: A -> C disc 2: A -> B disc 1: C -> B disc 3: A -> C disc 1: B -> A disc 2: B -> C disc 1: A -> C 4095 1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 */ ``` ## Dari mana Menara Hanoi berasal? **Menara Hanoi adalah penemuan Prancis tahun 1883, terbungkus legenda yang merupakan bagian dari penemuan itu sendiri.** - **1883.** Matematikawan Édouard Lucas menjual teka-teki ini sebagai La Tour d'Hanoï, véritable casse-tête annamite ("Menara Hanoi, teka-teki Vietnam sejati"), dengan delapan cakram, dengan nama rekaan N. Claus (de Siam), mandarin dari perguruan Li-Sou-Stian. Nama-nama itu anagram: N. Claus de Siam adalah Lucas d'Amiens (ia berasal dari Amiens) dan Li-Sou-Stian adalah Saint-Louis, sekolah tempatnya mengajar. Selebarannya memuat legenda kuil di Benares dan akhir dunia. - **1884.** Henri de Parville menceritakan ulang kisah itu di majalah La Nature dan membantu penyebarannya; Mathematical Recreations and Essays karya W. W. Rouse Ball membawanya ke dalam bahasa Inggris. - **1907.** Henry Dudeney menerbitkan versi empat tiang, "Reve's puzzle", dalam The Canterbury Puzzles. - **1939–1941.** Sebuah soal dalam American Mathematical Monthly tentang empat tiang membawa J. S. Frame dan B. M. Stewart pada rekurensi yang memakai nama mereka. - **1950-an.** Kode Gray Frank Gray (dipatenkan 1953) ternyata menjelaskan barisan cakramnya. - **1970-an.** Psikolog, di antaranya Herbert Simon, memakai teka-teki ini untuk mempelajari bagaimana orang merencanakan dan memecahkan masalah; versinya dipakai dalam tes kemampuan merencanakan. - **1989–1990-an.** Andreas Hinz dan lainnya mempelajari graf posisi dan hubungannya dengan segitiga Sierpiński, dan jarak rata-rata antarposisi. - **2014.** Thierry Bousch membuktikan bahwa bilangan Frame–Stewart optimal untuk empat tiang. ## Kesalahan apa yang sering terjadi pada Menara Hanoi? **Kesalahan paling umum pada Menara Hanoi adalah sembilan hal berikut, masing-masing dengan pernyataan yang benar.** | Kesalahan | Yang benar | |---|---| | ❌ Langkah paling sedikit untuk $n$ cakram sekitar $n^2$ atau $2n$ | Yaitu $2^n-1$: $7$ untuk tiga cakram, $1023$ untuk sepuluh, dan setiap cakram tambahan melipatduakannya. | | ❌ Mulai dengan memindahkan cakram terbesar | Ia tidak dapat bergerak sampai $n-1$ cakram yang lebih kecil semuanya di tiang ketiga: selesaikan itu dulu. | | ❌ Cakram besar boleh di atas yang kecil bila hanya sesaat | Tidak pernah: aturannya berlaku setiap saat, sehingga cakram terbesar memerlukan tiang tanpa cakram yang lebih kecil. | | ❌ Rekursi memerlukan tumpukan $2^n$ panggilan | Ia membuat $2^{n+1}-1$ panggilan tetapi tidak pernah lebih dalam daripada $n$. | | ❌ Menara 64 cakram akan segera selesai | Pada satu langkah per detik ia memerlukan $585$ miliar tahun, $42$ kali usia alam semesta. | | ❌ Ada banyak solusi terpendek | Dengan tiga tiang tepat satu: setiap ketaksamaan dalam bukti harus berupa kesamaan. | | ❌ Setiap posisi berjarak $2^n-1$ langkah dari tujuan | Jaraknya bergantung pada posisi: setelah $m$ langkah solusi terbaik, hanya tersisa $2^n-1-m$, dan cakram terbesar yang belum di tempatnya menentukan sisanya. | | ❌ Tiang keempat hanya menghemat sedikit | Sepuluh cakram memerlukan $49$ langkah, bukan $1023$, dan $64$ cakram memerlukan $18\,433$ langkah, bukan $2^{64}-1$. | | ❌ Pada versi perulangan cakram terkecil berganti arah | Ia selalu melangkah searah mengelilingi tiang, lebih dulu ke tujuan jika $n$ ganjil dan ke cadangan jika $n$ genap. | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: Menara Hanoi sekilas - **Aturan:** tiga tiang, satu cakram sekali waktu, tidak pernah cakram besar di atas yang kecil; $3^n$ posisi. - **Rekursi:** selesaikan $n-1$ ke tiang cadangan, pindahkan yang terbesar, selesaikan $n-1$ ke atasnya; $T(n)=2T(n-1)+1$, sehingga $T(n)=2^n-1$. - **Optimal dan tunggal:** cakram terbesar harus bergerak, dengan semua yang lain di tiang ketiga sebelumnya dan kerja yang sama lagi sesudahnya: $M(n)\ge2M(n-1)+1$. - **Waktu:** $64$ cakram, $2^{64}-1$ langkah, $585$ miliar tahun pada satu langkah per detik; rekursinya sedalam $n$. - **Biner:** langkah $m$ memindahkan cakram $v+1$ untuk bit set terendah $2^v$ dari $m$; cakram $k$ bergerak $2^{n-k}$ kali; versi perulangan menggerakkan cakram terkecil searah setiap dua langkah; kode Gray. - **Graf:** $3^n$ posisi membentuk segitiga Sierpiński, dan solusi terbaik adalah satu sisinya. - **Lebih banyak tiang:** Frame–Stewart $F(n,p)=\min(2F(k,p)+F(n-k,p-1))$, optimal untuk $p=4$ (2014): $64$ cakram dalam $18\,433$ langkah. - **Sejarah:** Lucas 1883, Dudeney 1907, Frame dan Stewart 1941, Bousch 2014. ## Glosarium: istilah penting - **Menara Hanoi**: Teka-teki memindahkan tumpukan cakram di antara tiga tiang, satu cakram sekali waktu, tanpa pernah menaruh cakram yang lebih besar di atas yang lebih kecil. - **Rekursi**: Cara menyelesaikan masalah dengan menyelesaikan salinan masalah yang sama yang lebih kecil dan menggabungkan hasilnya. - **Relasi rekurensi langkah**: Persamaan T(n) = 2T(n−1) + 1 untuk banyaknya langkah solusi terbaik dengan n cakram. - **Pertumbuhan eksponensial**: Pertumbuhan yang setiap satuan masukan tambahan mengalikan biaya dengan konstanta, seperti setiap cakram tambahan melipatduakan banyak langkah. - **Barisan penggaris**: Barisan 1, 2, 1, 3, 1, 2, 1, 4, … yang suku pada posisi m adalah satu ditambah banyaknya nol di ujung m dalam biner. - **Kode Gray**: Penomoran biner yang bilangan berurutannya berbeda tepat satu bit. - **Segitiga Sierpiński**: Fraktal yang terdiri dari tiga salinan dirinya setengah ukuran yang ditempatkan di sudut-sudut segitiga; graf posisi Menara Hanoi berbentuk seperti ini. - **Bilangan Frame–Stewart**: Banyaknya langkah solusi terbaik yang diketahui untuk Menara Hanoi dengan empat tiang atau lebih, ditemukan dengan membagi menara di tempat terbaik. ## Pertanyaan yang sering diajukan ### Berapa langkah minimum dalam Menara Hanoi? Dengan tiga tiang dan n cakram minimumnya dua pangkat n dikurangi satu. Tiga cakram memerlukan 7 langkah, empat memerlukan 15 dan sepuluh memerlukan 1023, dan tidak ada solusi yang lebih baik karena cakram terbesar memaksa kerja itu berulang. ### Bagaimana menyelesaikan Menara Hanoi langkah demi langkah? Pindahkan n dikurangi 1 cakram teratas ke tiang cadangan, pindahkan cakram terbesar ke tujuan, lalu pindahkan n dikurangi 1 cakram dari tiang cadangan ke tujuan. Masing-masing dari dua pemindahan besar itu adalah teka-teki yang sama dengan lebih sedikit cakram. ### Adakah solusi iteratif untuk Menara Hanoi? Ada. Pada langkah ganjil geser cakram terkecil satu tiang menurut arah tetap mengelilingi tiang, dan pada langkah genap lakukan satu-satunya langkah sah yang tidak melibatkan cakram terkecil. Ia membuat langkah yang persis sama dengan rekursi. ### Apakah solusi terpendek Menara Hanoi tunggal? Dengan tiga tiang, ya. Solusi dengan tepat dua pangkat n dikurangi satu langkah harus memindahkan cakram terbesar sekali, dan langkah sebelum dan sesudahnya masing-masing harus solusi terpendek untuk satu cakram lebih sedikit, sehingga induksi menyisakan satu. ### Berapa lama menyelesaikan Menara Hanoi 64 cakram? Ia memerlukan 18.446.744.073.709.551.615 langkah. Pada satu langkah per detik itu sekitar 585 miliar tahun, kira-kira 42 kali usia alam semesta, dan bahkan semiliar langkah per detik masih memerlukan sekitar 585 tahun. ### Bagaimana hubungan Menara Hanoi dan kode Gray? Cakram yang dipindah pada langkah m ditentukan oleh bit set terendah m, barisan penggaris, dan barisan yang sama menunjukkan bit mana yang berubah di antara kode Gray berurutan. Jadi bit k kode Gray m menunjukkan apakah cakram k ditambah satu sudah bergerak sebanyak ganjil kali. ### Apa itu dugaan Frame–Stewart? Dugaan ini berkata langkah paling sedikit dengan empat tiang atau lebih berasal dari memindahkan k cakram teratas ke tiang cadangan, sisanya dengan satu tiang lebih sedikit, lalu k cakram itu lagi, dengan k terbaik. Ia terbukti untuk empat tiang, dan terbuka untuk lebih banyak. ### Mengapa rekursi cara yang wajar untuk menyelesaikan Menara Hanoi? Karena memindahkan n cakram memuat dua salinan tugas yang sama yang lebih kecil, memindahkan n dikurangi 1 cakram, dengan hanya peran tiang yang berubah. Rekursinya tidak pernah lebih dalam daripada n, meskipun membuat sekitar dua pangkat n panggilan. --- # Fibonacci Numbers Source: https://nunada.my.id/articles/fibonacci-numbers/ Updated: 2026-10-22 ## Quick answer **The Fibonacci numbers are $0,1,1,2,3,5,8,13,21,\ldots$, each the sum of the two before it: $F_0=0$, $F_1=1$ and $F_n=F_{n-1}+F_{n-2}$.** They have the closed form $F_n=\frac{\varphi^n-\psi^n}{\sqrt5}$ with $\varphi=\frac{1+\sqrt5}{2}\approx1.618$ and $\psi=\frac{1-\sqrt5}{2}$, the ratio $\frac{F_{n+1}}{F_n}$ tends to $\varphi$, and $F_n$ can be computed with about $\log_2n$ big multiplications instead of $n$ additions. For example $F_{10}=55$, $F_{20}=6765$ and $F_{100}=354\,224\,848\,179\,261\,915\,075$. ### Key takeaways - $F_0=0$, $F_1=1$, $F_n=F_{n-1}+F_{n-2}$ gives $0,1,1,2,3,5,8,13,21,34,55,89,144$. The same numbers count the ways to climb $n$ stairs with steps of $1$ or $2$ (that is $F_{n+1}$), the binary strings of length $n$ with no two $1$s in a row ($F_{n+2}$) and Fibonacci's rabbits. - Binet's formula $F_n=\frac{\varphi^n-\psi^n}{\sqrt5}$ works because $\varphi$ and $\psi$ solve $x^2=x+1$. Since $|\psi^n/\sqrt5|<\frac12$, $F_n$ is the integer nearest to $\varphi^n/\sqrt5$, but in floating point this fails already at $n=71$. The ratio $\frac{F_{n+1}}{F_n}$ differs from $\varphi$ by $\frac{\psi^n}{F_n}\approx\frac{\pm1}{\sqrt5F_n^2}$. - Identities with short proofs: $F_1+\cdots+F_n=F_{n+2}-1$, $F_1^2+\cdots+F_n^2=F_nF_{n+1}$, Cassini's $F_{n-1}F_{n+1}-F_n^2=(-1)^n$, the doubling formulas $F_{2n}=F_n(2F_{n+1}-F_n)$ and $F_{2n+1}=F_n^2+F_{n+1}^2$, and $\gcd(F_m,F_n)=F_{\gcd(m,n)}$. - The plain recursion makes $2F_{n+1}-1\approx\varphi^n$ calls (about $4\times10^{10}$ for $n=50$); a memo or a loop needs about $n$ steps; fast doubling needs $3\lceil\log_2n\rceil$ big multiplications. $F_n$ has about $0.209\,n$ digits, so $F_{1000}$ has $209$ and $F_{10^6}$ has $208\,988$. - Zeckendorf's theorem: every positive integer is, in exactly one way, a sum of Fibonacci numbers $1,2,3,5,8,\ldots$ no two of which are neighbors; the greedy method finds it. Modulo $m$ the sequence repeats with the Pisano period $\pi(m)$: $\pi(10)=60$, so the last digit of $F_n$ repeats every $60$ numbers. - The golden ratio explains the spirals of seeds in many sunflowers and cones (the golden angle $360^\circ/\varphi^2\approx137.5^\circ$) and the worst case of Euclid's algorithm, which is consecutive Fibonacci numbers. Many other claims, about pyramids, the Parthenon or paintings, are myths. ## What are the Fibonacci numbers? **The Fibonacci numbers are the sequence in which every number from the third on is the sum of the two before it, starting from $0$ and $1$.** In symbols $$F_0=0,\qquad F_1=1,\qquad F_n=F_{n-1}+F_{n-2}\quad(n\ge2).$$ The first terms are | $n$ | 0 | 1 | 2 | 3 | 4 | 5 | 6 | |---|---|---|---|---|---|---|---| | $F_n$ | 0 | 1 | 1 | 2 | 3 | 5 | 8 | | $n$ | 7 | 8 | 9 | 10 | 11 | 12 | 13 | |---|---|---|---|---|---|---|---| | $F_n$ | 13 | 21 | 34 | 55 | 89 | 144 | 233 | and $F_{20}=6765$, $F_{30}=832\,040$, $F_{50}=12\,586\,269\,025$. Some books start at $F_1=F_2=1$ and skip $F_0$; the numbers are the same, so check which convention a source uses. A rule that defines each term from earlier ones is a recurrence, and this one is linear (the terms are only added, never multiplied together) and of order two (it looks back two places), which is why two starting values are needed. Running it backward gives $F_{-1}=1$, $F_{-2}=-1$, $F_{-3}=2$, and so on, with signs that alternate. **Where the name comes from.** Leonardo of Pisa, called Fibonacci, put the sequence in his book Liber Abaci (1202) in a problem about rabbits: a pair has a new pair every month, and a new pair starts to have babies in its second month. Starting with one pair, how many pairs are there after a year? After $1,2,3,5,8,\ldots$ the answer is $377$ pairs, which is $F_{14}$. In general there are $F_{n+2}$ pairs after $n$ months. The sequence is far older, though: Indian scholars studying the rhythms of poetry described it centuries earlier (see the history below). Move the slider below to read the exact value of $F_n$ for $n$ up to $120$, together with the ratio of neighbors and a first test of a famous formula. ## What do the Fibonacci numbers count? **Whenever a counting problem can be split by "what is the last piece?" into two smaller copies of itself, the answer is a Fibonacci number.** Take the stairs. Let $s_n$ be the number of ways to climb $n$ stairs taking one or two at a time. The last step was either a $1$ (leaving $n-1$ stairs to climb before it, $s_{n-1}$ ways) or a $2$ (leaving $n-2$, $s_{n-2}$ ways), so $s_n=s_{n-1}+s_{n-2}$ with $s_1=1$ and $s_2=2$. That is the Fibonacci recurrence shifted by one place: $$s_n=F_{n+1},\qquad s_{10}=F_{11}=89.$$ The same argument counts many things: - **Tilings.** The number of ways to cover a strip of length $n$ with squares of length $1$ and dominoes of length $2$ is $F_{n+1}$. Pingala's counts of rhythms made of short and long syllables are the same problem. - **Strings.** The binary strings of length $n$ with no two $1$s in a row number $F_{n+2}$: for $n=3$ they are $000,001,010,100,101$, five of them, $F_5$. The same number counts the subsets of $\{1,\dots,n\}$ with no two consecutive numbers. - **Rabbits.** $F_{n+2}$ pairs after $n$ months, as above. - **Pascal's triangle.** The sums along the shallow diagonals are Fibonacci numbers: $C(5,0)+C(4,1)+C(3,2)=1+4+3=8=F_6$, where $C(n,k)$ are the binomial coefficients, and in general $F_{n+1}=\sum_kC(n-k,k)$. **Compositions.** Writing $n$ as an ordered sum of $1$s and $2$s is the stairs problem again: $4=1+1+1+1$, $4=1+1+2$, $4=1+2+1$, $4=2+1+1$ and $4=2+2$: five ways, $F_5$. This is why the Fibonacci numbers appear in so many counting exercises, and why the dynamic programming example "climbing stairs" is a Fibonacci computation in disguise (see the section on computing below). ## Is there a formula for the nth Fibonacci number? **Yes: Binet's formula $F_n=\frac{\varphi^n-\psi^n}{\sqrt5}$, where $\varphi=\frac{1+\sqrt5}{2}$ and $\psi=\frac{1-\sqrt5}{2}$ are the two roots of $x^2=x+1$.** Here is why. Look for solutions of the recurrence of the form $F_n=r^n$. Then $r^n=r^{n-1}+r^{n-2}$, and dividing by $r^{n-2}$ gives $$r^2=r+1,\qquad r=\frac{1\pm\sqrt5}{2}.$$ So $\varphi^n$ and $\psi^n$ both satisfy the recurrence, and so does every combination $A\varphi^n+B\psi^n$ (the recurrence is linear). Choose $A$ and $B$ to match the starting values: $F_0=0$ gives $A+B=0$, and $F_1=1$ gives $A\varphi+B\psi=1$. Since $\varphi-\psi=\sqrt5$, the solution is $A=\frac{1}{\sqrt5}=-B$, which is Binet's formula (known earlier to Euler and de Moivre; Jacques Binet published it in 1843). **What the two numbers are.** $\varphi=1.6180339887\ldots$ is the golden ratio, and $\psi=1-\varphi=-\frac1\varphi=-0.6180339887\ldots$ has absolute value below $1$, so $\psi^n$ shrinks quickly and alternates in sign. For $n\ge0$ we have $\left|\frac{\psi^n}{\sqrt5}\right|\le\frac1{\sqrt5}<\frac12$, so **$F_n$ is the integer nearest to $\frac{\varphi^n}{\sqrt5}$**: for $n=10$, $\frac{\varphi^{10}}{\sqrt5}=55.0036\ldots$, which rounds to $F_{10}=55$. **The ratio of neighbors.** From the formula, $F_{n+1}-\varphi F_n=\psi^n$ exactly, so $$\frac{F_{n+1}}{F_n}-\varphi=\frac{\psi^n}{F_n}\approx\frac{(-1)^n}{\sqrt5\,F_n^2}.$$ The ratio therefore alternates around $\varphi$ ($1,2,1.5,1.667,1.6,1.625,1.615,\ldots$) and gets there quickly: it gains about $2\log_{10}\varphi\approx0.42$ decimal places per step, so $\frac{F_{31}}{F_{30}}$ already agrees with $\varphi$ to ten decimals. Compare [the irrational numbers that are hardest to approximate by fractions](https://nunada.my.id/articles/irrational-numbers/#rational-approximations): the fractions $\frac{F_{n+1}}{F_n}$ are exactly the best ones for $\varphi$, and they are the slowest-converging continued fraction there is. **A warning for programmers.** Computing `round(phi ** n / sqrt(5))` with ordinary floating-point numbers is correct for $n\le70$ and wrong from $n=71$ ($308\,061\,521\,170\,130$ instead of $308\,061\,521\,170\,129$): a double has only about $16$ digits (see [the spacing of floats](https://nunada.my.id/articles/floating-point-numbers/#spacing)), and $\varphi^{71}$ must be known to better than one part in $10^{15}$. For exact values use integers. ## Which identities do the Fibonacci numbers satisfy? **The Fibonacci numbers satisfy dozens of identities, and a few short proofs explain most of them.** **Sums.** Since $F_k=F_{k+2}-F_{k+1}$, adding for $k=1$ to $n$ telescopes: $$F_1+F_2+\cdots+F_n=F_{n+2}-F_2=F_{n+2}-1.$$ For $n=10$ the ten terms $1,1,2,3,5,8,13,21,34,55$ add up to $143$, and $F_{12}-1=143$ too. In the same way $F_1+F_3+\cdots+F_{2n-1}=F_{2n}$ and $F_2+F_4+\cdots+F_{2n}=F_{2n+1}-1$. For squares, a picture of rectangles of sides $F_k\times F_k$ stacked into a $F_n\times F_{n+1}$ rectangle proves $$F_1^2+F_2^2+\cdots+F_n^2=F_nF_{n+1},\qquad1+1+4+9+25=40=5\cdot8.$$ **The matrix proof.** Put $Q=\begin{pmatrix}1&1\\1&0\end{pmatrix}$. Then $Q\begin{pmatrix}F_{n}\\F_{n-1}\end{pmatrix}=\begin{pmatrix}F_{n+1}\\F_{n}\end{pmatrix}$, so by induction $$Q^n=\begin{pmatrix}F_{n+1}&F_n\\F_n&F_{n-1}\end{pmatrix}.$$ Two facts follow at once. Taking determinants, $\det Q=-1$ gives **Cassini's identity** $$F_{n-1}F_{n+1}-F_n^2=(-1)^n.$$ And $Q^{2n}=(Q^n)^2$ compares entries to give the **doubling formulas** $$F_{2n}=F_n\,(2F_{n+1}-F_n),\qquad F_{2n+1}=F_n^2+F_{n+1}^2.$$ For example $F_{20}=F_{10}(2F_{11}-F_{10})=55\cdot123=6765$. **The missing square.** Cassini with $n=6$ says $F_5F_7-F_6^2=5\cdot13-8^2=1$. That is the old puzzle of cutting an $8\times8$ square (area $64$) into four pieces and rearranging them into a $5\times13$ rectangle (area $65$): the pieces cannot fill the rectangle exactly, and along the long diagonal there is a thin sliver gap of area $1$ that the eye does not see, because consecutive Fibonacci numbers have a ratio so close to $\varphi$. **Divisibility.** Consecutive Fibonacci numbers are coprime: a common divisor of $F_{n+1}$ and $F_n$ divides $F_{n+1}F_{n-1}-F_n^2=\pm1$. More generally $$\gcd(F_m,F_n)=F_{\gcd(m,n)}.$$ So $F_m$ divides $F_n$ whenever $m$ divides $n$ (for example $F_6=8$ divides $F_{12}=144$), every third Fibonacci number is even, every fourth is a multiple of $3$ and every fifth a multiple of $5$. The proof uses $F_{m+n}=F_{m+1}F_n+F_mF_{n-1}$, which turns $\gcd(F_m,F_n)$ into $\gcd(F_{m-n},F_n)$: the Euclidean algorithm runs on the subscripts. Pick $n$ below. Each identity has its left side built the long way and its right side from the short formula, with exact numbers, and the last line checks the gcd rule. ## How do you compute Fibonacci numbers fast? **The recurrence invites a recursive function, and that is the slowest way to compute a Fibonacci number; a loop is fast enough for most purposes, and fast doubling is the way to reach very large $n$.** **Plain recursion.** `fib(n) = fib(n-1) + fib(n-2)` recomputes the same values over and over. The number of calls $C_n$ satisfies $C_n=C_{n-1}+C_{n-2}+1$ with $C_0=C_1=1$, which solves to $$C_n=2F_{n+1}-1\approx\frac{2\varphi^{n+1}}{\sqrt5}.$$ That is $21\,891$ calls for $n=20$, $331\,160\,281$ for $n=40$, $40\,730\,022\,147$ for $n=50$ (about $41$ seconds at a billion calls a second) and about $1.1\times10^{21}$ for $n=100$ (some $36\,000$ years). The cost grows like $\varphi^n$, an exponential, which is the example used in [the section on recurrences in the Big-O article](https://nunada.my.id/articles/big-o-notation/#recurrences). **Memoization and the loop.** Remember each value once computed and the calls drop to $2n-1$. Better, keep only the last two values in a loop: $n-1$ additions and no recursion (Python's default limit of $1000$ nested calls stops a recursive version near $n=1000$). **Fast doubling.** The identities $F_{2k}=F_k(2F_{k+1}-F_k)$ and $F_{2k+1}=F_k^2+F_{k+1}^2$ get $(F_{2k},F_{2k+1})$ from $(F_k,F_{k+1})$, so reading the bits of $n$ from the top, one doubling step per bit gives $(F_n,F_{n+1})$ with $3\lceil\log_2n\rceil$ multiplications. This is exponentiation by squaring applied to the matrix $Q$ of the last section, with the redundant entries dropped. To get $F_{10^6}$ it takes $20$ steps instead of a million additions. **The numbers get long.** $F_n$ has $\lfloor n\log_{10}\varphi-\log_{10}\sqrt5\rfloor+1$ digits, about $0.209\,n$: $F_{100}$ has $21$, $F_{1000}$ has $209$, $F_{10^5}$ has $20\,899$ and $F_{10^6}$ has $208\,988$. So an addition is not one step but about $0.2\,n$ digit operations, and the loop really costs about $n^2$ digit operations. Fast doubling also wins here, since it multiplies a few very long numbers. Note also that fixed-size integers overflow early: a 32-bit signed integer stops at $F_{46}=1\,836\,311\,903$ and a double stops being exact at $F_{78}$ (see [binary numbers](https://nunada.my.id/articles/binary-numbers/#binary-arithmetic)). Slide $n$ below to compare the four methods and read the first and last digits of the exact answer. ## How do you write a number as a sum of Fibonacci numbers? **Zeckendorf's theorem says that every positive integer is a sum of Fibonacci numbers from $1,2,3,5,8,13,\ldots$ in exactly one way if no two of them may be neighbors in that list.** For example $$100=89+8+3=F_{11}+F_6+F_4,\qquad 12=8+3+1,\qquad 4=3+1.$$ (The list starts at $F_2=1$, because $F_1$ is the same number.) Dropping the rule of no neighbors, the same number usually has several sums: $100$ can be written in $9$ ways with different Fibonacci numbers, such as $89+8+3$ and $55+34+8+3$, and only one of them has no neighbors. **The greedy method finds it.** Take the largest Fibonacci number not above $N$, subtract it, and repeat on the rest. The rest is smaller than the previous Fibonacci number (otherwise a larger one would have fitted), so the next term is never the neighbor of the one just taken. **Why it is unique.** The telescoping sums of the identities section show that the largest sum of non-neighboring Fibonacci numbers below $F_k$ is $F_{k-1}+F_{k-3}+F_{k-5}+\cdots=F_k-1$ (for $k=7$: $8+3+1=12=13-1$). So a no-neighbors sum for $N$ cannot leave out the largest Fibonacci number $F_k\le N$: without it the sum would be at most $F_k-1 { let a = 0n, b = 1n; for (let i = 0; i < n; i++) [a, b] = [b, a + b]; return a } fib(100) // 354224848179261915075n // fast doubling: F(2k) = F(k)(2F(k+1) - F(k)), F(2k+1) = F(k)^2 + F(k+1)^2 const pair = (n) => { if (n === 0n) return [0n, 1n] const [a, b] = pair(n >> 1n) const c = a * (2n * b - a), d = a * a + b * b return n & 1n ? [d, c + d] : [c, d] } pair(1000000n)[0].toString().length // 208988 // plain numbers stop being exact: the first b that is not a safe integer is wrong in its last digit let a = 0, b = 1, n = 0 while (Number.isSafeInteger(b)) { [a, b] = [b, a + b]; n++ } ;[n, a, b] // [78, 8944394323791464, 14472334024676220]; the true F(79) ends in ...221 // Binet in doubles const phi = (1 + Math.sqrt(5)) / 2 let k = 0 while (BigInt(Math.round(phi ** k / Math.sqrt(5))) === fib(k)) k++ k // 71 // F(n) mod m for a huge n const fibMod = (n, m) => { const go = (j) => { if (j === 0n) return [0n, 1n % m] const [x, y] = go(j >> 1n) const c = (x * ((2n * y - x) % m + m)) % m, d = (x * x + y * y) % m return j & 1n ? [d, (c + d) % m] : [c, d] } return go(n)[0] } ;[fibMod(10n ** 18n, 10n), fibMod(10n ** 18n, 1000000007n)] // [5n, 209783453n] ``` ```cpp #include #include using namespace std; int main() { int a = 0, b = 1; for (int i = 0; i < 40; i++) { int t = a + b; a = b; b = t; } printf("%d\n", a); // F(40); F(47) no longer fits in an int int ms[4] = {2, 5, 10, 100}; for (int k = 0; k < 4; k++) { int m = ms[k], x = 0, y = 1 % m, p = 0; do { int t = (x + y) % m; x = y; y = t; p++; } while (!(x == 0 && y == 1)); printf("%d %d\n", m, p); // the Pisano period } int u = 233, v = 144, steps = 0; // Euclid's algorithm on F(13) and F(12) while (v != 0) { int t = u % v; u = v; v = t; steps++; } printf("%d %d\n", u, steps); // gcd 1 after n - 1 = 11 divisions return 0; } /* output: 102334155 2 3 5 20 10 60 100 300 1 11 */ ``` ## Where do the Fibonacci numbers come from? **The Fibonacci numbers were found in India as a count of poetic rhythms, centuries before Fibonacci's rabbits.** - **About 200 BC.** The Indian scholar Pingala, in his work on Sanskrit metre, counted the patterns of short and long syllables, which leads to the numbers $1,2,3,5,8,\ldots$. - **About 700 and 1150.** Virahanka stated the rule that each count is the sum of the two before it, and Hemachandra gave it again; Gopala had done so around 1135. - **1202.** Leonardo of Pisa, known as Fibonacci, published Liber Abaci with the rabbit problem and the first terms up to $377$. The book mainly taught Europeans the Hindu-Arabic numerals. - **1730–1843.** Abraham de Moivre and Leonhard Euler knew the closed formula; Jacques Binet published it in 1843. - **1844.** Gabriel Lamé used the Fibonacci numbers to bound the steps of Euclid's algorithm. - **1870s.** Édouard Lucas studied the sequence in depth, introduced the companion Lucas numbers $2,1,3,4,7,11,\ldots$, used them to test whether large numbers are prime, and gave the sequence the name Fibonacci. - **1939–1972.** Edouard Zeckendorf proved the theorem on sums of Fibonacci numbers (published in 1972, after Gerrit Lekkerkerker's 1952 paper). - **1963.** The Fibonacci Association and its journal, the Fibonacci Quarterly, were founded. - **1970.** Yuri Matiyasevich used the exponential growth of Fibonacci numbers to complete the proof that Hilbert's tenth problem, a general method for solving equations in integers, has no solution. ## What mistakes do people make with Fibonacci numbers? **The most common mistakes with Fibonacci numbers are the nine below, each with the correct statement.** | Mistake | Correct | |---|---| | ❌ The sequence starts $1,2,3,5,\ldots$ | It starts $0,1,1,2,3,5$; some books start at $F_1=F_2=1$, so state the convention before using an index. | | ❌ $\varphi^n/\sqrt5$ equals $F_n$ | It is within $\frac12$ of $F_n$: round it, and in floating point even that fails from $n=71$. | | ❌ The recursion is fine up to $n=50$ | It makes $2F_{51}-1\approx4\times10^{10}$ calls; use a loop, a memo, or fast doubling. | | ❌ A memoized recursion handles any $n$ | Python's default limit of $1000$ nested calls stops it near $n=1000$; use a loop. | | ❌ $F_n$ fits in a normal integer | A 32-bit signed integer stops at $F_{46}$, a 64-bit one at $F_{92}$ and a double is exact only to $F_{78}$. | | ❌ $\frac{F_{n+1}}{F_n}$ is always below $\varphi$ | It alternates: below for even $n$ and above for odd $n$, and gets closer each time. | | ❌ Fibonacci numbers are in the pyramids, the Parthenon and the Mona Lisa | Those claims are not supported by measurements; the real appearances are phyllotaxis, Euclid's algorithm and counting problems. | | ❌ A Zeckendorf sum may use two neighboring Fibonacci numbers | No two are neighbors: greedy takes the largest that fits, so $100=89+8+3$ and not $55+34+8+3$, where $55$ and $34$ are neighbors. | | ❌ The last digits of Fibonacci numbers look random | They repeat: the last digit every $60$ numbers, the last two every $300$ (Pisano periods). | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: Fibonacci numbers at a glance - **Definition:** $F_0=0$, $F_1=1$, $F_n=F_{n-1}+F_{n-2}$; $F_{n+1}$ counts the ways to climb $n$ stairs with steps of $1$ or $2$. - **Binet:** $F_n=\frac{\varphi^n-\psi^n}{\sqrt5}$, the integer nearest to $\frac{\varphi^n}{\sqrt5}$; the ratio $\frac{F_{n+1}}{F_n}$ is $\varphi+\frac{\psi^n}{F_n}$; in doubles it fails at $n=71$. - **Identities:** $\sum F_k=F_{n+2}-1$, $\sum F_k^2=F_nF_{n+1}$, Cassini $(-1)^n$, doubling, $\gcd(F_m,F_n)=F_{\gcd(m,n)}$; all follow from $Q=\begin{pmatrix}1&1\\1&0\end{pmatrix}$. - **Computing:** recursion $2F_{n+1}-1$ calls, memo $2n-1$, loop $n-1$ additions, fast doubling $3\lceil\log_2n\rceil$ multiplications; $F_n$ has $0.209\,n$ digits. - **Zeckendorf:** every positive integer is a unique sum of non-neighboring Fibonacci numbers, found greedily; the Fibonacci code is built on it. - **Pisano:** $F_n\bmod m$ repeats with period $\pi(m)\le6m$; $\pi(10)=60$, so reduce $n$ first. - **Nature and algorithms:** golden angle $137.5^\circ$ in seed spirals, Euclid's worst case; the pyramid and painting claims are myths. - **Code:** big integers, a loop, fast doubling, remainders at every step. ## Glossary: key terms - **Fibonacci number**: A term of the sequence 0, 1, 1, 2, 3, 5, 8, 13, … in which each term is the sum of the two before it. - **Golden ratio**: The number 1 plus the square root of 5, over 2, about 1.618, the limit of the ratio of consecutive Fibonacci numbers. - **Binet's formula**: The closed form for the nth Fibonacci number as the difference of the nth powers of the two roots of x squared equals x plus 1, divided by the square root of 5. - **Cassini's identity**: The identity that F(n−1) times F(n+1) minus F(n) squared equals minus 1 to the power n. - **Fast doubling**: A method that finds F(n) with about log n big multiplications by getting F(2k) and F(2k+1) from F(k) and F(k+1). - **Zeckendorf representation**: The unique way to write a positive integer as a sum of Fibonacci numbers, no two of which are neighbors in the sequence. - **Pisano period**: The length of the cycle of the Fibonacci numbers modulo m, written pi of m; for m equal to 10 it is 60. - **Phyllotaxis**: The arrangement of leaves, seeds or scales on a plant, often in spirals whose counts are neighboring Fibonacci numbers. - **Lucas numbers**: The companion sequence 2, 1, 3, 4, 7, 11, … with the same recurrence as the Fibonacci numbers but different starting values. ## Frequently asked questions ### What is the Fibonacci sequence? It is the sequence 0, 1, 1, 2, 3, 5, 8, 13, 21 and so on, where each number is the sum of the two before it. It starts from 0 and 1 and grows by a factor of about 1.618 at each step. ### What is the formula for the nth Fibonacci number? Binet's formula says it is phi to the n minus psi to the n, all divided by the square root of 5, where phi is about 1.618 and psi about minus 0.618. Rounding phi to the n over root 5 gives the exact number. ### How do you calculate Fibonacci numbers quickly? Use a loop that keeps the last two values for ordinary sizes, or fast doubling for huge ones, which needs only about log n big multiplications. The plain recursion takes exponential time because it repeats the same calls. ### Why does the ratio of Fibonacci numbers approach the golden ratio? Because F(n+1) minus phi times F(n) equals psi to the n exactly, and psi has absolute value below 1. Dividing by F(n) leaves a difference that shrinks fast and alternates in sign around phi. ### What is Zeckendorf's theorem? It says every positive integer can be written in exactly one way as a sum of Fibonacci numbers, no two of which are consecutive in the sequence. For example 100 is 89 plus 8 plus 3, found by repeatedly taking the largest that fits. ### What is the Pisano period? It is the length of the cycle of the Fibonacci numbers modulo m. For m equal to 10 it is 60, so the last digit of every Fibonacci number repeats every 60 steps, which lets you find remainders for gigantic indices. ### Are Fibonacci numbers really found in nature? Sometimes. The seed spirals of many sunflowers, pine cones and pineapples are counted by neighboring Fibonacci numbers, because of the golden angle of about 137.5 degrees. Claims about pyramids, paintings and the human body are mostly myths. ### How many ways can you climb n stairs taking one or two steps? There are F(n+1) ways: the last step is either one stair or two, leaving n minus 1 or n minus 2 stairs before it, so the counts follow the Fibonacci rule. Ten stairs give 89 ways. --- # Bilangan Fibonacci Source: https://nunada.my.id/artikel/bilangan-fibonacci/ Updated: 2026-10-22 ## Jawaban singkat **Bilangan Fibonacci adalah $0,1,1,2,3,5,8,13,21,\ldots$, masing-masing jumlah dua bilangan sebelumnya: $F_0=0$, $F_1=1$, dan $F_n=F_{n-1}+F_{n-2}$.** Mereka memiliki bentuk tertutup $F_n=\frac{\varphi^n-\psi^n}{\sqrt5}$ dengan $\varphi=\frac{1+\sqrt5}{2}\approx1{,}618$ dan $\psi=\frac{1-\sqrt5}{2}$, perbandingan $\frac{F_{n+1}}{F_n}$ menuju $\varphi$, dan $F_n$ dapat dihitung dengan sekitar $\log_2n$ perkalian bilangan besar, bukan $n$ penjumlahan. Misalnya $F_{10}=55$, $F_{20}=6765$, dan $F_{100}=354\,224\,848\,179\,261\,915\,075$. ### Poin penting - $F_0=0$, $F_1=1$, $F_n=F_{n-1}+F_{n-2}$ menghasilkan $0,1,1,2,3,5,8,13,21,34,55,89,144$. Bilangan yang sama menghitung cara menaiki $n$ anak tangga dengan langkah $1$ atau $2$ (yaitu $F_{n+1}$), untai biner panjang $n$ tanpa dua $1$ berurutan ($F_{n+2}$), dan kelinci Fibonacci. - Rumus Binet $F_n=\frac{\varphi^n-\psi^n}{\sqrt5}$ berlaku karena $\varphi$ dan $\psi$ menyelesaikan $x^2=x+1$. Karena $|\psi^n/\sqrt5|<\frac12$, $F_n$ adalah bilangan bulat terdekat dengan $\varphi^n/\sqrt5$, tetapi dalam titik mengambang ini sudah gagal pada $n=71$. Perbandingan $\frac{F_{n+1}}{F_n}$ berbeda dari $\varphi$ sebesar $\frac{\psi^n}{F_n}\approx\frac{\pm1}{\sqrt5F_n^2}$. - Identitas dengan bukti singkat: $F_1+\cdots+F_n=F_{n+2}-1$, $F_1^2+\cdots+F_n^2=F_nF_{n+1}$, identitas Cassini $F_{n-1}F_{n+1}-F_n^2=(-1)^n$, rumus penggandaan $F_{2n}=F_n(2F_{n+1}-F_n)$ dan $F_{2n+1}=F_n^2+F_{n+1}^2$, serta $\gcd(F_m,F_n)=F_{\gcd(m,n)}$. - Rekursi biasa membuat $2F_{n+1}-1\approx\varphi^n$ panggilan (sekitar $4\times10^{10}$ untuk $n=50$); memo atau perulangan memerlukan sekitar $n$ langkah; penggandaan cepat memerlukan $3\lceil\log_2n\rceil$ perkalian bilangan besar. $F_n$ memiliki sekitar $0{,}209\,n$ angka, sehingga $F_{1000}$ memiliki $209$ dan $F_{10^6}$ memiliki $208\,988$. - Teorema Zeckendorf: setiap bilangan bulat positif tepat dengan satu cara adalah jumlah bilangan Fibonacci $1,2,3,5,8,\ldots$ yang tidak ada dua yang bertetangga; metode rakus menemukannya. Modulo $m$ barisan itu berulang dengan periode Pisano $\pi(m)$: $\pi(10)=60$, sehingga angka terakhir $F_n$ berulang setiap $60$ bilangan. - Rasio emas menjelaskan spiral biji pada banyak bunga matahari dan kerucut (sudut emas $360^\circ/\varphi^2\approx137{,}5^\circ$) dan kasus terburuk algoritma Euclid, yaitu bilangan Fibonacci berurutan. Banyak klaim lain, tentang piramida, Parthenon, atau lukisan, adalah mitos. ## Apa itu bilangan Fibonacci? **Bilangan Fibonacci adalah barisan yang setiap bilangan dari yang ketiga adalah jumlah dua bilangan sebelumnya, dimulai dari $0$ dan $1$.** Dalam lambang $$F_0=0,\qquad F_1=1,\qquad F_n=F_{n-1}+F_{n-2}\quad(n\ge2).$$ Suku-suku pertamanya | $n$ | 0 | 1 | 2 | 3 | 4 | 5 | 6 | |---|---|---|---|---|---|---|---| | $F_n$ | 0 | 1 | 1 | 2 | 3 | 5 | 8 | | $n$ | 7 | 8 | 9 | 10 | 11 | 12 | 13 | |---|---|---|---|---|---|---|---| | $F_n$ | 13 | 21 | 34 | 55 | 89 | 144 | 233 | dan $F_{20}=6765$, $F_{30}=832\,040$, $F_{50}=12\,586\,269\,025$. Sebagian buku mulai dari $F_1=F_2=1$ dan melewatkan $F_0$; bilangannya sama, jadi periksa konvensi yang dipakai sebuah sumber. Aturan yang mendefinisikan tiap suku dari suku sebelumnya adalah rekurensi, dan yang ini linear (suku-sukunya hanya dijumlahkan, tidak pernah dikalikan satu sama lain) dan berorde dua (melihat dua tempat ke belakang), itulah sebabnya diperlukan dua nilai awal. Menjalankannya mundur memberi $F_{-1}=1$, $F_{-2}=-1$, $F_{-3}=2$, dan seterusnya, dengan tanda yang bergantian. **Dari mana namanya.** Leonardo dari Pisa, yang disebut Fibonacci, memasukkan barisan ini dalam bukunya Liber Abaci (1202) dalam soal tentang kelinci: sepasang kelinci memiliki sepasang anak setiap bulan, dan sepasang anak mulai beranak pada bulan keduanya. Dimulai dari sepasang, berapa pasang yang ada setelah setahun? Setelah $1,2,3,5,8,\ldots$ jawabannya $377$ pasang, yaitu $F_{14}$. Secara umum ada $F_{n+2}$ pasang setelah $n$ bulan. Barisan ini jauh lebih tua, namun: para sarjana India yang mempelajari irama puisi menguraikannya berabad-abad sebelumnya (lihat sejarah di bawah). Geser penggeser di bawah untuk membaca nilai eksak $F_n$ sampai $n=120$, bersama perbandingan tetangga dan uji pertama sebuah rumus terkenal. ## Apa yang dihitung oleh bilangan Fibonacci? **Setiap kali soal menghitung dapat dibagi dengan "apa bagian terakhirnya?" menjadi dua salinan yang lebih kecil, jawabannya adalah bilangan Fibonacci.** Ambil tangga. Misalkan $s_n$ adalah banyaknya cara menaiki $n$ anak tangga dengan satu atau dua sekali langkah. Langkah terakhir adalah $1$ (menyisakan $n-1$ anak tangga yang didaki sebelumnya, $s_{n-1}$ cara) atau $2$ (menyisakan $n-2$, $s_{n-2}$ cara), sehingga $s_n=s_{n-1}+s_{n-2}$ dengan $s_1=1$ dan $s_2=2$. Itu rekurensi Fibonacci yang bergeser satu tempat: $$s_n=F_{n+1},\qquad s_{10}=F_{11}=89.$$ Argumen yang sama menghitung banyak hal: - **Pengubinan.** Banyaknya cara menutup pita sepanjang $n$ dengan persegi panjang $1$ dan domino panjang $2$ adalah $F_{n+1}$. Hitungan Pingala tentang irama dari suku kata pendek dan panjang adalah soal yang sama. - **Untai.** Untai biner panjang $n$ tanpa dua $1$ berurutan berjumlah $F_{n+2}$: untuk $n=3$ mereka $000,001,010,100,101$, lima, $F_5$. Bilangan yang sama menghitung himpunan bagian $\{1,\dots,n\}$ tanpa dua bilangan berurutan. - **Kelinci.** $F_{n+2}$ pasang setelah $n$ bulan, seperti di atas. - **Segitiga Pascal.** Jumlah sepanjang diagonal landai adalah bilangan Fibonacci: $C(5,0)+C(4,1)+C(3,2)=1+4+3=8=F_6$, dengan $C(n,k)$ koefisien binomial, dan secara umum $F_{n+1}=\sum_kC(n-k,k)$. **Komposisi.** Menuliskan $n$ sebagai jumlah terurut dari $1$ dan $2$ adalah soal tangga lagi: $4=1+1+1+1$, $4=1+1+2$, $4=1+2+1$, $4=2+1+1$, dan $4=2+2$: lima cara, $F_5$. Itulah sebabnya bilangan Fibonacci muncul dalam begitu banyak latihan menghitung, dan sebabnya contoh pemrograman dinamis "menaiki tangga" adalah perhitungan Fibonacci yang menyamar (lihat bagian tentang menghitung di bawah). ## Adakah rumus untuk bilangan Fibonacci ke-n? **Ya: rumus Binet $F_n=\frac{\varphi^n-\psi^n}{\sqrt5}$, dengan $\varphi=\frac{1+\sqrt5}{2}$ dan $\psi=\frac{1-\sqrt5}{2}$ kedua akar $x^2=x+1$.** Inilah alasannya. Cari penyelesaian rekurensi berbentuk $F_n=r^n$. Maka $r^n=r^{n-1}+r^{n-2}$, dan membagi dengan $r^{n-2}$ memberi $$r^2=r+1,\qquad r=\frac{1\pm\sqrt5}{2}.$$ Jadi $\varphi^n$ dan $\psi^n$ keduanya memenuhi rekurensi, demikian pula setiap kombinasi $A\varphi^n+B\psi^n$ (rekurensinya linear). Pilih $A$ dan $B$ agar cocok dengan nilai awal: $F_0=0$ memberi $A+B=0$, dan $F_1=1$ memberi $A\varphi+B\psi=1$. Karena $\varphi-\psi=\sqrt5$, solusinya $A=\frac{1}{\sqrt5}=-B$, yaitu rumus Binet (sudah dikenal Euler dan de Moivre; Jacques Binet menerbitkannya pada 1843). **Siapa kedua bilangan itu.** $\varphi=1{,}6180339887\ldots$ adalah rasio emas, dan $\psi=1-\varphi=-\frac1\varphi=-0{,}6180339887\ldots$ memiliki nilai mutlak di bawah $1$, sehingga $\psi^n$ menyusut cepat dan tandanya bergantian. Untuk $n\ge0$ berlaku $\left|\frac{\psi^n}{\sqrt5}\right|\le\frac1{\sqrt5}<\frac12$, sehingga **$F_n$ adalah bilangan bulat terdekat dengan $\frac{\varphi^n}{\sqrt5}$**: untuk $n=10$, $\frac{\varphi^{10}}{\sqrt5}=55{,}0036\ldots$, yang dibulatkan menjadi $F_{10}=55$. **Perbandingan tetangga.** Dari rumus itu, $F_{n+1}-\varphi F_n=\psi^n$ secara eksak, sehingga $$\frac{F_{n+1}}{F_n}-\varphi=\frac{\psi^n}{F_n}\approx\frac{(-1)^n}{\sqrt5\,F_n^2}.$$ Perbandingan itu karenanya bergantian di sekitar $\varphi$ ($1,2,1{,}5,1{,}667,1{,}6,1{,}625,1{,}615,\ldots$) dan sampai ke sana dengan cepat: ia memperoleh sekitar $2\log_{10}\varphi\approx0{,}42$ tempat desimal per langkah, sehingga $\frac{F_{31}}{F_{30}}$ sudah sesuai dengan $\varphi$ sampai sepuluh desimal. Bandingkan dengan [bilangan irasional yang paling sulit dihampiri pecahan](https://nunada.my.id/artikel/bilangan-irasional/#rational-approximations): pecahan $\frac{F_{n+1}}{F_n}$ persis yang terbaik untuk $\varphi$, dan merupakan pecahan berantai yang paling lambat konvergen. **Peringatan bagi pemrogram.** Menghitung `round(phi ** n / sqrt(5))` dengan bilangan titik mengambang biasa benar untuk $n\le70$ dan salah mulai $n=71$ ($308\,061\,521\,170\,130$ bukan $308\,061\,521\,170\,129$): sebuah double hanya memiliki sekitar $16$ angka (lihat [jarak antarbilangan titik mengambang](https://nunada.my.id/artikel/bilangan-floating-point/#spacing)), dan $\varphi^{71}$ harus diketahui lebih baik daripada satu bagian dalam $10^{15}$. Untuk nilai eksak pakai bilangan bulat. ## Identitas apa yang dipenuhi bilangan Fibonacci? **Bilangan Fibonacci memenuhi lusinan identitas, dan beberapa bukti singkat menjelaskan sebagian besarnya.** **Jumlah.** Karena $F_k=F_{k+2}-F_{k+1}$, menjumlahkan untuk $k=1$ sampai $n$ meniadakan suku-suku: $$F_1+F_2+\cdots+F_n=F_{n+2}-F_2=F_{n+2}-1.$$ Untuk $n=10$ kesepuluh suku $1,1,2,3,5,8,13,21,34,55$ berjumlah $143$, dan $F_{12}-1=143$ juga. Dengan cara yang sama $F_1+F_3+\cdots+F_{2n-1}=F_{2n}$ dan $F_2+F_4+\cdots+F_{2n}=F_{2n+1}-1$. Untuk kuadrat, gambar persegi bersisi $F_k\times F_k$ yang ditumpuk menjadi persegi panjang $F_n\times F_{n+1}$ membuktikan $$F_1^2+F_2^2+\cdots+F_n^2=F_nF_{n+1},\qquad1+1+4+9+25=40=5\cdot8.$$ **Bukti matriks.** Misalkan $Q=\begin{pmatrix}1&1\\1&0\end{pmatrix}$. Maka $Q\begin{pmatrix}F_{n}\\F_{n-1}\end{pmatrix}=\begin{pmatrix}F_{n+1}\\F_{n}\end{pmatrix}$, sehingga dengan induksi $$Q^n=\begin{pmatrix}F_{n+1}&F_n\\F_n&F_{n-1}\end{pmatrix}.$$ Dua fakta langsung mengikuti. Dengan determinan, $\det Q=-1$ memberi **identitas Cassini** $$F_{n-1}F_{n+1}-F_n^2=(-1)^n.$$ Dan $Q^{2n}=(Q^n)^2$ membandingkan entri-entrinya untuk memberi **rumus penggandaan** $$F_{2n}=F_n\,(2F_{n+1}-F_n),\qquad F_{2n+1}=F_n^2+F_{n+1}^2.$$ Misalnya $F_{20}=F_{10}(2F_{11}-F_{10})=55\cdot123=6765$. **Persegi yang hilang.** Cassini dengan $n=6$ berkata $F_5F_7-F_6^2=5\cdot13-8^2=1$. Itulah teka-teki lama tentang memotong persegi $8\times8$ (luas $64$) menjadi empat bagian dan menyusunnya menjadi persegi panjang $5\times13$ (luas $65$): bagian-bagian itu tidak dapat mengisi persegi panjang secara tepat, dan di sepanjang diagonal panjang ada celah tipis seluas $1$ yang tidak terlihat mata, karena bilangan Fibonacci berurutan memiliki perbandingan yang begitu dekat dengan $\varphi$. **Keterbagian.** Bilangan Fibonacci berurutan saling prima: pembagi persekutuan $F_{n+1}$ dan $F_n$ membagi $F_{n+1}F_{n-1}-F_n^2=\pm1$. Lebih umum $$\gcd(F_m,F_n)=F_{\gcd(m,n)}.$$ Jadi $F_m$ membagi $F_n$ bila $m$ membagi $n$ (misalnya $F_6=8$ membagi $F_{12}=144$), setiap bilangan Fibonacci ketiga genap, setiap yang keempat kelipatan $3$, dan setiap yang kelima kelipatan $5$. Buktinya memakai $F_{m+n}=F_{m+1}F_n+F_mF_{n-1}$, yang mengubah $\gcd(F_m,F_n)$ menjadi $\gcd(F_{m-n},F_n)$: algoritma Euclid berjalan pada subskripnya. Pilih $n$ di bawah. Setiap identitas memiliki ruas kiri yang disusun dengan cara panjang dan ruas kanan dari rumus ringkas, dengan bilangan eksak, dan baris terakhir memeriksa aturan gcd. ## Bagaimana menghitung bilangan Fibonacci dengan cepat? **Rekurensi mengundang fungsi rekursif, dan itulah cara paling lambat menghitung bilangan Fibonacci; perulangan cukup cepat untuk kebanyakan keperluan, dan penggandaan cepat adalah cara mencapai $n$ yang sangat besar.** **Rekursi biasa.** `fib(n) = fib(n-1) + fib(n-2)` menghitung ulang nilai yang sama berulang-ulang. Banyaknya panggilan $C_n$ memenuhi $C_n=C_{n-1}+C_{n-2}+1$ dengan $C_0=C_1=1$, yang diselesaikan menjadi $$C_n=2F_{n+1}-1\approx\frac{2\varphi^{n+1}}{\sqrt5}.$$ Itu $21\,891$ panggilan untuk $n=20$, $331\,160\,281$ untuk $n=40$, $40\,730\,022\,147$ untuk $n=50$ (sekitar $41$ detik pada satu miliar panggilan per detik) dan sekitar $1{,}1\times10^{21}$ untuk $n=100$ (sekitar $36\,000$ tahun). Biayanya tumbuh seperti $\varphi^n$, eksponensial, yaitu contoh yang dipakai dalam [bagian tentang rekurensi pada artikel Big-O](https://nunada.my.id/artikel/notasi-big-o/#recurrences). **Memoisasi dan perulangan.** Ingat setiap nilai yang sudah dihitung dan panggilan turun menjadi $2n-1$. Lebih baik lagi, simpan hanya dua nilai terakhir dalam perulangan: $n-1$ penjumlahan tanpa rekursi (batas bawaan Python sebesar $1000$ panggilan bersarang menghentikan versi rekursif di sekitar $n=1000$). **Penggandaan cepat.** Identitas $F_{2k}=F_k(2F_{k+1}-F_k)$ dan $F_{2k+1}=F_k^2+F_{k+1}^2$ mendapatkan $(F_{2k},F_{2k+1})$ dari $(F_k,F_{k+1})$, sehingga dengan membaca bit $n$ dari atas, satu langkah penggandaan per bit memberi $(F_n,F_{n+1})$ dengan $3\lceil\log_2n\rceil$ perkalian. Ini adalah perpangkatan dengan pengkuadratan yang diterapkan pada matriks $Q$ di bagian sebelumnya, dengan entri yang berlebih dibuang. Untuk mendapatkan $F_{10^6}$ diperlukan $20$ langkah, bukan sejuta penjumlahan. **Bilangannya menjadi panjang.** $F_n$ memiliki $\lfloor n\log_{10}\varphi-\log_{10}\sqrt5\rfloor+1$ angka, sekitar $0{,}209\,n$: $F_{100}$ memiliki $21$, $F_{1000}$ memiliki $209$, $F_{10^5}$ memiliki $20\,899$ dan $F_{10^6}$ memiliki $208\,988$. Jadi satu penjumlahan bukan satu langkah melainkan sekitar $0{,}2\,n$ operasi angka, dan perulangan sebenarnya berbiaya sekitar $n^2$ operasi angka. Penggandaan cepat juga menang di sini, karena ia mengalikan beberapa bilangan yang sangat panjang. Perhatikan pula bahwa bilangan bulat berukuran tetap meluap lebih awal: bilangan bulat bertanda 32-bit berhenti di $F_{46}=1\,836\,311\,903$ dan sebuah double berhenti eksak di $F_{78}$ (lihat [bilangan biner](https://nunada.my.id/artikel/bilangan-biner/#binary-arithmetic)). Geser $n$ di bawah untuk membandingkan keempat cara dan membaca angka pertama dan terakhir dari jawaban eksak. ## Bagaimana menuliskan bilangan sebagai jumlah bilangan Fibonacci? **Teorema Zeckendorf berkata bahwa setiap bilangan bulat positif adalah jumlah bilangan Fibonacci dari $1,2,3,5,8,13,\ldots$ dengan tepat satu cara bila tidak ada dua di antaranya yang boleh bertetangga dalam daftar itu.** Misalnya $$100=89+8+3=F_{11}+F_6+F_4,\qquad 12=8+3+1,\qquad 4=3+1.$$ (Daftar dimulai dari $F_2=1$, karena $F_1$ adalah bilangan yang sama.) Bila aturan tanpa tetangga dibuang, bilangan yang sama biasanya memiliki beberapa jumlah: $100$ dapat ditulis dalam $9$ cara dengan bilangan Fibonacci berbeda, seperti $89+8+3$ dan $55+34+8+3$, dan hanya satu yang tanpa tetangga. **Metode rakus menemukannya.** Ambil bilangan Fibonacci terbesar yang tidak melebihi $N$, kurangkan, dan ulangi pada sisanya. Sisanya lebih kecil daripada bilangan Fibonacci sebelumnya (jika tidak, yang lebih besar akan muat), sehingga suku berikutnya tidak pernah bertetangga dengan yang baru diambil. **Mengapa tunggal.** Jumlah teleskopik pada bagian identitas menunjukkan bahwa jumlah terbesar bilangan Fibonacci tak bertetangga di bawah $F_k$ adalah $F_{k-1}+F_{k-3}+F_{k-5}+\cdots=F_k-1$ (untuk $k=7$: $8+3+1=12=13-1$). Jadi jumlah tanpa tetangga untuk $N$ tidak dapat melewatkan bilangan Fibonacci terbesar $F_k\le N$: tanpanya jumlahnya paling banyak $F_k-1 { let a = 0n, b = 1n; for (let i = 0; i < n; i++) [a, b] = [b, a + b]; return a } fib(100) // 354224848179261915075n // fast doubling: F(2k) = F(k)(2F(k+1) - F(k)), F(2k+1) = F(k)^2 + F(k+1)^2 const pair = (n) => { if (n === 0n) return [0n, 1n] const [a, b] = pair(n >> 1n) const c = a * (2n * b - a), d = a * a + b * b return n & 1n ? [d, c + d] : [c, d] } pair(1000000n)[0].toString().length // 208988 // plain numbers stop being exact: the first b that is not a safe integer is wrong in its last digit let a = 0, b = 1, n = 0 while (Number.isSafeInteger(b)) { [a, b] = [b, a + b]; n++ } ;[n, a, b] // [78, 8944394323791464, 14472334024676220]; the true F(79) ends in ...221 // Binet in doubles const phi = (1 + Math.sqrt(5)) / 2 let k = 0 while (BigInt(Math.round(phi ** k / Math.sqrt(5))) === fib(k)) k++ k // 71 // F(n) mod m for a huge n const fibMod = (n, m) => { const go = (j) => { if (j === 0n) return [0n, 1n % m] const [x, y] = go(j >> 1n) const c = (x * ((2n * y - x) % m + m)) % m, d = (x * x + y * y) % m return j & 1n ? [d, (c + d) % m] : [c, d] } return go(n)[0] } ;[fibMod(10n ** 18n, 10n), fibMod(10n ** 18n, 1000000007n)] // [5n, 209783453n] ``` ```cpp #include #include using namespace std; int main() { int a = 0, b = 1; for (int i = 0; i < 40; i++) { int t = a + b; a = b; b = t; } printf("%d\n", a); // F(40); F(47) no longer fits in an int int ms[4] = {2, 5, 10, 100}; for (int k = 0; k < 4; k++) { int m = ms[k], x = 0, y = 1 % m, p = 0; do { int t = (x + y) % m; x = y; y = t; p++; } while (!(x == 0 && y == 1)); printf("%d %d\n", m, p); // the Pisano period } int u = 233, v = 144, steps = 0; // Euclid's algorithm on F(13) and F(12) while (v != 0) { int t = u % v; u = v; v = t; steps++; } printf("%d %d\n", u, steps); // gcd 1 after n - 1 = 11 divisions return 0; } /* output: 102334155 2 3 5 20 10 60 100 300 1 11 */ ``` ## Dari mana bilangan Fibonacci berasal? **Bilangan Fibonacci ditemukan di India sebagai hitungan irama puisi, berabad-abad sebelum kelinci Fibonacci.** - **Sekitar 200 SM.** Sarjana India Pingala, dalam karyanya tentang matra Sanskerta, menghitung pola suku kata pendek dan panjang, yang mengarah ke bilangan $1,2,3,5,8,\ldots$. - **Sekitar 700 dan 1150.** Virahanka menyatakan aturan bahwa setiap hitungan adalah jumlah dua hitungan sebelumnya, dan Hemachandra memberikannya lagi; Gopala telah melakukannya sekitar 1135. - **1202.** Leonardo dari Pisa, yang dikenal sebagai Fibonacci, menerbitkan Liber Abaci dengan soal kelinci dan suku-suku pertama sampai $377$. Buku itu terutama mengajarkan angka Hindu-Arab kepada orang Eropa. - **1730–1843.** Abraham de Moivre dan Leonhard Euler mengetahui rumus tertutupnya; Jacques Binet menerbitkannya pada 1843. - **1844.** Gabriel Lamé memakai bilangan Fibonacci untuk membatasi langkah algoritma Euclid. - **1870-an.** Édouard Lucas mempelajari barisan itu secara mendalam, memperkenalkan bilangan Lucas pendampingnya $2,1,3,4,7,11,\ldots$, memakainya untuk menguji apakah bilangan besar prima, dan menamai barisan itu Fibonacci. - **1939–1972.** Edouard Zeckendorf membuktikan teorema tentang jumlah bilangan Fibonacci (diterbitkan pada 1972, setelah makalah Gerrit Lekkerkerker tahun 1952). - **1963.** Fibonacci Association dan jurnalnya, Fibonacci Quarterly, didirikan. - **1970.** Yuri Matiyasevich memakai pertumbuhan eksponensial bilangan Fibonacci untuk melengkapi bukti bahwa masalah kesepuluh Hilbert, metode umum untuk menyelesaikan persamaan dalam bilangan bulat, tidak memiliki penyelesaian. ## Kesalahan apa yang sering terjadi pada bilangan Fibonacci? **Kesalahan paling umum pada bilangan Fibonacci adalah sembilan hal berikut, masing-masing dengan pernyataan yang benar.** | Kesalahan | Yang benar | |---|---| | ❌ Barisannya dimulai $1,2,3,5,\ldots$ | Ia dimulai $0,1,1,2,3,5$; sebagian buku mulai dari $F_1=F_2=1$, jadi nyatakan konvensinya sebelum memakai indeks. | | ❌ $\varphi^n/\sqrt5$ sama dengan $F_n$ | Ia berjarak kurang dari $\frac12$ dari $F_n$: bulatkan, dan dalam titik mengambang itu pun gagal mulai $n=71$. | | ❌ Rekursi baik-baik saja sampai $n=50$ | Ia membuat $2F_{51}-1\approx4\times10^{10}$ panggilan; pakai perulangan, memo, atau penggandaan cepat. | | ❌ Rekursi bermemo menangani $n$ mana pun | Batas bawaan Python sebesar $1000$ panggilan bersarang menghentikannya di sekitar $n=1000$; pakai perulangan. | | ❌ $F_n$ muat dalam bilangan bulat biasa | Bilangan bulat bertanda 32-bit berhenti di $F_{46}$, yang 64-bit di $F_{92}$, dan double hanya eksak sampai $F_{78}$. | | ❌ $\frac{F_{n+1}}{F_n}$ selalu di bawah $\varphi$ | Ia bergantian: di bawah untuk $n$ genap dan di atas untuk $n$ ganjil, dan makin dekat setiap kali. | | ❌ Bilangan Fibonacci ada di piramida, Parthenon, dan Mona Lisa | Klaim itu tidak didukung pengukuran; kemunculan yang nyata adalah filotaksis, algoritma Euclid, dan soal menghitung. | | ❌ Jumlah Zeckendorf boleh memakai dua bilangan Fibonacci bertetangga | Tidak ada dua yang bertetangga: rakus mengambil yang terbesar yang muat, sehingga $100=89+8+3$ dan bukan $55+34+8+3$, yang $55$ dan $34$-nya bertetangga. | | ❌ Angka terakhir bilangan Fibonacci tampak acak | Mereka berulang: angka terakhir setiap $60$ bilangan, dua angka terakhir setiap $300$ (periode Pisano). | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: bilangan Fibonacci sekilas - **Definisi:** $F_0=0$, $F_1=1$, $F_n=F_{n-1}+F_{n-2}$; $F_{n+1}$ menghitung cara menaiki $n$ anak tangga dengan langkah $1$ atau $2$. - **Binet:** $F_n=\frac{\varphi^n-\psi^n}{\sqrt5}$, bilangan bulat terdekat dengan $\frac{\varphi^n}{\sqrt5}$; perbandingan $\frac{F_{n+1}}{F_n}$ adalah $\varphi+\frac{\psi^n}{F_n}$; dalam double ia gagal pada $n=71$. - **Identitas:** $\sum F_k=F_{n+2}-1$, $\sum F_k^2=F_nF_{n+1}$, Cassini $(-1)^n$, penggandaan, $\gcd(F_m,F_n)=F_{\gcd(m,n)}$; semuanya mengikuti dari $Q=\begin{pmatrix}1&1\\1&0\end{pmatrix}$. - **Menghitung:** rekursi $2F_{n+1}-1$ panggilan, memo $2n-1$, perulangan $n-1$ penjumlahan, penggandaan cepat $3\lceil\log_2n\rceil$ perkalian; $F_n$ memiliki $0{,}209\,n$ angka. - **Zeckendorf:** setiap bilangan bulat positif adalah jumlah tunggal bilangan Fibonacci tak bertetangga, ditemukan secara rakus; kode Fibonacci dibangun di atasnya. - **Pisano:** $F_n\bmod m$ berulang dengan periode $\pi(m)\le6m$; $\pi(10)=60$, jadi reduksi $n$ lebih dulu. - **Alam dan algoritma:** sudut emas $137{,}5^\circ$ pada spiral biji, kasus terburuk Euclid; klaim piramida dan lukisan adalah mitos. - **Kode:** bilangan bulat besar, perulangan, penggandaan cepat, sisa pada setiap langkah. ## Glosarium: istilah penting - **Bilangan Fibonacci**: Suku barisan 0, 1, 1, 2, 3, 5, 8, 13, … yang setiap sukunya adalah jumlah dua suku sebelumnya. - **Rasio emas**: Bilangan 1 ditambah akar 5, dibagi 2, sekitar 1,618, limit perbandingan bilangan Fibonacci berurutan. - **Rumus Binet**: Bentuk tertutup bilangan Fibonacci ke-n sebagai selisih pangkat ke-n dari kedua akar x kuadrat sama dengan x tambah 1, dibagi akar 5. - **Identitas Cassini**: Identitas bahwa F(n−1) kali F(n+1) dikurangi F(n) kuadrat sama dengan minus 1 pangkat n. - **Penggandaan cepat**: Cara yang mendapatkan F(n) dengan sekitar log n perkalian bilangan besar dengan memperoleh F(2k) dan F(2k+1) dari F(k) dan F(k+1). - **Representasi Zeckendorf**: Cara tunggal menuliskan bilangan bulat positif sebagai jumlah bilangan Fibonacci yang tidak ada dua yang bertetangga dalam barisan. - **Periode Pisano**: Panjang siklus bilangan Fibonacci modulo m, ditulis pi dari m; untuk m sama dengan 10 nilainya 60. - **Filotaksis**: Susunan daun, biji, atau sisik pada tumbuhan, sering dalam spiral yang hitungannya adalah bilangan Fibonacci bertetangga. - **Bilangan Lucas**: Barisan pendamping 2, 1, 3, 4, 7, 11, … dengan rekurensi yang sama seperti bilangan Fibonacci tetapi nilai awal berbeda. ## Pertanyaan yang sering diajukan ### Apa itu barisan Fibonacci? Itu adalah barisan 0, 1, 1, 2, 3, 5, 8, 13, 21 dan seterusnya, yang setiap bilangannya adalah jumlah dua bilangan sebelumnya. Ia dimulai dari 0 dan 1 dan tumbuh dengan faktor sekitar 1,618 pada setiap langkah. ### Apa rumus untuk bilangan Fibonacci ke-n? Rumus Binet berkata ia adalah phi pangkat n dikurangi psi pangkat n, semuanya dibagi akar 5, dengan phi sekitar 1,618 dan psi sekitar minus 0,618. Membulatkan phi pangkat n per akar 5 memberi bilangan yang eksak. ### Bagaimana menghitung bilangan Fibonacci dengan cepat? Pakai perulangan yang menyimpan dua nilai terakhir untuk ukuran biasa, atau penggandaan cepat untuk yang sangat besar, yang hanya memerlukan sekitar log n perkalian bilangan besar. Rekursi biasa memerlukan waktu eksponensial karena mengulang panggilan yang sama. ### Mengapa perbandingan bilangan Fibonacci mendekati rasio emas? Karena F(n+1) dikurangi phi kali F(n) tepat sama dengan psi pangkat n, dan psi bernilai mutlak di bawah 1. Membaginya dengan F(n) menyisakan selisih yang menyusut cepat dan bergantian tanda di sekitar phi. ### Apa isi teorema Zeckendorf? Teorema ini berkata setiap bilangan bulat positif dapat ditulis tepat dengan satu cara sebagai jumlah bilangan Fibonacci yang tidak ada dua yang berurutan dalam barisan. Misalnya 100 adalah 89 ditambah 8 ditambah 3, ditemukan dengan berulang kali mengambil yang terbesar yang muat. ### Apa itu periode Pisano? Itu adalah panjang siklus bilangan Fibonacci modulo m. Untuk m sama dengan 10 nilainya 60, sehingga angka terakhir setiap bilangan Fibonacci berulang setiap 60 langkah, yang memungkinkan mencari sisa untuk indeks yang sangat besar. ### Apakah bilangan Fibonacci benar-benar ada di alam? Kadang-kadang. Spiral biji pada banyak bunga matahari, kerucut pinus, dan nanas dihitung dengan bilangan Fibonacci bertetangga, karena sudut emas sekitar 137,5 derajat. Klaim tentang piramida, lukisan, dan tubuh manusia kebanyakan mitos. ### Ada berapa cara menaiki n anak tangga dengan satu atau dua langkah? Ada F(n+1) cara: langkah terakhir adalah satu atau dua anak tangga, menyisakan n dikurangi 1 atau n dikurangi 2 anak tangga sebelumnya, sehingga hitungannya mengikuti aturan Fibonacci. Sepuluh anak tangga memberi 89 cara. --- # Binary Search and Sorting Source: https://nunada.my.id/articles/binary-search-and-sorting/ Updated: 2026-10-22 ## Quick answer **Binary search finds a value in a sorted list by looking at the middle element and throwing away the half that cannot contain it, so $n$ items need at most $\lfloor\log_2n\rfloor+1$ looks; sorting puts a list in order, and the good general-purpose algorithms (merge sort, quicksort, heapsort) use about $n\log_2n$ comparisons, against about $\frac{n^2}{2}$ for selection, insertion and bubble sort.** A thousand sorted numbers take at most $10$ looks to search. Sorting a thousand numbers takes roughly $10\,000$ comparisons with a good algorithm and $500\,000$ with a simple one. ### Key takeaways - Binary search needs a sorted list. Each look at the middle discards half of what is left, so $1000$ items need at most $10$ looks, $10^9$ items $30$, and all eight billion people on Earth $33$. - With duplicates, ask for a position, not just a match: the lower bound is the first index with $a[i]\ge x$ and the upper bound the first with $a[i]>x$. Their difference counts the copies of $x$. Python calls them `bisect_left` and `bisect_right`; C++ `lower_bound` and `upper_bound`. - Binary search also works on an answer: any yes-or-no question that is false up to a threshold and true after it. The integer square root of a number below $10^{12}$ takes $40$ tests, and bisection traps a root of $f(x)=0$ one binary digit per step. - Selection, insertion and bubble sort take about $n^2$ steps. Insertion and bubble sort make exactly as many moves as the list has inversions (pairs in the wrong order): $0$ when sorted, $\frac{n(n-1)}{2}$ when reversed, about $\frac{n(n-1)}{4}$ on average. - Merge sort uses at most $n\lceil\log_2n\rceil$ comparisons and $n$ extra cells, and is stable. Quicksort averages $2(n+1)H_n-4n\approx1.39\,n\log_2n$ comparisons but needs $\frac{n(n-1)}{2}$ when its pivots are always extreme. No comparison sort can beat $\log_2(n!)\approx n\log_2n-1.44n$. - Real libraries use hybrids (Timsort in Python and for Java objects, introsort in C++). Ask for a stable sort when you sort by several keys in turn, and remember that JavaScript's `[10, 9, 1].sort()` compares text and gives `[1, 10, 9]`. ## How does binary search find a value? **Binary search looks at the middle element of a sorted list: if it is the target the search is over; if the target is larger, everything to the left is out; if smaller, everything to the right is out. Repeat on the half that is left.** It is the game "I am thinking of a number from 1 to 1000" played well: guess $500$, hear "higher", guess $750$, and so on. Nobody needs more than $10$ guesses. **The algorithm.** Keep two indices, `lo` and `hi`, with the promise (the invariant) that if the target is in the list, its index is between `lo` and `hi`, ends included. Start with `lo = 0` and `hi = n - 1`. While `lo <= hi`: look at `mid`, the middle index; if `a[mid]` equals the target, return `mid`; if it is smaller, set `lo = mid + 1`; otherwise set `hi = mid - 1`. If the interval becomes empty, the target is not there. **Why it is correct.** The invariant is true at the start. A look at `mid` rules out `mid` itself and one whole side: if $a[mid]n$. So the number of looks is at most $$\lfloor\log_2n\rfloor+1.$$ That is $10$ for $1000$ items, $20$ for a million, $30$ for a billion and $33$ for eight billion: each doubling of the list costs one more look. A linear scan of the same list could need $n$ looks ([Big-O notation](https://nunada.my.id/articles/big-o-notation/#cases) explains the cases). Type a list and a target below and step through the search. The orange cell is the one being looked at, the faint cells are already ruled out, and the green cell is the answer. ## How do you find the first match and avoid off-by-one errors? **Use one template for every question about position: keep a half-open interval of indices `lo <= i < hi` in which everything before `lo` is known to be too small and everything from `hi` on is known to be large enough.** With duplicates, "find $x$" has no single answer, but "the first index with $a[i]\ge x$" always does. In the list $[1,3,3,5,7,7,7,9,12]$: | Question | Name | $x=7$ | $x=4$ | $x=100$ | |---|---|---|---|---| | first index with $a[i]\ge x$ | lower bound (`bisect_left`) | $4$ | $3$ | $9$ | | first index with $a[i]>x$ | upper bound (`bisect_right`) | $7$ | $3$ | $9$ | The upper bound minus the lower bound is the number of copies of $x$: $7-4=3$. When $x$ is absent the lower bound is the insertion point, the index where $x$ would go to keep the list sorted, and it may be $n$ (past the end). **The template.** Start with `lo = 0`, `hi = n` (one past the last index). While `lo < hi`: take `mid = lo + (hi - lo) // 2`; if `a[mid] < x` then `lo = mid + 1` (the lower bound is to the right of `mid`), else `hi = mid` (`mid` may be the answer, so keep it). When the loop ends, `lo == hi` is the answer. For the upper bound, change the test to `a[mid] <= x`. The invariant is the whole proof: everything before `lo` is $a[j]$. The list $[5,2,4,6,1,3]$ has $9$: $(5,2)$, $(5,4)$, $(5,1)$, $(5,3)$, $(2,1)$, $(4,1)$, $(4,3)$, $(6,1)$ and $(6,3)$. A sorted list has $0$ and a reversed one has $\frac{n(n-1)}{2}$, every pair; a random list has about half of that, $\frac{n(n-1)}{4}$. Swapping two neighbors that are out of order removes exactly one inversion, and so does one shift of insertion sort. So **bubble sort makes exactly as many swaps, and insertion sort exactly as many shifts, as the list has inversions**, and any method that only moves neighbors needs about $\frac{n^2}{4}$ steps on a random list. To go faster, a sort must move elements across long distances: that is what merge sort and quicksort do. Choose an algorithm and an input below and play the bars. Gold bars are being compared, red ones are moving, and green ones are in their final place. ## How does merge sort sort in n log n steps? **Merge sort splits the list in half, sorts each half the same way, and then merges the two sorted halves into one.** Merging is the easy part: two sorted lists have their smallest elements at the front, so compare the two fronts, move the smaller to the output, and repeat. Merging lists of total length $n$ takes at most $n-1$ comparisons and exactly $n$ writes. The recursion halves the list until single elements (already sorted) remain, so there are $\lceil\log_2n\rceil$ levels, and each level merges all $n$ elements once. That is $n$ writes per level and a total of about $n\log_2n$. The recurrence is $T(n)=2T(n/2)+n$, solved in [the section on recurrences](https://nunada.my.id/articles/big-o-notation/#recurrences). In exact numbers: - **writes:** $8$ numbers need $24=8\cdot3$, and $1000$ need $9976$; - **comparisons, worst case:** $n\lceil\log_2n\rceil-2^{\lceil\log_2n\rceil}+1$, which is $17$ for $8$ numbers and $8977$ for $1000$; - **comparisons, already sorted:** about half as many, since one list runs out first: $12$ for $8$ numbers. **Properties.** Merge sort needs $O(n)$ extra memory for the merged output, it is stable (if two elements are equal, take the one from the left half first, which is the `<=` in the code below), and its cost barely depends on the input. It is the natural choice for linked lists and for data on disk or tape, which are read in order; it was the first computer sort, programmed by John von Neumann in 1945. ## How does quicksort work, and when is it slow? **Quicksort picks a pivot, moves the smaller elements before it and the others after it, and then sorts the two sides the same way.** After the partition the pivot is already in its final place. The partition of Nico Lomuto, used in the code below, takes the last element as the pivot and sweeps from left to right keeping a boundary `p`: every element smaller than the pivot is swapped to the boundary, which moves one step right. Tony Hoare's original partition uses two pointers moving toward each other and does fewer swaps. **What it costs.** A partition of $m$ elements makes $m-1$ comparisons. If the pivot splits the range roughly in half every time there are about $\log_2n$ levels of about $n$ comparisons each. If the pivot is always the smallest or the largest element, the two sides have sizes $0$ and $m-1$ and the total is $$(n-1)+(n-2)+\cdots+1=\frac{n(n-1)}{2},$$ quadratic. With the last element as the pivot this happens on an already sorted or reversed list, which is exactly the input people give. On a random list the average is $$2(n+1)H_n-4n\approx2n\ln n\approx1.39\,n\log_2n,$$ where $H_n=1+\frac12+\cdots+\frac1n$. For $1000$ elements that is about $10\,986$ comparisons (against at most $8977$ for merge sort), and the chance of a very bad run is tiny. **What real implementations do.** - **Choose the pivot well:** a random element, or the median of the first, middle and last. - **Handle equal keys:** a three-way partition (smaller, equal, larger) keeps a list of few distinct values from slowing down. - **Bound the damage:** introsort (David Musser, 1997) switches to heapsort if the recursion gets too deep, so the worst case is $O(n\log n)$; it is behind C++'s `std::sort`. Recursing into the smaller side first keeps the stack at $O(\log n)$. - **Quicksort is not stable**, and it sorts in place, with no extra array. Cache-friendly sweeps make it faster than merge sort on arrays in practice, in spite of the extra comparisons. The sorting race below runs all six algorithms on the same input and counts comparisons and moves. ## Which sorting algorithm should you use? **In practice, call the sort of your language: it is a tuned hybrid, and it is almost always faster and more correct than anything you will write.** Know what it promises, though. | Algorithm | Best | Average | Worst | Extra memory | Stable | |---|---|---|---|---|---| | selection | $n^2$ | $n^2$ | $n^2$ | $O(1)$ | no | | insertion | $n$ | $n^2$ | $n^2$ | $O(1)$ | yes | | bubble | $n$ | $n^2$ | $n^2$ | $O(1)$ | yes | | merge | $n\log n$ | $n\log n$ | $n\log n$ | $O(n)$ | yes | | quick | $n\log n$ | $n\log n$ | $n^2$ | $O(\log n)$ | no | | heap | $n\log n$ | $n\log n$ | $n\log n$ | $O(1)$ | no | Three properties decide the choice. **Stable**: equal keys keep their original order, which lets you sort by several keys in turn (sort by name, then stably by city, and each city is still in name order). **In place**: only $O(1)$ or $O(\log n)$ extra memory. **Adaptive**: faster on nearly sorted input, like insertion sort. Heapsort builds a max-heap in the array, then repeatedly swaps the largest to the end and repairs the heap: in place and $O(n\log n)$ in the worst case, but not stable and not cache friendly. **A limit and a way around it.** Any sort that only compares elements needs at least $\log_2(n!)\approx n\log_2n-1.44n$ comparisons, because the $n!$ possible orders must be told apart by yes-or-no answers (the idea of the lower bound in [the section on cases](https://nunada.my.id/articles/big-o-notation/#cases)). For $1000$ elements that is $8530$ comparisons, and merge sort's worst case, $8977$, is within about 5 percent of it. Sorts that do not compare can be faster: counting sort counts how many times each value occurs ($O(n+k)$ for values below $k$), and radix sort sorts digit by digit with a stable sort, which is how punched-card sorters worked. **What the libraries do.** - **Python:** `sorted(a)` returns a new list and `a.sort()` sorts in place and returns `None`. Both use Timsort (Tim Peters, 2002): it finds runs that are already ordered, extends short runs with insertion sort and merges runs, so it is stable, $O(n\log n)$ and $O(n)$ on sorted input. - **JavaScript:** `array.sort()` is stable since 2019, but without a comparator it compares the elements as text, so `[10, 9, 1].sort()` gives `[1, 10, 9]`. Always write `(a, b) => a - b` for numbers. - **Java:** Timsort for objects, a dual-pivot quicksort for arrays of numbers. **C++:** `std::sort` (introsort, not stable) and `std::stable_sort`. ## How do you search and sort in Python, JavaScript and C++? **Write the binary search once with the half-open template and reuse it; in Python the standard library already has it as `bisect`.** The first program below has the lower bound, the closed-interval search that counts its looks, the integer square root by searching the answer, and a comparison with `bisect_left` and `bisect_right`. The second program has insertion sort (counting its shifts), merge sort, quicksort (counting its comparisons) and a stable sort by key. The two numbers $9$ and $9$ in the output are the inversions of $[5,2,4,6,1,3]$ and the shifts of insertion sort: they are equal. ```python from bisect import bisect_left, bisect_right def lower_bound(a, x): """The first index i with a[i] >= x, in the half-open form [lo, hi).""" lo, hi = 0, len(a) while lo < hi: mid = lo + (hi - lo) // 2 # never (lo + hi) // 2 with fixed-size integers if a[mid] < x: lo = mid + 1 # everything up to mid is too small else: hi = mid # mid itself might be the answer return lo def find(a, x): """An index holding x (or -1) and the number of looks, in the closed form [lo, hi].""" lo, hi, looks = 0, len(a) - 1, 0 while lo <= hi: looks += 1 mid = lo + (hi - lo) // 2 if a[mid] == x: return mid, looks if a[mid] < x: lo = mid + 1 else: hi = mid - 1 return -1, looks def isqrt(n): """The largest r with r * r <= n: a binary search on the answer, no list needed.""" lo, hi = 0, n while lo < hi: mid = lo + (hi - lo + 1) // 2 # round up, so that lo = mid always makes progress if mid * mid <= n: lo = mid else: hi = mid - 1 return lo a = [1, 3, 3, 5, 7, 7, 7, 9, 12] print(lower_bound(a, 7), bisect_left(a, 7), bisect_right(a, 7)) print(bisect_right(a, 7) - bisect_left(a, 7), lower_bound(a, 4), lower_bound(a, 100)) print(find(a, 5), find(a, 8)) print(isqrt(99), isqrt(100), isqrt(10 ** 12)) big = list(range(0, 2_000_000, 2)) # a million even numbers print(find(big, 777_776), find(big, 777_777)) # 4 4 7 # 3 3 9 # (3, 4) (-1, 3) # 9 10 1000000 # (388888, 19) (-1, 20) ``` ```python def insertion(a): """Insertion sort; returns the sorted list and the number of shifts.""" a, shifts = list(a), 0 for i in range(1, len(a)): x, j = a[i], i - 1 while j >= 0 and a[j] > x: a[j + 1] = a[j] shifts += 1 j -= 1 a[j + 1] = x return a, shifts def merge_sort(a): if len(a) <= 1: return a mid = (len(a) + 1) // 2 left, right = merge_sort(a[:mid]), merge_sort(a[mid:]) out, i, j = [], 0, 0 while i < len(left) and j < len(right): if left[i] <= right[j]: # <= keeps equal keys in order: the sort is stable out.append(left[i]); i += 1 else: out.append(right[j]); j += 1 return out + left[i:] + right[j:] def quicksort(a, lo=0, hi=None): """In place, Lomuto partition, last element as the pivot. Returns the comparisons made.""" if hi is None: hi = len(a) - 1 if lo >= hi: return 0 p, count = lo, 0 for j in range(lo, hi): count += 1 if a[j] < a[hi]: a[p], a[j] = a[j], a[p] p += 1 a[p], a[hi] = a[hi], a[p] return count + quicksort(a, lo, p - 1) + quicksort(a, p + 1, hi) def inversions(a): return sum(a[i] > a[j] for i in range(len(a)) for j in range(i + 1, len(a))) x = [5, 2, 4, 6, 1, 3] print(insertion(x), inversions(x)) print(merge_sort(x)) n = 200 print(quicksort(list(range(n))), n * (n - 1) // 2) # sorted input: the worst case data = [(i * 73) % n for i in range(n)] # a scrambled permutation of 0..199 print(quicksort(data), data == sorted(range(n))) people = [("Ana", 30), ("Budi", 25), ("Citra", 30), ("Dewi", 25)] print(sorted(people, key=lambda p: p[1])) # stable: Budi stays before Dewi # ([1, 2, 3, 4, 5, 6], 9) 9 # [1, 2, 3, 4, 5, 6] # 19900 19900 # 1409 True # [('Budi', 25), ('Dewi', 25), ('Ana', 30), ('Citra', 30)] ``` ```javascript ;[10, 9, 1, 100].sort() // [1, 10, 100, 9]: no comparator means text order ;[10, 9, 1, 100].sort((a, b) => a - b) // [1, 9, 10, 100] const lowerBound = (a, x) => { let lo = 0, hi = a.length while (lo < hi) { const mid = lo + ((hi - lo) >> 1) // not (lo + hi) >> 1: see below if (a[mid] < x) lo = mid + 1 else hi = mid } return lo } const a = [1, 3, 3, 5, 7, 7, 7, 9, 12] ;[7, 8, 100].map((x) => lowerBound(a, x)) // [4, 7, 9] ;(1500000000 + 2000000000) >> 1 // -397483648: the sum overflowed 32 bits 1500000000 + ((2000000000 - 1500000000) >> 1) // 1750000000 // bisection: halve a bracket on which f changes sign (60 would be enough for any bracket of doubles) const f = (x) => x * x - 2 let lo = 1, hi = 2 for (let k = 0; k < 50; k++) { const mid = (lo + hi) / 2 if (f(mid) * f(lo) <= 0) hi = mid else lo = mid } ;[lo, hi, hi - lo] // [1.414213562373095, 1.4142135623730958, 8.88e-16] ``` ```cpp #include #include using namespace std; int lowerBound(int a[], int n, int x) { int lo = 0, hi = n; while (lo < hi) { int mid = lo + (hi - lo) / 2; // not (lo + hi) / 2: it can overflow if (a[mid] < x) lo = mid + 1; else hi = mid; } return lo; } int main() { int a[6] = {5, 2, 4, 6, 1, 3}; int shifts = 0; for (int i = 1; i < 6; i++) { int x = a[i], j = i - 1; while (j >= 0 && a[j] > x) { a[j + 1] = a[j]; shifts++; j--; } a[j + 1] = x; } for (int i = 0; i < 6; i++) printf("%d ", a[i]); printf("\n%d\n", shifts); // 9: the number of inversions int b[9] = {1, 3, 3, 5, 7, 7, 7, 9, 12}; printf("%d %d %d\n", lowerBound(b, 9, 7), lowerBound(b, 9, 8), lowerBound(b, 9, 100)); return 0; } /* output: 1 2 3 4 5 6 9 4 7 9 */ ``` ## Where do binary search and sorting come from? **Sorting is older than computers, because the machines of the census and the bank needed it, and binary search turned out to be famously easy to get wrong.** - **1890s–1900s.** Herman Hollerith's punched-card machines tabulated the 1890 United States census, and the card sorters that followed sorted by one column at a time, the idea of radix sort. - **1945.** John von Neumann wrote merge sort for the EDVAC, the first sorting program for a stored-program computer. - **1946.** John Mauchly described binary search in a lecture series on computing at the Moore School; it is the earliest published description. - **1959.** Donald Shell published Shellsort, the first sort known to beat $n^2$ by comparing elements far apart. In the same year Tony Hoare invented quicksort, working in Moscow on machine translation; he published it in 1961. - **1962.** By Knuth's account, the first published binary search that is correct for every length of list appeared, sixteen years after the first. - **1964.** J. W. J. Williams published heapsort, and Robert Floyd soon showed how to build the heap in linear time. - **1997.** David Musser designed introsort, the quicksort that cannot degrade. - **2002.** Tim Peters wrote Timsort for Python, and it later spread to Java, Android and JavaScript engines. - **2006.** Joshua Bloch showed that the middle computed as `(lo + hi) / 2` in the Java library's binary search and merge sort could overflow for lists of more than $2^{30}$ elements. ## What mistakes do people make with searching and sorting? **The most common mistakes with binary search and sorting are the nine below, each with the correct statement.** | Mistake | Correct | |---|---| | ❌ Binary search works on any list | The list must be sorted, and indexing must be $O(1)$; on unsorted data the answer is simply wrong. | | ❌ `mid = (lo + hi) / 2` is always safe | With fixed-size integers the sum can overflow; write `mid = lo + (hi - lo) / 2`. | | ❌ Use `hi = mid - 1` with `while lo < hi` | Mixing the closed and half-open conventions skips answers or loops forever; choose one and state the invariant. | | ❌ Binary search returns the first match | It returns a match; for the first one use the lower bound (`bisect_left`). | | ❌ Bisect reals until `hi - lo < 1e-18` | Doubles near $1$ are $2.2\times10^{-16}$ apart, so the loop may never end; count iterations or compare `mid` with the ends. | | ❌ Bubble or insertion sort is fine for a million items | About $\frac{n^2}{2}=5\times10^{11}$ steps; they suit lists of a few dozen or nearly sorted ones. | | ❌ Quicksort is always $O(n\log n)$ | Its worst case is $n^2$, and with the last element as pivot a sorted list is the worst case. | | ❌ Two sorts in a row sort by two keys | Only stable sorts keep the first order among equals: sort by the less important key first, or sort by a tuple. | | ❌ `[10, 9, 1].sort()` sorts numbers | JavaScript sorts as text and gives `[1, 10, 9]`; pass `(a, b) => a - b`. | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: binary search and sorting at a glance - **Binary search:** sorted list, look at the middle, discard half; at most $\lfloor\log_2n\rfloor+1$ looks. - **Position questions:** the half-open template gives the lower bound (first $a[i]\ge x$); change `<` to `<=` for the upper bound; the difference counts copies. - **Bugs:** keep one convention with its invariant, and use `lo + (hi - lo) / 2`. - **Search the answer:** any monotone yes-or-no question; integer roots in $\log_2N$ tests; bisection gains one binary digit per step and cannot fail. - **Simple sorts:** about $\frac{n^2}{2}$ steps; bubble and insertion sort move exactly as many times as there are inversions. - **Merge sort:** at most $n\lceil\log_2n\rceil$ comparisons, $O(n)$ extra memory, stable. **Quicksort:** $\approx1.39\,n\log_2n$ on average, $\frac{n(n-1)}{2}$ for extreme pivots, in place, not stable. - **Limits:** a comparison sort needs $\log_2(n!)\approx n\log_2n-1.44n$ comparisons; counting and radix sort avoid comparing. - **In practice:** use the library sort (Timsort, introsort), a stable one for several keys, and a comparator for numbers in JavaScript. ## Glossary: key terms - **Binary search**: A search in a sorted list that looks at the middle element and discards the half that cannot contain the target. - **Invariant**: A statement that is true before and after every step of a loop, from which the correctness of the loop is proved. - **Lower bound (position)**: The first index whose element is at least x; for an absent x it is the insertion point that keeps the list sorted. - **Bisection method**: A way to find a root of a continuous function by repeatedly halving an interval on whose ends the function has opposite signs. - **Inversion**: A pair of positions in a list where the earlier element is larger than the later one; a sorted list has none. - **Stable sort**: A sort that keeps elements with equal keys in the order they had before sorting. - **In-place sort**: A sort that rearranges the list using only a small amount of extra memory. - **Pivot**: The element quicksort chooses so that smaller elements are moved before it and the others after it. - **Comparison sort**: A sort that learns the order only by comparing two elements at a time, and so needs about n log n comparisons. - **Timsort**: The stable hybrid of merge sort and insertion sort used by Python and by Java for objects, fast on data that is partly ordered. ## Frequently asked questions ### How does binary search work? It compares the target with the middle element of a sorted list. If they are equal it is done; if the target is larger it continues in the right half, otherwise in the left half. Each step halves the list, so a thousand items need at most ten steps. ### Does binary search work on an unsorted list? No. It throws away half of the list after one comparison, and that is only safe when the order tells you which half cannot hold the target. On unsorted data it can miss a value that is present, so sort first or scan linearly. ### How do you avoid overflow and off-by-one errors in binary search? Compute the middle as lo plus half of hi minus lo, so the sum of two large indices never overflows. Pick either a closed interval or a half-open one, use the matching loop condition and updates, and write the invariant as a comment. ### What is the difference between bisect_left and bisect_right? Both return an insertion point in a sorted list. With duplicates, bisect_left returns the index before the copies of the value and bisect_right the index after them, so their difference is how many copies there are. ### What is the fastest sorting algorithm? There is none for every input. Comparison sorts cannot beat about n log n comparisons, and among them quicksort is usually fastest on arrays and merge sort on linked lists. Counting and radix sort can beat that when the keys are small integers. ### What is the difference between quicksort and merge sort? Merge sort splits blindly in half and does its work while merging; it is stable, always n log n, and needs extra memory. Quicksort does its work while partitioning around a pivot; it sorts in place, but is not stable and can reach n squared. ### What is a stable sort and why does it matter? A stable sort keeps items with equal keys in their original order. It matters when you sort by one key and want an earlier ordering to survive among ties, for instance sorting people by city while keeping each city sorted by name. ### Why does JavaScript sort 10 before 9? Without a comparison function, sort converts the elements to text and compares them letter by letter, and "10" comes before "9" because the character 1 comes before 9. Pass a function such as a minus b to sort numbers by value. --- # Pencarian Biner dan Pengurutan Source: https://nunada.my.id/artikel/pencarian-biner-dan-pengurutan/ Updated: 2026-10-22 ## Jawaban singkat **Pencarian biner menemukan sebuah nilai dalam daftar terurut dengan melihat elemen tengah dan membuang separuh yang tidak mungkin memuatnya, sehingga $n$ elemen memerlukan paling banyak $\lfloor\log_2n\rfloor+1$ kali melihat; pengurutan menyusun daftar menurut urutan, dan algoritma serbaguna yang baik (merge sort, quicksort, heapsort) memakai sekitar $n\log_2n$ perbandingan, dibandingkan sekitar $\frac{n^2}{2}$ untuk selection, insertion, dan bubble sort.** Seribu bilangan terurut memerlukan paling banyak $10$ kali melihat untuk dicari. Mengurutkan seribu bilangan memerlukan kira-kira $10\,000$ perbandingan dengan algoritma yang baik dan $500\,000$ dengan yang sederhana. ### Poin penting - Pencarian biner memerlukan daftar terurut. Setiap melihat bagian tengah membuang separuh sisanya, sehingga $1000$ elemen memerlukan paling banyak $10$ kali melihat, $10^9$ elemen $30$, dan seluruh delapan miliar penduduk Bumi $33$. - Dengan nilai kembar, tanyakan sebuah posisi, bukan sekadar kecocokan: batas bawah adalah indeks pertama dengan $a[i]\ge x$ dan batas atas yang pertama dengan $a[i]>x$. Selisihnya menghitung salinan $x$. Python menamainya `bisect_left` dan `bisect_right`; C++ `lower_bound` dan `upper_bound`. - Pencarian biner juga bekerja pada sebuah jawaban: pertanyaan ya atau tidak apa pun yang salah sampai suatu ambang dan benar sesudahnya. Akar kuadrat bulat bilangan di bawah $10^{12}$ memerlukan $40$ pengujian, dan bisection menjebak akar $f(x)=0$ satu angka biner per langkah. - Selection, insertion, dan bubble sort memerlukan sekitar $n^2$ langkah. Insertion dan bubble sort membuat perpindahan sebanyak inversi dalam daftar (pasangan yang salah urutan): $0$ bila terurut, $\frac{n(n-1)}{2}$ bila terbalik, rata-rata sekitar $\frac{n(n-1)}{4}$. - Merge sort memakai paling banyak $n\lceil\log_2n\rceil$ perbandingan dan $n$ sel tambahan, dan stabil. Quicksort rata-rata $2(n+1)H_n-4n\approx1{,}39\,n\log_2n$ perbandingan tetapi memerlukan $\frac{n(n-1)}{2}$ bila pivotnya selalu ekstrem. Tidak ada pengurutan perbandingan yang mengalahkan $\log_2(n!)\approx n\log_2n-1{,}44n$. - Pustaka sungguhan memakai hibrida (Timsort di Python dan untuk objek Java, introsort di C++). Minta pengurutan stabil ketika mengurutkan menurut beberapa kunci berturut-turut, dan ingat bahwa `[10, 9, 1].sort()` di JavaScript membandingkan teks dan menghasilkan `[1, 10, 9]`. ## Bagaimana pencarian biner menemukan sebuah nilai? **Pencarian biner melihat elemen tengah daftar terurut: jika itu target, pencarian selesai; jika target lebih besar, semua di kiri gugur; jika lebih kecil, semua di kanan gugur. Ulangi pada separuh yang tersisa.** Ia adalah permainan "aku memikirkan bilangan dari 1 sampai 1000" yang dimainkan dengan baik: tebak $500$, dengar "lebih besar", tebak $750$, dan seterusnya. Tak seorang pun memerlukan lebih dari $10$ tebakan. **Algoritmanya.** Simpan dua indeks, `lo` dan `hi`, dengan janji (invarian) bahwa jika target ada dalam daftar, indeksnya berada di antara `lo` dan `hi`, ujung-ujungnya termasuk. Mulai dengan `lo = 0` dan `hi = n - 1`. Selama `lo <= hi`: lihat `mid`, indeks tengah; jika `a[mid]` sama dengan target, kembalikan `mid`; jika lebih kecil, setel `lo = mid + 1`; jika tidak, setel `hi = mid - 1`. Jika selangnya menjadi kosong, target tidak ada. **Mengapa benar.** Invarian benar di awal. Melihat `mid` menggugurkan `mid` sendiri dan satu sisi utuh: jika $a[mid]n$. Jadi banyaknya melihat paling banyak $$\lfloor\log_2n\rfloor+1.$$ Itu $10$ untuk $1000$ elemen, $20$ untuk sejuta, $30$ untuk semiliar, dan $33$ untuk delapan miliar: setiap penggandaan daftar hanya menambah satu kali melihat. Pemindaian linear atas daftar yang sama dapat memerlukan $n$ kali ([Notasi Big-O](https://nunada.my.id/artikel/notasi-big-o/#cases) menjelaskan kasus-kasusnya). Ketik daftar dan target di bawah lalu telusuri pencariannya. Sel oranye adalah yang sedang dilihat, sel pudar sudah gugur, dan sel hijau adalah jawabannya. ## Bagaimana menemukan kecocokan pertama dan menghindari galat selisih satu? **Pakai satu templat untuk setiap pertanyaan tentang posisi: simpan selang indeks setengah terbuka `lo <= i < hi` yang di dalamnya semua yang sebelum `lo` diketahui terlalu kecil dan semua dari `hi` ke belakang diketahui cukup besar.** Dengan nilai kembar, "cari $x$" tidak punya jawaban tunggal, tetapi "indeks pertama dengan $a[i]\ge x$" selalu punya. Pada daftar $[1,3,3,5,7,7,7,9,12]$: | Pertanyaan | Nama | $x=7$ | $x=4$ | $x=100$ | |---|---|---|---|---| | indeks pertama dengan $a[i]\ge x$ | batas bawah (`bisect_left`) | $4$ | $3$ | $9$ | | indeks pertama dengan $a[i]>x$ | batas atas (`bisect_right`) | $7$ | $3$ | $9$ | Batas atas dikurangi batas bawah adalah banyaknya salinan $x$: $7-4=3$. Bila $x$ tidak ada, batas bawah adalah titik sisip, indeks tempat $x$ akan ditaruh agar daftar tetap terurut, dan ia bisa bernilai $n$ (melewati ujung). **Templatnya.** Mulai dengan `lo = 0`, `hi = n` (satu setelah indeks terakhir). Selama `lo < hi`: ambil `mid = lo + (hi - lo) // 2`; jika `a[mid] < x` maka `lo = mid + 1` (batas bawah ada di kanan `mid`), jika tidak `hi = mid` (`mid` mungkin jawabannya, jadi simpan). Ketika perulangan berakhir, `lo == hi` adalah jawabannya. Untuk batas atas, ubah ujinya menjadi `a[mid] <= x`. Invarian adalah seluruh buktinya: semua sebelum `lo` bernilai $a[j]$. Daftar $[5,2,4,6,1,3]$ memiliki $9$: $(5,2)$, $(5,4)$, $(5,1)$, $(5,3)$, $(2,1)$, $(4,1)$, $(4,3)$, $(6,1)$, dan $(6,3)$. Daftar terurut memiliki $0$ dan daftar terbalik memiliki $\frac{n(n-1)}{2}$, semua pasangan; daftar acak memiliki sekitar setengahnya, $\frac{n(n-1)}{4}$. Menukar dua tetangga yang salah urutan menghilangkan tepat satu inversi, demikian pula satu geseran insertion sort. Jadi **bubble sort membuat pertukaran sebanyak inversi, dan insertion sort geseran sebanyak inversi, tepat**, dan metode apa pun yang hanya memindahkan tetangga memerlukan sekitar $\frac{n^2}{4}$ langkah pada daftar acak. Agar lebih cepat, pengurutan harus memindahkan elemen melintasi jarak jauh: itulah yang dilakukan merge sort dan quicksort. Pilih algoritma dan masukan di bawah lalu putar batangnya. Batang emas sedang dibandingkan, yang merah sedang pindah, dan yang hijau sudah di tempat akhirnya. ## Bagaimana merge sort mengurutkan dalam n log n langkah? **Merge sort membagi daftar menjadi dua, mengurutkan setiap separuh dengan cara yang sama, lalu menggabungkan kedua separuh terurut itu menjadi satu.** Penggabungan adalah bagian yang mudah: dua daftar terurut memiliki elemen terkecilnya di depan, jadi bandingkan kedua depan itu, pindahkan yang lebih kecil ke keluaran, dan ulangi. Menggabungkan daftar dengan panjang total $n$ memerlukan paling banyak $n-1$ perbandingan dan tepat $n$ penulisan. Rekursinya membagi dua daftar sampai tersisa elemen tunggal (yang sudah terurut), sehingga ada $\lceil\log_2n\rceil$ tingkat, dan setiap tingkat menggabungkan semua $n$ elemen sekali. Itu $n$ penulisan per tingkat dan totalnya sekitar $n\log_2n$. Rekurensinya $T(n)=2T(n/2)+n$, diselesaikan pada [bagian tentang rekurensi](https://nunada.my.id/artikel/notasi-big-o/#recurrences). Dalam angka eksak: - **penulisan:** $8$ bilangan memerlukan $24=8\cdot3$, dan $1000$ memerlukan $9976$; - **perbandingan, kasus terburuk:** $n\lceil\log_2n\rceil-2^{\lceil\log_2n\rceil}+1$, yaitu $17$ untuk $8$ bilangan dan $8977$ untuk $1000$; - **perbandingan, sudah terurut:** sekitar setengahnya, karena satu daftar habis lebih dulu: $12$ untuk $8$ bilangan. **Sifat-sifatnya.** Merge sort memerlukan memori tambahan $O(n)$ untuk keluaran gabungan, ia stabil (jika dua elemen sama, ambil yang dari separuh kiri lebih dulu, yaitu `<=` dalam kode di bawah), dan biayanya hampir tidak bergantung pada masukan. Ia pilihan yang wajar untuk linked list dan untuk data di cakram atau pita, yang dibaca berurutan; ia pengurutan komputer pertama, diprogram oleh John von Neumann pada 1945. ## Bagaimana quicksort bekerja, dan kapan ia lambat? **Quicksort memilih sebuah pivot, memindahkan elemen yang lebih kecil ke depannya dan yang lain ke belakangnya, lalu mengurutkan kedua sisi dengan cara yang sama.** Setelah partisi, pivot sudah berada di tempat akhirnya. Partisi Nico Lomuto, yang dipakai dalam kode di bawah, mengambil elemen terakhir sebagai pivot dan menyapu dari kiri ke kanan sambil menjaga batas `p`: setiap elemen yang lebih kecil daripada pivot ditukar ke batas, yang lalu maju satu langkah. Partisi asli Tony Hoare memakai dua penunjuk yang bergerak saling mendekat dan melakukan lebih sedikit pertukaran. **Biayanya.** Partisi $m$ elemen membuat $m-1$ perbandingan. Jika pivot membagi rentang kira-kira dua sama besar setiap kali, ada sekitar $\log_2n$ tingkat dengan sekitar $n$ perbandingan masing-masing. Jika pivot selalu elemen terkecil atau terbesar, kedua sisi berukuran $0$ dan $m-1$ dan totalnya $$(n-1)+(n-2)+\cdots+1=\frac{n(n-1)}{2},$$ kuadratik. Dengan elemen terakhir sebagai pivot, hal ini terjadi pada daftar yang sudah terurut atau terbalik, persis masukan yang sering diberikan orang. Pada daftar acak rata-ratanya $$2(n+1)H_n-4n\approx2n\ln n\approx1{,}39\,n\log_2n,$$ dengan $H_n=1+\frac12+\cdots+\frac1n$. Untuk $1000$ elemen itu sekitar $10\,986$ perbandingan (dibandingkan paling banyak $8977$ untuk merge sort), dan peluang jalannya sangat buruk amat kecil. **Yang dilakukan implementasi sungguhan.** - **Memilih pivot dengan baik:** elemen acak, atau median dari yang pertama, tengah, dan terakhir. - **Menangani kunci yang sama:** partisi tiga arah (lebih kecil, sama, lebih besar) menjaga daftar dengan sedikit nilai berbeda tidak melambat. - **Membatasi kerusakan:** introsort (David Musser, 1997) beralih ke heapsort jika rekursi terlalu dalam, sehingga kasus terburuknya $O(n\log n)$; ia ada di balik `std::sort` C++. Merekursi sisi yang lebih kecil lebih dulu menjaga tumpukan tetap $O(\log n)$. - **Quicksort tidak stabil**, dan ia mengurutkan di tempat, tanpa larik tambahan. Sapuan yang ramah cache membuatnya lebih cepat daripada merge sort pada larik dalam praktik, meskipun perbandingannya lebih banyak. Balapan pengurutan di bawah menjalankan keenam algoritma pada masukan yang sama dan menghitung perbandingan serta perpindahan. ## Algoritma pengurutan mana yang sebaiknya dipakai? **Dalam praktik, panggil fungsi pengurutan bahasamu: ia hibrida yang sudah disetel, dan hampir selalu lebih cepat dan lebih benar daripada apa pun yang akan kamu tulis.** Tetapi ketahui apa yang dijanjikannya. | Algoritma | Terbaik | Rata-rata | Terburuk | Memori tambahan | Stabil | |---|---|---|---|---|---| | selection | $n^2$ | $n^2$ | $n^2$ | $O(1)$ | tidak | | insertion | $n$ | $n^2$ | $n^2$ | $O(1)$ | ya | | bubble | $n$ | $n^2$ | $n^2$ | $O(1)$ | ya | | merge | $n\log n$ | $n\log n$ | $n\log n$ | $O(n)$ | ya | | quick | $n\log n$ | $n\log n$ | $n^2$ | $O(\log n)$ | tidak | | heap | $n\log n$ | $n\log n$ | $n\log n$ | $O(1)$ | tidak | Tiga sifat menentukan pilihan. **Stabil**: kunci yang sama mempertahankan urutan awalnya, yang memungkinkan mengurutkan menurut beberapa kunci berturut-turut (urutkan menurut nama, lalu secara stabil menurut kota, dan setiap kota tetap terurut menurut nama). **Di tempat**: hanya memerlukan memori tambahan $O(1)$ atau $O(\log n)$. **Adaptif**: lebih cepat pada masukan yang hampir terurut, seperti insertion sort. Heapsort membangun max-heap di dalam larik, lalu berulang kali menukar yang terbesar ke ujung dan memperbaiki heap: di tempat dan $O(n\log n)$ pada kasus terburuk, tetapi tidak stabil dan tidak ramah cache. **Sebuah batas dan cara mengelilinginya.** Pengurutan apa pun yang hanya membandingkan elemen memerlukan sedikitnya $\log_2(n!)\approx n\log_2n-1{,}44n$ perbandingan, karena $n!$ urutan yang mungkin harus dibedakan dengan jawaban ya atau tidak (gagasan batas bawah dalam [bagian tentang kasus](https://nunada.my.id/artikel/notasi-big-o/#cases)). Untuk $1000$ elemen itu $8530$ perbandingan, dan kasus terburuk merge sort, $8977$, hanya sekitar 5 persen di atasnya. Pengurutan yang tidak membandingkan bisa lebih cepat: counting sort menghitung berapa kali tiap nilai muncul ($O(n+k)$ untuk nilai di bawah $k$), dan radix sort mengurutkan angka demi angka dengan pengurutan stabil, begitulah cara pengurut kartu berlubang bekerja. **Yang dilakukan pustaka.** - **Python:** `sorted(a)` mengembalikan daftar baru dan `a.sort()` mengurutkan di tempat dan mengembalikan `None`. Keduanya memakai Timsort (Tim Peters, 2002): ia menemukan bagian yang sudah berurutan, memperpanjang bagian pendek dengan insertion sort dan menggabungkan bagian-bagiannya, sehingga stabil, $O(n\log n)$, dan $O(n)$ pada masukan terurut. - **JavaScript:** `array.sort()` stabil sejak 2019, tetapi tanpa pembanding ia membandingkan elemen sebagai teks, sehingga `[10, 9, 1].sort()` menghasilkan `[1, 10, 9]`. Selalu tulis `(a, b) => a - b` untuk bilangan. - **Java:** Timsort untuk objek, quicksort dwi-pivot untuk larik bilangan. **C++:** `std::sort` (introsort, tidak stabil) dan `std::stable_sort`. ## Bagaimana mencari dan mengurutkan di Python, JavaScript, dan C++? **Tulis pencarian biner sekali dengan templat setengah terbuka dan pakai ulang; di Python pustaka standar sudah memilikinya sebagai `bisect`.** Program pertama di bawah memuat batas bawah, pencarian selang tertutup yang menghitung berapa kali melihat, akar kuadrat bulat dengan mencari jawaban, dan perbandingan dengan `bisect_left` dan `bisect_right`. Program kedua memuat insertion sort (menghitung geserannya), merge sort, quicksort (menghitung perbandingannya), dan pengurutan stabil menurut kunci. Dua bilangan $9$ dan $9$ pada keluaran adalah inversi $[5,2,4,6,1,3]$ dan geseran insertion sort: keduanya sama. ```python from bisect import bisect_left, bisect_right def lower_bound(a, x): """The first index i with a[i] >= x, in the half-open form [lo, hi).""" lo, hi = 0, len(a) while lo < hi: mid = lo + (hi - lo) // 2 # never (lo + hi) // 2 with fixed-size integers if a[mid] < x: lo = mid + 1 # everything up to mid is too small else: hi = mid # mid itself might be the answer return lo def find(a, x): """An index holding x (or -1) and the number of looks, in the closed form [lo, hi].""" lo, hi, looks = 0, len(a) - 1, 0 while lo <= hi: looks += 1 mid = lo + (hi - lo) // 2 if a[mid] == x: return mid, looks if a[mid] < x: lo = mid + 1 else: hi = mid - 1 return -1, looks def isqrt(n): """The largest r with r * r <= n: a binary search on the answer, no list needed.""" lo, hi = 0, n while lo < hi: mid = lo + (hi - lo + 1) // 2 # round up, so that lo = mid always makes progress if mid * mid <= n: lo = mid else: hi = mid - 1 return lo a = [1, 3, 3, 5, 7, 7, 7, 9, 12] print(lower_bound(a, 7), bisect_left(a, 7), bisect_right(a, 7)) print(bisect_right(a, 7) - bisect_left(a, 7), lower_bound(a, 4), lower_bound(a, 100)) print(find(a, 5), find(a, 8)) print(isqrt(99), isqrt(100), isqrt(10 ** 12)) big = list(range(0, 2_000_000, 2)) # a million even numbers print(find(big, 777_776), find(big, 777_777)) # 4 4 7 # 3 3 9 # (3, 4) (-1, 3) # 9 10 1000000 # (388888, 19) (-1, 20) ``` ```python def insertion(a): """Insertion sort; returns the sorted list and the number of shifts.""" a, shifts = list(a), 0 for i in range(1, len(a)): x, j = a[i], i - 1 while j >= 0 and a[j] > x: a[j + 1] = a[j] shifts += 1 j -= 1 a[j + 1] = x return a, shifts def merge_sort(a): if len(a) <= 1: return a mid = (len(a) + 1) // 2 left, right = merge_sort(a[:mid]), merge_sort(a[mid:]) out, i, j = [], 0, 0 while i < len(left) and j < len(right): if left[i] <= right[j]: # <= keeps equal keys in order: the sort is stable out.append(left[i]); i += 1 else: out.append(right[j]); j += 1 return out + left[i:] + right[j:] def quicksort(a, lo=0, hi=None): """In place, Lomuto partition, last element as the pivot. Returns the comparisons made.""" if hi is None: hi = len(a) - 1 if lo >= hi: return 0 p, count = lo, 0 for j in range(lo, hi): count += 1 if a[j] < a[hi]: a[p], a[j] = a[j], a[p] p += 1 a[p], a[hi] = a[hi], a[p] return count + quicksort(a, lo, p - 1) + quicksort(a, p + 1, hi) def inversions(a): return sum(a[i] > a[j] for i in range(len(a)) for j in range(i + 1, len(a))) x = [5, 2, 4, 6, 1, 3] print(insertion(x), inversions(x)) print(merge_sort(x)) n = 200 print(quicksort(list(range(n))), n * (n - 1) // 2) # sorted input: the worst case data = [(i * 73) % n for i in range(n)] # a scrambled permutation of 0..199 print(quicksort(data), data == sorted(range(n))) people = [("Ana", 30), ("Budi", 25), ("Citra", 30), ("Dewi", 25)] print(sorted(people, key=lambda p: p[1])) # stable: Budi stays before Dewi # ([1, 2, 3, 4, 5, 6], 9) 9 # [1, 2, 3, 4, 5, 6] # 19900 19900 # 1409 True # [('Budi', 25), ('Dewi', 25), ('Ana', 30), ('Citra', 30)] ``` ```javascript ;[10, 9, 1, 100].sort() // [1, 10, 100, 9]: no comparator means text order ;[10, 9, 1, 100].sort((a, b) => a - b) // [1, 9, 10, 100] const lowerBound = (a, x) => { let lo = 0, hi = a.length while (lo < hi) { const mid = lo + ((hi - lo) >> 1) // not (lo + hi) >> 1: see below if (a[mid] < x) lo = mid + 1 else hi = mid } return lo } const a = [1, 3, 3, 5, 7, 7, 7, 9, 12] ;[7, 8, 100].map((x) => lowerBound(a, x)) // [4, 7, 9] ;(1500000000 + 2000000000) >> 1 // -397483648: the sum overflowed 32 bits 1500000000 + ((2000000000 - 1500000000) >> 1) // 1750000000 // bisection: halve a bracket on which f changes sign (60 would be enough for any bracket of doubles) const f = (x) => x * x - 2 let lo = 1, hi = 2 for (let k = 0; k < 50; k++) { const mid = (lo + hi) / 2 if (f(mid) * f(lo) <= 0) hi = mid else lo = mid } ;[lo, hi, hi - lo] // [1.414213562373095, 1.4142135623730958, 8.88e-16] ``` ```cpp #include #include using namespace std; int lowerBound(int a[], int n, int x) { int lo = 0, hi = n; while (lo < hi) { int mid = lo + (hi - lo) / 2; // not (lo + hi) / 2: it can overflow if (a[mid] < x) lo = mid + 1; else hi = mid; } return lo; } int main() { int a[6] = {5, 2, 4, 6, 1, 3}; int shifts = 0; for (int i = 1; i < 6; i++) { int x = a[i], j = i - 1; while (j >= 0 && a[j] > x) { a[j + 1] = a[j]; shifts++; j--; } a[j + 1] = x; } for (int i = 0; i < 6; i++) printf("%d ", a[i]); printf("\n%d\n", shifts); // 9: the number of inversions int b[9] = {1, 3, 3, 5, 7, 7, 7, 9, 12}; printf("%d %d %d\n", lowerBound(b, 9, 7), lowerBound(b, 9, 8), lowerBound(b, 9, 100)); return 0; } /* output: 1 2 3 4 5 6 9 4 7 9 */ ``` ## Dari mana pencarian biner dan pengurutan berasal? **Pengurutan lebih tua daripada komputer, karena mesin sensus dan bank memerlukannya, dan pencarian biner ternyata terkenal mudah salah ditulis.** - **1890-an–1900-an.** Mesin kartu berlubang Herman Hollerith mentabulasi sensus Amerika Serikat 1890, dan pengurut kartu yang menyusul mengurutkan satu kolom sekali waktu, gagasan radix sort. - **1945.** John von Neumann menulis merge sort untuk EDVAC, program pengurutan pertama untuk komputer program tersimpan. - **1946.** John Mauchly menguraikan pencarian biner dalam rangkaian kuliah tentang komputasi di Moore School; itulah uraian tertua yang diterbitkan. - **1959.** Donald Shell menerbitkan Shellsort, pengurutan pertama yang diketahui mengalahkan $n^2$ dengan membandingkan elemen yang berjauhan. Pada tahun yang sama Tony Hoare menemukan quicksort, ketika bekerja di Moskow pada penerjemahan mesin; ia menerbitkannya pada 1961. - **1962.** Menurut Knuth, pencarian biner pertama yang diterbitkan dan benar untuk setiap panjang daftar muncul, enam belas tahun sesudah yang pertama. - **1964.** J. W. J. Williams menerbitkan heapsort, dan Robert Floyd segera menunjukkan cara membangun heap dalam waktu linear. - **1997.** David Musser merancang introsort, quicksort yang tidak dapat memburuk. - **2002.** Tim Peters menulis Timsort untuk Python, dan kemudian ia menyebar ke Java, Android, dan mesin JavaScript. - **2006.** Joshua Bloch menunjukkan bahwa titik tengah yang dihitung sebagai `(lo + hi) / 2` dalam pencarian biner dan merge sort pustaka Java dapat meluap untuk daftar lebih dari $2^{30}$ elemen. ## Kesalahan apa yang sering terjadi pada pencarian dan pengurutan? **Kesalahan paling umum pada pencarian biner dan pengurutan adalah sembilan hal berikut, masing-masing dengan pernyataan yang benar.** | Kesalahan | Yang benar | |---|---| | ❌ Pencarian biner bekerja pada daftar apa pun | Daftarnya harus terurut, dan pengindeksan harus $O(1)$; pada data tak terurut jawabannya sekadar salah. | | ❌ `mid = (lo + hi) / 2` selalu aman | Dengan bilangan bulat berukuran tetap jumlahnya bisa meluap; tulis `mid = lo + (hi - lo) / 2`. | | ❌ Pakai `hi = mid - 1` dengan `while lo < hi` | Mencampur konvensi tertutup dan setengah terbuka melewatkan jawaban atau berputar tanpa henti; pilih satu dan nyatakan invariannya. | | ❌ Pencarian biner mengembalikan kecocokan pertama | Ia mengembalikan sebuah kecocokan; untuk yang pertama pakai batas bawah (`bisect_left`). | | ❌ Bisection bilangan real sampai `hi - lo < 1e-18` | Double di dekat $1$ berjarak $2{,}2\times10^{-16}$, sehingga perulangan mungkin tidak pernah berakhir; hitung iterasi atau bandingkan `mid` dengan ujungnya. | | ❌ Bubble atau insertion sort baik untuk sejuta elemen | Sekitar $\frac{n^2}{2}=5\times10^{11}$ langkah; keduanya cocok untuk daftar beberapa puluh elemen atau yang hampir terurut. | | ❌ Quicksort selalu $O(n\log n)$ | Kasus terburuknya $n^2$, dan dengan elemen terakhir sebagai pivot daftar terurut adalah kasus terburuk. | | ❌ Dua pengurutan berturut-turut mengurutkan menurut dua kunci | Hanya pengurutan stabil yang mempertahankan urutan pertama di antara yang sama: urutkan menurut kunci yang kurang penting lebih dulu, atau urutkan menurut tupel. | | ❌ `[10, 9, 1].sort()` mengurutkan bilangan | JavaScript mengurutkan sebagai teks dan menghasilkan `[1, 10, 9]`; berikan `(a, b) => a - b`. | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: pencarian biner dan pengurutan sekilas - **Pencarian biner:** daftar terurut, lihat bagian tengah, buang separuh; paling banyak $\lfloor\log_2n\rfloor+1$ kali melihat. - **Pertanyaan posisi:** templat setengah terbuka memberi batas bawah ($a[i]\ge x$ pertama); ubah `<` menjadi `<=` untuk batas atas; selisihnya menghitung salinan. - **Galat:** pertahankan satu konvensi dengan invariannya, dan pakai `lo + (hi - lo) / 2`. - **Cari jawabannya:** pertanyaan ya atau tidak yang monoton apa pun; akar bulat dalam $\log_2N$ pengujian; bisection memperoleh satu angka biner per langkah dan tidak dapat gagal. - **Pengurutan sederhana:** sekitar $\frac{n^2}{2}$ langkah; bubble dan insertion sort bergerak tepat sebanyak inversi. - **Merge sort:** paling banyak $n\lceil\log_2n\rceil$ perbandingan, memori tambahan $O(n)$, stabil. **Quicksort:** $\approx1{,}39\,n\log_2n$ rata-rata, $\frac{n(n-1)}{2}$ untuk pivot ekstrem, di tempat, tidak stabil. - **Batas:** pengurutan perbandingan memerlukan $\log_2(n!)\approx n\log_2n-1{,}44n$ perbandingan; counting dan radix sort menghindari perbandingan. - **Dalam praktik:** pakai pengurutan pustaka (Timsort, introsort), yang stabil untuk beberapa kunci, dan pembanding untuk bilangan di JavaScript. ## Glosarium: istilah penting - **Pencarian biner**: Pencarian dalam daftar terurut yang melihat elemen tengah dan membuang separuh yang tidak mungkin memuat target. - **Invarian**: Pernyataan yang benar sebelum dan sesudah setiap langkah perulangan, yang dari situ kebenaran perulangan dibuktikan. - **Batas bawah (posisi)**: Indeks pertama yang elemennya sedikitnya x; untuk x yang tidak ada ia adalah titik sisip yang menjaga daftar tetap terurut. - **Metode bisection**: Cara mencari akar fungsi kontinu dengan berulang kali membagi dua selang yang di ujung-ujungnya fungsi itu berlawanan tanda. - **Inversi**: Pasangan posisi dalam daftar dengan elemen awal lebih besar daripada elemen akhir; daftar terurut tidak memilikinya. - **Pengurutan stabil**: Pengurutan yang mempertahankan elemen berkunci sama dalam urutan yang dimilikinya sebelum diurutkan. - **Pengurutan di tempat**: Pengurutan yang menata ulang daftar dengan hanya sedikit memori tambahan. - **Pivot**: Elemen yang dipilih quicksort agar elemen yang lebih kecil dipindahkan ke depannya dan yang lain ke belakangnya. - **Pengurutan perbandingan**: Pengurutan yang mengetahui urutan hanya dengan membandingkan dua elemen sekali waktu, sehingga memerlukan sekitar n log n perbandingan. - **Timsort**: Hibrida stabil dari merge sort dan insertion sort yang dipakai Python dan Java untuk objek, cepat pada data yang sebagian terurut. ## Pertanyaan yang sering diajukan ### Bagaimana cara kerja pencarian biner? Ia membandingkan target dengan elemen tengah daftar terurut. Jika sama, selesai; jika target lebih besar ia melanjutkan di separuh kanan, jika tidak di separuh kiri. Setiap langkah membagi dua daftar, sehingga seribu elemen memerlukan paling banyak sepuluh langkah. ### Apakah pencarian biner bekerja pada daftar tak terurut? Tidak. Ia membuang separuh daftar setelah satu perbandingan, dan itu hanya aman bila urutan memberi tahu separuh mana yang tidak mungkin memuat target. Pada data tak terurut ia dapat melewatkan nilai yang ada, jadi urutkan dulu atau pindai secara linear. ### Bagaimana menghindari luapan dan galat selisih satu pada pencarian biner? Hitung titik tengah sebagai lo ditambah setengah dari hi dikurangi lo, sehingga jumlah dua indeks besar tidak pernah meluap. Pilih selang tertutup atau setengah terbuka, pakai syarat perulangan dan pembaruan yang cocok, dan tulis invariannya sebagai komentar. ### Apa beda bisect_left dan bisect_right? Keduanya mengembalikan titik sisip dalam daftar terurut. Dengan nilai kembar, bisect_left mengembalikan indeks sebelum salinan nilai itu dan bisect_right indeks sesudahnya, sehingga selisihnya adalah banyaknya salinan. ### Apa algoritma pengurutan tercepat? Tidak ada yang tercepat untuk setiap masukan. Pengurutan perbandingan tidak dapat mengalahkan sekitar n log n perbandingan, dan di antaranya quicksort biasanya tercepat pada larik dan merge sort pada linked list. Counting dan radix sort dapat mengalahkannya bila kuncinya bilangan bulat kecil. ### Apa beda quicksort dan merge sort? Merge sort membagi buta menjadi dua dan melakukan kerjanya saat menggabungkan; ia stabil, selalu n log n, dan memerlukan memori tambahan. Quicksort melakukan kerjanya saat mempartisi di sekitar pivot; ia mengurutkan di tempat, tetapi tidak stabil dan dapat mencapai n kuadrat. ### Apa itu pengurutan stabil dan mengapa penting? Pengurutan stabil mempertahankan elemen berkunci sama dalam urutan aslinya. Ini penting ketika kamu mengurutkan menurut satu kunci dan ingin urutan sebelumnya bertahan di antara yang seri, misalnya mengurutkan orang menurut kota sambil menjaga tiap kota tetap terurut menurut nama. ### Mengapa JavaScript mengurutkan 10 sebelum 9? Tanpa fungsi pembanding, sort mengubah elemen menjadi teks dan membandingkannya huruf demi huruf, dan "10" mendahului "9" karena karakter 1 mendahului 9. Berikan fungsi seperti a dikurangi b untuk mengurutkan bilangan menurut nilainya. --- # Big-O Notation Source: https://nunada.my.id/articles/big-o-notation/ Updated: 2026-10-22 ## Quick answer **Big-O notation describes how the number of steps of an algorithm grows with the size $n$ of its input, ignoring constant factors and smaller terms: $f(n)=O(g(n))$ means $f(n)\le c\,g(n)$ for some constant $c$ and all large $n$.** An algorithm with $3n^2+5n+7$ steps is $O(n^2)$. The common classes, from slowest to fastest growth, are $O(1)$, $O(\log n)$, $O(n)$, $O(n\log n)$, $O(n^2)$, $O(2^n)$ and $O(n!)$. ### Key takeaways - $f(n)=O(g(n))$ means there are constants $c>0$ and $n_0$ with $f(n)\le c\,g(n)$ for all $n\ge n_0$. It is an upper bound on growth: $3n^2+5n+7\le4n^2$ for $n\ge7$, so it is $O(n^2)$. - Big-O ignores constant factors and lower-order terms, because they depend on the machine and stop mattering as $n$ grows. $\Omega$ is a lower bound and $\Theta$ is both: $f=\Theta(g)$ means $f=O(g)$ and $g=O(f)$. - The order of growth is $1\ll\log n\ll\sqrt n\ll n\ll n\log n$ $\ll n^2\ll n^3\ll2^n\ll n!$. At $10^9$ steps a second, the largest input that finishes in one second is about $10^9$ for $n$, $31\,622$ for $n^2$, $29$ for $2^n$ and $12$ for $n!$. - To find the complexity of code: add the costs of statements in sequence and keep the largest, multiply the cost of a loop body by the number of iterations, nested loops multiply, a loop that halves its counter runs $\log n$ times, and a recursion gives a recurrence. - Divide-and-conquer recurrences $T(n)=aT(n/b)+n^d$ are solved by the Master theorem: compare $d$ with $\log_ba$. Merge sort has $a=b=2$, $d=1$ and costs $\Theta(n\log n)$; binary search has $a=1$, $b=2$, $d=0$ and costs $\Theta(\log n)$. - Big-O is not running time: a $100n$ algorithm is slower than an $n^2$ one for $n<100$, memory and caches matter, and for numbers the size of the input is the number of digits, not the value. ## What is Big-O notation? **Big-O notation is a way to say how fast the work of an algorithm grows as its input gets bigger, without counting seconds.** Seconds depend on the computer, the language and the day; the number of basic steps as a function of the input size $n$ does not. If an algorithm takes $f(n)$ steps, we write $f(n)=O(g(n))$ when $f$ grows no faster than $g$, up to a constant factor. **The definition.** $f(n)=O(g(n))$ means that there are constants $c>0$ and $n_0$ such that $$f(n)\le c\cdot g(n)\qquad\text{for all }n\ge n_0.$$ The pair $(c,n_0)$ is a witness. For example, $f(n)=3n^2+5n+7$ is $O(n^2)$ with the witness $c=4$, $n_0=7$: for $n\ge7$ we have $n^2-5n-7\ge0$ (at $n=7$ it is $7$, and it only grows), that is $5n+7\le n^2$, so $3n^2+5n+7\le4n^2$. A different $c$ gives a different $n_0$: with $c=3$ there is none, because $3n^2+5n+7>3n^2$ always; with $c=100$ the inequality holds from $n_0=1$. **What it throws away.** Constant factors ($3n^2$ and $50n^2$ are both $O(n^2)$) and lower-order terms ($n^2+1000n$ is $O(n^2)$), because the machine decides the first and the biggest term decides the second when $n$ is large. Two rules follow: the sum of a few functions is dominated by the fastest, and a product multiplies: $O(n)+O(n^2)=O(n^2)$ and $O(n)\cdot O(\log n)=O(n\log n)$. **Three symbols.** $O$ is an upper bound ("at most this fast a growth"), $\Omega$ is a lower bound ($f(n)\ge c\,g(n)$ for large $n$) and $\Theta$ is both: $f=\Theta(g)$ means $f=O(g)$ and $g=O(f)$. Linear search is $O(n)$, but also $O(n^2)$ and $O(2^n)$, which are true and useless; the useful statement is the tight one, $\Theta(n)$ in the worst case. When the limit of $\frac{f(n)}{g(n)}$ exists, it decides: a finite limit gives $f=O(g)$, a non-zero finite limit gives $f=\Theta(g)$, and a limit of $0$ means $f$ grows strictly slower (this is where [L'Hôpital's Rule](https://nunada.my.id/articles/indeterminate-forms-and-lhopitals-rule/#infinity-forms) is used). Try the definition below. Type two functions with $n$ written as `x`, choose $c$, and the widget finds the threshold $n_0$. ## How fast do the common growth rates grow? **A handful of classes cover almost every algorithm you meet, and each is a different world of what is feasible.** From slowest to fastest growth: | Class | Name | Example | |---|---|---| | $O(1)$ | constant | read an array element `a[i]` | | $O(\log n)$ | logarithmic | binary search; halving the problem each step | | $O(\sqrt n)$ | square root | trial division up to $\sqrt n$ | | $O(n)$ | linear | one pass over a list | | $O(n\log n)$ | linearithmic | merge sort; sorting in general | | $O(n^2)$ | quadratic | comparing all pairs; bubble sort | | $O(n^3)$ | cubic | multiplying two $n\times n$ matrices the school way | | $O(2^n)$ | exponential | trying every subset | | $O(n!)$ | factorial | trying every ordering (a brute-force salesman) | The order is $1\ll\log n\ll\sqrt n\ll n\ll n\log n$ $\ll n^2\ll n^3\ll2^n\ll n!$, where $f\ll g$ means $\frac fg\to0$; the same comparison of growth, a logarithm below any power below an exponential, is proved with limits in the article on [growth rates and L'Hôpital's Rule](https://nunada.my.id/articles/indeterminate-forms-and-lhopitals-rule/#infinity-forms). **What the classes mean in time.** Take a computer that does $10^9$ steps a second. For $n=100$ a quadratic algorithm needs $10^4$ steps, ten microseconds. An exponential one needs $2^{100}\approx1.3\times10^{30}$ steps, which is about $4\times10^{13}$ years, thousands of times the age of the universe. And the largest input that finishes in one second is about $10^9$ for $n$, $4\times10^7$ for $n\log n$, $31\,622$ for $n^2$, $1000$ for $n^3$, only $29$ for $2^n$ and $12$ for $n!$. A computer a thousand times faster adds only $10$ to the $n$ of an exponential algorithm ($2^{10}\approx1000$), while it multiplies the $n$ of a linear one by a thousand. That is why the class matters more than the machine. Slide $n$ and the speed below. The table gives the steps, the time and the largest $n$ for a time budget. ## How do you find the time complexity of code? **You count basic steps, then keep only the term that grows fastest.** A few rules cover most code: 1. **A basic operation costs 1:** an assignment, a comparison, an arithmetic operation, reading an array element. 2. **Statements in sequence add, and the biggest wins:** a loop of $n$ steps followed by a loop of $n^2$ steps is $O(n+n^2)=O(n^2)$. 3. **A loop multiplies:** the number of iterations times the cost of the body. Two nested loops over $n$ cost $n\cdot n=n^2$. 4. **A triangular double loop** ($j$ from $i+1$ to $n$) runs $\frac{n(n-1)}2$ times, which is still $O(n^2)$. 5. **A loop that halves or doubles its counter** runs $\log_2n$ times: `while n > 1: n //= 2` takes $\lfloor\log_2n\rfloor$ steps, and so does `i *= 2` while `i < n`. 6. **A loop to $\sqrt n$** (`while i * i <= n`) runs $\lfloor\sqrt n\rfloor$ times. 7. **A recursive function** gives a recurrence, solved in the next sections; two recursive calls of size $n-1$ give $2^n$. 8. **A condition costs the more expensive branch**, when you want the worst case. **Counting by experiment.** A good habit is to let the program count its own steps and to double $n$: if the count doubles the algorithm is linear; if it quadruples, quadratic; if it grows by a constant, logarithmic; if it multiplies by a little more than two, it is $n\log n$. The widget below runs twelve algorithms on a worst-case input, and the column of ratios shows exactly this. ```python def first(a): # O(1): one step, whatever the length return a[0] def total(a): # O(n): one pass s = 0 for x in a: s += x return s def pairs(a): # O(n^2): n(n - 1)/2 pairs count = 0 for i in range(len(a)): for j in range(i + 1, len(a)): count += 1 return count def powers(n): # O(log n): i doubles until it passes n i = 1 while i < n: i *= 2 return i def is_prime(n): # O(sqrt n) divisions, but exponential in the number of digits of n i = 2 while i * i <= n: if n % i == 0: return False i += 1 return n > 1 ``` ## What are best, worst and average case, and amortized cost? **The same algorithm can cost different amounts on different inputs of the same size, so a complexity is always stated for a case: the best, the worst, or the average.** By default "the complexity" means the worst case, because it is a guarantee. - **Linear search** for a value in a list of $n$: best $1$ comparison (the first element), worst $n$ (it is last or missing), average about $\frac{n+1}{2}$ if it is present and every position is equally likely. Best $\Theta(1)$, worst and average $\Theta(n)$. - **Insertion sort:** best case $n-1$ comparisons (already sorted), worst case $\frac{n(n-1)}{2}$ (reversed). The same code is $O(n)$ or $O(n^2)$ depending on the input. - **Quicksort:** average $O(n\log n)$, but $O(n^2)$ in the worst case, when the pivots are always the smallest or largest element. - **A hash table lookup:** $O(1)$ on average and $O(n)$ if every key collides. **Amortized cost.** Some operations are usually cheap and occasionally expensive, and what matters is the total over a long sequence. A dynamic array (a Python `list`, a C++ `vector`) doubles its capacity when it is full: the copies cost $1+2+4+\cdots+2^k<2\cdot2^k$, so $n$ appends cost fewer than $3n$ steps in all, and each append is $O(1)$ amortized although one of them costs $O(n)$. **Space complexity** is the same idea for memory: merge sort needs $O(n)$ extra space, an in-place sort like heapsort $O(1)$, and a recursion of depth $d$ uses $O(d)$ stack. Big-O describes memory just as it describes time. **Lower bounds.** $\Omega$ can show that no algorithm does better. Sorting by comparisons needs at least $\log_2(n!)\approx n\log_2n-1.44n$ comparisons, because the $n!$ possible orders must be told apart by yes-or-no answers, so $\Omega(n\log n)$; merge sort reaches it, and is therefore $\Theta(n\log n)$ and optimal among comparison sorts. ## How do you solve the recurrence of a recursive algorithm? **A recursive algorithm that splits a problem of size $n$ into $a$ subproblems of size $n/b$ and does $n^d$ work to split and combine has the cost $T(n)=aT(n/b)+n^d$, and the Master theorem solves it by comparing $d$ with $\log_ba$.** **Merge sort, unrolled.** $T(n)=2T(n/2)+n$. The top level does $n$ work. The next level has $2$ problems of size $n/2$, doing $\frac n2$ each, again $n$ in all; the level after that has $4$ problems of size $\frac n4$, again $n$. Every level costs $n$, and there are $\log_2n$ levels (halving $n$ down to $1$), so $T(n)=n\log_2n+n=\Theta(n\log n)$. **The Master theorem.** For $T(n)=aT(n/b)+\Theta(n^d)$ with $a\ge1$, $b>1$ and $d\ge0$, let $\rho=\frac{a}{b^d}$ be the ratio of the work on one level to the work on the level above: - if $d>\log_ba$ ($\rho<1$) the work shrinks down the tree and the top dominates: $T(n)=\Theta(n^d)$; - if $d=\log_ba$ ($\rho=1$) every level costs the same: $T(n)=\Theta(n^d\log n)$; - if $d<\log_ba$ ($\rho>1$) the work grows down the tree and the leaves dominate: $T(n)=\Theta\left(n^{\log_ba}\right)$. For $n=b^k$ the sum is exact: $T(b^k)=n^d\left(1+\rho+\rho^2+\cdots+\rho^k\right)$ when each leaf costs $1$, and the three cases are the three behaviors of a geometric series. **Examples.** - Binary search: $T(n)=T(n/2)+1$, so $a=1$, $b=2$, $d=0=\log_21$: $\Theta(\log n)$. - Merge sort: $a=b=2$, $d=1=\log_22$: $\Theta(n\log n)$. - Multiplying numbers by Karatsuba: $T(n)=3T(n/2)+n$, $d=1<\log_23\approx1.585$: $\Theta\left(n^{1.585}\right)$, better than the school method's $n^2$. - Multiplying matrices by splitting into $8$ blocks: $T(n)=8T(n/2)+n^2$, $\log_28=3>2$: $\Theta(n^3)$; Strassen's trick with $7$ products, $\log_27\approx2.807$, gives $\Theta\left(n^{2.807}\right)$. - Halving and then working $n$: $T(n)=T(n/2)+n$, $d=1>\log_21=0$: $\Theta(n)$. Recurrences that do not have this shape need other methods. $T(n)=T(n-1)+n$ unrolls to $\frac{n(n+1)}{2}=\Theta(n^2)$, and $T(n)=T(n-1)+T(n-2)+1$, the calls of the naive Fibonacci function, grows like $\varphi^n$ with $\varphi=\frac{1+\sqrt5}2\approx1.618$. Choose $a$, $b$ and $d$ below. The table computes $T(n)$ exactly for $n=b^k$ and divides it by the predicted growth: the last column settles on a constant. ## What does Big-O not tell you? **Big-O compares growth for large $n$, so it says nothing about small inputs, constant factors, memory or the machine.** - **Constants matter for small $n$.** $100n$ is $O(n)$ and $n^2$ is $O(n^2)$, yet $n^2<100n$ for every $n<100$. Real sorting libraries are hybrids: Python's and Java's sort (Timsort) use insertion sort, quadratic in the worst case, for short runs, because with a tiny constant it beats $n\log n$ methods below a few dozen elements. - **Not all steps cost the same.** A step that misses the processor's cache can cost a hundred times a step that hits it. Two $O(n)$ loops, one reading memory in order and one jumping around, can differ by an order of magnitude. - **What $n$ is.** $n$ is the size of the input, the number of bits or digits needed to write it, not its value. Trial division, `while i * i <= n`, takes $O(\sqrt N)$ divisions to test the number $N$, but $N$ has $n=\log_2N$ bits (see [how many values bits can hold](https://nunada.my.id/articles/binary-numbers/#bits-and-bytes)), so the cost is $O\left(2^{n/2}\right)$: exponential in the size of the input, which is why testing a 600-digit number by trial division is hopeless. - **Hidden costs of operations.** `x in a_list` is $O(n)$ but `x in a_set` is $O(1)$ on average; `s += "a"` on a string may copy the whole string; `list.insert(0, x)` shifts every element, $O(n)$, while `list.append(x)` is $O(1)$ amortized; `sorted(a)` is $O(n\log n)$. - **Worst case may not be typical.** Quicksort's worst case is $n^2$ and nobody minds, because it almost never happens with a random pivot. Use Big-O to choose between a $n^2$ and an $n\log n$ idea before writing code, and measurement to choose between two ideas of the same class. ## How do you measure complexity in code? **Count the steps instead of timing them: a counter is exact, repeatable and independent of the computer.** The programs below count the comparisons of linear search, binary search and bubble sort for inputs of $250$, $500$ and $1000$ elements, the calls of the Fibonacci function with and without a memo, and the iterations of a double loop and of a halving loop. Doubling $n$ adds one to the binary search, doubles the linear search and quadruples the bubble sort. ```python def linear(a, target): """Comparisons made while looking for target in a list.""" steps = 0 for x in a: steps += 1 if x == target: break return steps def binary(a, target): """Comparisons made by binary search in a sorted list.""" lo, hi, steps = 0, len(a) - 1, 0 while lo <= hi: steps += 1 mid = (lo + hi) // 2 if a[mid] == target: return steps if a[mid] < target: lo = mid + 1 else: hi = mid - 1 return steps def bubble(a): """Comparisons made by bubble sort.""" a, steps = list(a), 0 for i in range(len(a) - 1): for j in range(len(a) - 1 - i): steps += 1 if a[j] > a[j + 1]: a[j], a[j + 1] = a[j + 1], a[j] return steps def fib_calls(n, memo=None): """Calls made by fib(n), without and with a dictionary of known values.""" calls = 0 def fib(k, known): nonlocal calls calls += 1 if k < 2: return k if known is not None and k in known: return known[k] value = fib(k - 1, known) + fib(k - 2, known) if known is not None: known[k] = value return value fib(n, memo) return calls for n in (250, 500, 1000): a = list(range(n)) print(n, linear(a, -1), binary(a, -1), bubble(a[::-1])) print(fib_calls(20), fib_calls(20, {})) print(2 ** 100 / 1e9 / (365.25 * 24 * 3600)) # 250 250 7 31125 # 500 500 8 124750 # 1000 1000 9 499500 # 21891 39 # 40169423537538.64 ``` ```javascript const count = (f, n) => { let steps = 0 f(n, () => steps++) return steps } const pairs = (n, tick) => { for (let i = 0; i < n; i++) for (let j = i + 1; j < n; j++) tick() } const halving = (n, tick) => { while (n > 1) { n = Math.floor(n / 2); tick() } } const subsets = (n, tick) => { const go = (i) => { if (i === n) return tick(); go(i + 1); go(i + 1) }; go(0) } const c = [1000, 2000, 4000].map((n) => count(pairs, n)) c // [499500, 1999000, 7998000] c.map((v, i) => (i ? v / c[i - 1] : null)) // [null, 4.002..., 4.001...]: doubling n quadruples a quadratic count ;[1e3, 1e6, 1e9].map((n) => count(halving, n)) // [9, 19, 29]: a thousand times more input adds about 10 steps ;[10, 14, 18].map((n) => count(subsets, n)) // [1024, 16384, 262144]: four more elements, sixteen times the work ``` ```cpp #include #include using namespace std; int main() { for (int n = 100; n <= 400; n = n * 2) { int pairs = 0; for (int i = 0; i < n; i++) for (int j = i + 1; j < n; j++) pairs++; // n(n - 1)/2 steps int halves = 0; for (int m = n; m > 1; m = m / 2) halves++; // about log2(n) steps printf("%d %d %d\n", n, pairs, halves); } return 0; } /* output: 100 4950 6 200 19900 7 400 79800 8 */ ``` ## Where does Big-O notation come from? **Big-O began in number theory, long before computers, as a way to say how big an error term is.** - **1894.** The German mathematician Paul Bachmann introduced the letter $O$ in his book on analytic number theory, for the Ordnung, the order, of a term. - **1909.** Edmund Landau used it and added the small $o$ ("grows strictly slower"), and the notation is still often called Landau's. - **1914.** G. H. Hardy and J. E. Littlewood introduced $\Omega$ for a lower bound on growth. - **1965.** Juris Hartmanis and Richard Stearns published On the computational complexity of algorithms, which measured the time of a computation and founded computational complexity theory. - **1968 and 1976.** Donald Knuth used $O$ for the analysis of algorithms in The Art of Computer Programming, and in 1976 redefined $\Omega$ and introduced $\Theta$ as the tight bound, giving the three symbols the meaning they have in computer science today. - **1971–1972.** Stephen Cook and Richard Karp defined NP-completeness, the question of which problems can be solved in polynomial time at all: the line between $O(n^k)$ and exponential that this article drew in the table of growth rates. ## What mistakes do people make with Big-O? **The most common mistakes with Big-O are the nine below, each with the correct statement.** | Mistake | Correct | |---|---| | ❌ Big-O is the running time in seconds | It is the growth of the number of steps with the input size; the seconds depend on the machine. | | ❌ Keep the constants: $O(3n^2)$ | Constants and lower terms are dropped: $O(3n^2+5n)=O(n^2)$. | | ❌ An $O(n)$ algorithm is always faster than an $O(n^2)$ one | Only for large $n$: $n^2<100n$ for $n<100$. | | ❌ Two loops one after the other cost $O(n^2)$ | Sequential loops add, $O(n)+O(n)=O(n)$; only nested loops multiply. | | ❌ Every nested loop is $O(n^2)$ | It depends on the inner count: an inner loop that doubles its counter costs $\log n$, so the pair is $O(n\log n)$. | | ❌ Say "linear search is $O(n^2)$" | True and useless: give the tight bound, $\Theta(n)$ in the worst case. | | ❌ Quote the best case | The guarantee is the worst case, and the average case must say which inputs it averages over. | | ❌ $n$ is the number in the input | $n$ is the size of the input: for a number $N$ it is the number of digits, so trial division is exponential. | | ❌ Forget the cost of the operations inside | `x in a_list`, string concatenation and `insert(0, x)` are $O(n)$ each, inside a loop. | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: Big-O notation at a glance - **Definition:** $f=O(g)$ if $f(n)\le c\,g(n)$ for all $n\ge n_0$; $\Omega$ is the lower bound, $\Theta$ the tight one. - **Drop** constants and lower terms: $3n^2+5n+7=O(n^2)$. - **Order:** $1\ll\log n\ll\sqrt n\ll n\ll n\log n$ $\ll n^2\ll n^3\ll2^n\ll n!$; the class matters more than the machine. - **Counting:** sequence adds, loops multiply, halving gives $\log n$, recursion gives a recurrence; double $n$ and watch the ratio. - **Cases:** state best, worst or average; amortized cost spreads rare expensive steps over many cheap ones. - **Master theorem:** $T(n)=aT(n/b)+n^d$ compares $d$ with $\log_ba$: $\Theta(n^d)$, $\Theta(n^d\log n)$ or $\Theta(n^{\log_ba})$. - **Limits of Big-O:** constants for small $n$, memory, the size of the input is its digits, and hidden costs of operations. - **Next:** a search or a sort with its steps counted. - **Code:** count steps with a counter instead of timing. ## Glossary: key terms - **Big-O notation**: A way of saying that a function grows no faster than another, up to a constant factor and for large inputs. - **Time complexity**: The number of basic steps an algorithm takes, as a function of the size of its input. - **Big Theta**: A tight bound: a function is both bounded above and bounded below by constant multiples of the same function. - **Worst case**: The input of a given size on which an algorithm takes the most steps, which gives a guarantee. - **Amortized cost**: The average cost per operation over a long sequence, when expensive operations are rare and cheap ones are common. - **Recurrence relation**: An equation that gives the cost of a problem of size n in terms of the cost of smaller problems. - **Master theorem**: A rule for solving recurrences of the form T(n) = aT(n/b) + n to the d by comparing d with the logarithm of a in base b. - **Space complexity**: The amount of extra memory an algorithm needs, as a function of the size of its input. ## Frequently asked questions ### What is Big-O notation? It is a way to describe how the number of steps of an algorithm grows with the size of its input, ignoring constant factors and smaller terms. Saying an algorithm is O of n squared means its steps grow at most like n squared. ### How do you calculate time complexity? Count the basic operations as a function of the input size. Statements in sequence add, loops and nested loops multiply, and a loop that halves its counter runs log n times. Then keep only the fastest-growing term and drop its constant. ### What is the difference between O, Omega and Theta? Big O is an upper bound on growth, Omega is a lower bound, and Theta is both, a tight bound. Linear search is O of n and also O of n squared, but only the first is tight; in the worst case it is Theta of n. ### Why is binary search O(log n)? Each comparison halves the interval that can still hold the target. A list of n elements can be halved only about log base 2 of n times before one element is left, so a list of a thousand needs at most ten comparisons. ### Why is merge sort O(n log n)? It splits the list in half about log n times, and every level of the splitting does a total of about n work to merge the pieces. So the cost is n for each of log n levels, which is n log n in all cases. ### What is amortized time complexity? It is the average cost per operation over a worst-case sequence. Appending to a dynamic array is usually constant but sometimes copies everything; since the copies add up to less than twice the number of appends, the amortized cost is constant. ### What does the Master theorem say? For T of n equal to a times T of n over b plus n to the d, it compares d with the logarithm of a in base b. If d is larger the answer is n to the d, if equal n to the d times log n, and if smaller n to the log of a. ### Is an O(n) algorithm always faster than an O(n²) one? No, only for large enough inputs. Big-O hides constant factors, so an algorithm with 100n steps is slower than one with n squared steps until n reaches 100. For small inputs the simpler method often wins. --- # Notasi Big-O Source: https://nunada.my.id/artikel/notasi-big-o/ Updated: 2026-10-22 ## Jawaban singkat **Notasi Big-O menggambarkan bagaimana banyaknya langkah sebuah algoritma tumbuh menurut ukuran $n$ masukannya, mengabaikan faktor konstan dan suku yang lebih kecil: $f(n)=O(g(n))$ berarti $f(n)\le c\,g(n)$ untuk suatu konstanta $c$ dan semua $n$ yang besar.** Algoritma dengan $3n^2+5n+7$ langkah adalah $O(n^2)$. Kelas yang umum, dari pertumbuhan paling lambat ke paling cepat, adalah $O(1)$, $O(\log n)$, $O(n)$, $O(n\log n)$, $O(n^2)$, $O(2^n)$, dan $O(n!)$. ### Poin penting - $f(n)=O(g(n))$ berarti ada konstanta $c>0$ dan $n_0$ dengan $f(n)\le c\,g(n)$ untuk semua $n\ge n_0$. Ia adalah batas atas pertumbuhan: $3n^2+5n+7\le4n^2$ untuk $n\ge7$, sehingga ia $O(n^2)$. - Big-O mengabaikan faktor konstan dan suku berorde lebih rendah, karena bergantung pada mesin dan tidak lagi penting ketika $n$ membesar. $\Omega$ adalah batas bawah dan $\Theta$ keduanya: $f=\Theta(g)$ berarti $f=O(g)$ dan $g=O(f)$. - Urutan pertumbuhannya $1\ll\log n\ll\sqrt n\ll n\ll n\log n$ $\ll n^2\ll n^3\ll2^n\ll n!$. Pada $10^9$ langkah per detik, masukan terbesar yang selesai dalam satu detik sekitar $10^9$ untuk $n$, $31\,622$ untuk $n^2$, $29$ untuk $2^n$, dan $12$ untuk $n!$. - Untuk mencari kompleksitas kode: jumlahkan biaya pernyataan berurutan dan ambil yang terbesar, kalikan biaya badan perulangan dengan banyak iterasinya, perulangan bersarang mengalikan, perulangan yang membagi dua penghitungnya berjalan $\log n$ kali, dan rekursi menghasilkan rekurensi. - Rekurensi bagi-dan-taklukkan $T(n)=aT(n/b)+n^d$ diselesaikan dengan teorema Master: bandingkan $d$ dengan $\log_ba$. Merge sort memiliki $a=b=2$, $d=1$ dan berbiaya $\Theta(n\log n)$; pencarian biner memiliki $a=1$, $b=2$, $d=0$ dan berbiaya $\Theta(\log n)$. - Big-O bukan waktu jalan: algoritma $100n$ lebih lambat daripada $n^2$ untuk $n<100$, memori dan cache berpengaruh, dan untuk bilangan ukuran masukan adalah banyaknya angka, bukan nilainya. ## Apa itu notasi Big-O? **Notasi Big-O adalah cara menyatakan seberapa cepat kerja sebuah algoritma tumbuh ketika masukannya membesar, tanpa menghitung detik.** Detik bergantung pada komputer, bahasa, dan harinya; banyaknya langkah dasar sebagai fungsi ukuran masukan $n$ tidak. Jika algoritma memerlukan $f(n)$ langkah, kita tulis $f(n)=O(g(n))$ bila $f$ tumbuh tidak lebih cepat daripada $g$, sampai suatu faktor konstan. **Definisinya.** $f(n)=O(g(n))$ berarti ada konstanta $c>0$ dan $n_0$ sehingga $$f(n)\le c\cdot g(n)\qquad\text{untuk semua }n\ge n_0.$$ Pasangan $(c,n_0)$ adalah saksi. Misalnya, $f(n)=3n^2+5n+7$ adalah $O(n^2)$ dengan saksi $c=4$, $n_0=7$: untuk $n\ge7$ berlaku $n^2-5n-7\ge0$ (di $n=7$ nilainya $7$, dan hanya membesar), yaitu $5n+7\le n^2$, sehingga $3n^2+5n+7\le4n^2$. $c$ yang lain memberi $n_0$ yang lain: dengan $c=3$ tidak ada, karena $3n^2+5n+7>3n^2$ selalu; dengan $c=100$ ketaksamaan berlaku dari $n_0=1$. **Apa yang dibuang.** Faktor konstan ($3n^2$ dan $50n^2$ keduanya $O(n^2)$) dan suku berorde rendah ($n^2+1000n$ adalah $O(n^2)$), karena mesin menentukan yang pertama dan suku terbesar menentukan yang kedua ketika $n$ besar. Dua aturan mengikutinya: jumlah beberapa fungsi didominasi yang tercepat, dan hasil kali mengalikan: $O(n)+O(n^2)=O(n^2)$ dan $O(n)\cdot O(\log n)=O(n\log n)$. **Tiga lambang.** $O$ adalah batas atas ("pertumbuhan paling cepat sebesar ini"), $\Omega$ adalah batas bawah ($f(n)\ge c\,g(n)$ untuk $n$ besar), dan $\Theta$ keduanya: $f=\Theta(g)$ berarti $f=O(g)$ dan $g=O(f)$. Pencarian linear adalah $O(n)$, tetapi juga $O(n^2)$ dan $O(2^n)$, yang benar dan tidak berguna; pernyataan yang berguna adalah yang ketat, $\Theta(n)$ pada kasus terburuk. Bila limit $\frac{f(n)}{g(n)}$ ada, ia menentukan: limit terhingga memberi $f=O(g)$, limit terhingga tak nol memberi $f=\Theta(g)$, dan limit $0$ berarti $f$ tumbuh jauh lebih lambat (di sinilah [Aturan L'Hôpital](https://nunada.my.id/artikel/bentuk-tak-tentu-dan-aturan-lhopital/#infinity-forms) dipakai). Cobalah definisinya di bawah. Ketik dua fungsi dengan $n$ ditulis `x`, pilih $c$, dan widget mencari ambang $n_0$. ## Seberapa cepat laju pertumbuhan yang umum tumbuh? **Segelintir kelas mencakup hampir setiap algoritma yang kamu temui, dan masing-masing adalah dunia yang berbeda tentang apa yang layak.** Dari pertumbuhan paling lambat ke paling cepat: | Kelas | Nama | Contoh | |---|---|---| | $O(1)$ | konstan | membaca elemen larik `a[i]` | | $O(\log n)$ | logaritmik | pencarian biner; membagi dua masalah setiap langkah | | $O(\sqrt n)$ | akar kuadrat | pembagian coba-coba sampai $\sqrt n$ | | $O(n)$ | linear | satu lintasan atas daftar | | $O(n\log n)$ | linearitmik | merge sort; pengurutan pada umumnya | | $O(n^2)$ | kuadratik | membandingkan semua pasangan; bubble sort | | $O(n^3)$ | kubik | mengalikan dua matriks $n\times n$ dengan cara sekolah | | $O(2^n)$ | eksponensial | mencoba setiap himpunan bagian | | $O(n!)$ | faktorial | mencoba setiap urutan (pedagang keliling dengan kekerasan) | Urutannya $1\ll\log n\ll\sqrt n\ll n\ll n\log n$ $\ll n^2\ll n^3\ll2^n\ll n!$, dengan $f\ll g$ berarti $\frac fg\to0$; perbandingan pertumbuhan yang sama, logaritma di bawah pangkat mana pun di bawah eksponensial, dibuktikan dengan limit dalam artikel [laju pertumbuhan dan Aturan L'Hôpital](https://nunada.my.id/artikel/bentuk-tak-tentu-dan-aturan-lhopital/#infinity-forms). **Arti kelas itu dalam waktu.** Ambil komputer yang melakukan $10^9$ langkah per detik. Untuk $n=100$ algoritma kuadratik memerlukan $10^4$ langkah, sepuluh mikrodetik. Yang eksponensial memerlukan $2^{100}\approx1{,}3\times10^{30}$ langkah, sekitar $4\times10^{13}$ tahun, ribuan kali usia alam semesta. Dan masukan terbesar yang selesai dalam satu detik sekitar $10^9$ untuk $n$, $4\times10^7$ untuk $n\log n$, $31\,622$ untuk $n^2$, $1000$ untuk $n^3$, hanya $29$ untuk $2^n$ dan $12$ untuk $n!$. Komputer seribu kali lebih cepat hanya menambah $10$ pada $n$ algoritma eksponensial ($2^{10}\approx1000$), sedangkan ia mengalikan $n$ algoritma linear dengan seribu. Itulah sebabnya kelas lebih penting daripada mesin. Geser $n$ dan kecepatan di bawah. Tabel memberi langkah, waktu, dan $n$ terbesar untuk anggaran waktu. ## Bagaimana mencari kompleksitas waktu sebuah kode? **Kamu menghitung langkah dasar, lalu hanya menyimpan suku yang tumbuh paling cepat.** Beberapa aturan mencakup kebanyakan kode: 1. **Operasi dasar berbiaya 1:** penugasan, perbandingan, operasi aritmetika, membaca elemen larik. 2. **Pernyataan berurutan menjumlahkan, dan yang terbesar menang:** perulangan $n$ langkah diikuti perulangan $n^2$ langkah adalah $O(n+n^2)=O(n^2)$. 3. **Perulangan mengalikan:** banyak iterasi kali biaya badannya. Dua perulangan bersarang atas $n$ berbiaya $n\cdot n=n^2$. 4. **Perulangan ganda segitiga** ($j$ dari $i+1$ sampai $n$) berjalan $\frac{n(n-1)}2$ kali, yang tetap $O(n^2)$. 5. **Perulangan yang membagi dua atau menggandakan penghitungnya** berjalan $\log_2n$ kali: `while n > 1: n //= 2` memerlukan $\lfloor\log_2n\rfloor$ langkah, demikian pula `i *= 2` selama `i < n`. 6. **Perulangan sampai $\sqrt n$** (`while i * i <= n`) berjalan $\lfloor\sqrt n\rfloor$ kali. 7. **Fungsi rekursif** menghasilkan rekurensi, diselesaikan pada bagian berikutnya; dua panggilan rekursif berukuran $n-1$ memberi $2^n$. 8. **Kondisi berbiaya cabang yang lebih mahal**, bila kamu menginginkan kasus terburuk. **Menghitung dengan percobaan.** Kebiasaan baik adalah membiarkan program menghitung langkahnya sendiri dan menggandakan $n$: jika hitungannya berlipat dua algoritmanya linear; jika berlipat empat, kuadratik; jika bertambah konstan, logaritmik; jika berlipat sedikit lebih dari dua, ia $n\log n$. Widget di bawah menjalankan dua belas algoritma pada masukan kasus terburuk, dan kolom rasio memperlihatkan persis hal ini. ```python def first(a): # O(1): one step, whatever the length return a[0] def total(a): # O(n): one pass s = 0 for x in a: s += x return s def pairs(a): # O(n^2): n(n - 1)/2 pairs count = 0 for i in range(len(a)): for j in range(i + 1, len(a)): count += 1 return count def powers(n): # O(log n): i doubles until it passes n i = 1 while i < n: i *= 2 return i def is_prime(n): # O(sqrt n) divisions, but exponential in the number of digits of n i = 2 while i * i <= n: if n % i == 0: return False i += 1 return n > 1 ``` ## Apa itu kasus terbaik, terburuk, rata-rata, dan biaya teramortisasi? **Algoritma yang sama dapat berbiaya berbeda pada masukan berbeda dengan ukuran yang sama, sehingga kompleksitas selalu dinyatakan untuk suatu kasus: terbaik, terburuk, atau rata-rata.** Secara bawaan "kompleksitas" berarti kasus terburuk, karena ia adalah jaminan. - **Pencarian linear** sebuah nilai dalam daftar $n$: terbaik $1$ perbandingan (elemen pertama), terburuk $n$ (ia terakhir atau tidak ada), rata-rata sekitar $\frac{n+1}{2}$ jika ia ada dan setiap posisi sama mungkin. Terbaik $\Theta(1)$, terburuk dan rata-rata $\Theta(n)$. - **Insertion sort:** kasus terbaik $n-1$ perbandingan (sudah terurut), kasus terburuk $\frac{n(n-1)}{2}$ (terbalik). Kode yang sama $O(n)$ atau $O(n^2)$ tergantung masukannya. - **Quicksort:** rata-rata $O(n\log n)$, tetapi $O(n^2)$ pada kasus terburuk, ketika pivotnya selalu elemen terkecil atau terbesar. - **Pencarian tabel hash:** $O(1)$ rata-rata dan $O(n)$ jika setiap kunci bertabrakan. **Biaya teramortisasi.** Beberapa operasi biasanya murah dan sesekali mahal, dan yang penting adalah totalnya pada barisan panjang. Larik dinamis (`list` Python, `vector` C++) menggandakan kapasitasnya ketika penuh: penyalinan berbiaya $1+2+4+\cdots+2^k<2\cdot2^k$, sehingga $n$ penambahan berbiaya kurang dari $3n$ langkah seluruhnya, dan setiap penambahan $O(1)$ teramortisasi walaupun salah satunya berbiaya $O(n)$. **Kompleksitas ruang** adalah gagasan yang sama untuk memori: merge sort memerlukan ruang tambahan $O(n)$, pengurutan di tempat seperti heapsort $O(1)$, dan rekursi berkedalaman $d$ memakai tumpukan $O(d)$. Big-O menggambarkan memori seperti menggambarkan waktu. **Batas bawah.** $\Omega$ dapat menunjukkan bahwa tidak ada algoritma yang lebih baik. Pengurutan dengan perbandingan memerlukan sedikitnya $\log_2(n!)\approx n\log_2n-1{,}44n$ perbandingan, karena $n!$ urutan yang mungkin harus dibedakan dengan jawaban ya atau tidak, sehingga $\Omega(n\log n)$; merge sort mencapainya, sehingga ia $\Theta(n\log n)$ dan optimal di antara pengurutan perbandingan. ## Bagaimana menyelesaikan rekurensi sebuah algoritma rekursif? **Algoritma rekursif yang memecah masalah berukuran $n$ menjadi $a$ submasalah berukuran $n/b$ dan melakukan kerja $n^d$ untuk memecah dan menggabungkan memiliki biaya $T(n)=aT(n/b)+n^d$, dan teorema Master menyelesaikannya dengan membandingkan $d$ dengan $\log_ba$.** **Merge sort, diurai.** $T(n)=2T(n/2)+n$. Tingkat teratas melakukan kerja $n$. Tingkat berikutnya punya $2$ masalah berukuran $n/2$, masing-masing $\frac n2$, lagi-lagi $n$ seluruhnya; tingkat sesudahnya punya $4$ masalah berukuran $\frac n4$, lagi-lagi $n$. Setiap tingkat berbiaya $n$, dan ada $\log_2n$ tingkat (membagi dua $n$ sampai $1$), sehingga $T(n)=n\log_2n+n=\Theta(n\log n)$. **Teorema Master.** Untuk $T(n)=aT(n/b)+\Theta(n^d)$ dengan $a\ge1$, $b>1$, dan $d\ge0$, misalkan $\rho=\frac{a}{b^d}$ adalah rasio kerja pada satu tingkat terhadap kerja di tingkat di atasnya: - jika $d>\log_ba$ ($\rho<1$) kerja menyusut ke bawah pohon dan puncaknya mendominasi: $T(n)=\Theta(n^d)$; - jika $d=\log_ba$ ($\rho=1$) setiap tingkat berbiaya sama: $T(n)=\Theta(n^d\log n)$; - jika $d<\log_ba$ ($\rho>1$) kerja membesar ke bawah pohon dan daun-daunnya mendominasi: $T(n)=\Theta\left(n^{\log_ba}\right)$. Untuk $n=b^k$ jumlahnya eksak: $T(b^k)=n^d\left(1+\rho+\rho^2+\cdots+\rho^k\right)$ bila setiap daun berbiaya $1$, dan ketiga kasus adalah tiga perilaku deret geometri. **Contoh.** - Pencarian biner: $T(n)=T(n/2)+1$, sehingga $a=1$, $b=2$, $d=0=\log_21$: $\Theta(\log n)$. - Merge sort: $a=b=2$, $d=1=\log_22$: $\Theta(n\log n)$. - Perkalian bilangan dengan Karatsuba: $T(n)=3T(n/2)+n$, $d=1<\log_23\approx1{,}585$: $\Theta\left(n^{1{,}585}\right)$, lebih baik daripada $n^2$ cara sekolah. - Perkalian matriks dengan membagi menjadi $8$ blok: $T(n)=8T(n/2)+n^2$, $\log_28=3>2$: $\Theta(n^3)$; trik Strassen dengan $7$ perkalian, $\log_27\approx2{,}807$, memberi $\Theta\left(n^{2{,}807}\right)$. - Membagi dua lalu bekerja $n$: $T(n)=T(n/2)+n$, $d=1>\log_21=0$: $\Theta(n)$. Rekurensi yang tidak berbentuk ini memerlukan metode lain. $T(n)=T(n-1)+n$ terurai menjadi $\frac{n(n+1)}{2}=\Theta(n^2)$, dan $T(n)=T(n-1)+T(n-2)+1$, banyaknya panggilan fungsi Fibonacci naif, tumbuh seperti $\varphi^n$ dengan $\varphi=\frac{1+\sqrt5}2\approx1{,}618$. Pilih $a$, $b$, dan $d$ di bawah. Tabel menghitung $T(n)$ secara eksak untuk $n=b^k$ dan membaginya dengan pertumbuhan yang diramalkan: kolom terakhir menuju konstanta. ## Apa yang tidak dikatakan Big-O? **Big-O membandingkan pertumbuhan untuk $n$ besar, sehingga ia tidak mengatakan apa pun tentang masukan kecil, faktor konstan, memori, atau mesin.** - **Konstanta penting untuk $n$ kecil.** $100n$ adalah $O(n)$ dan $n^2$ adalah $O(n^2)$, namun $n^2<100n$ untuk setiap $n<100$. Pustaka pengurutan nyata berupa hibrida: pengurutan Python dan Java (Timsort) memakai insertion sort, kuadratik pada kasus terburuk, untuk bagian pendek, karena dengan konstanta yang sangat kecil ia mengalahkan metode $n\log n$ di bawah beberapa puluh elemen. - **Tidak semua langkah berbiaya sama.** Langkah yang meleset dari cache prosesor dapat berbiaya seratus kali langkah yang mengenainya. Dua perulangan $O(n)$, satu membaca memori berurutan dan satu melompat-lompat, dapat berbeda satu orde besaran. - **Apa itu $n$.** $n$ adalah ukuran masukan, banyaknya bit atau angka yang diperlukan untuk menuliskannya, bukan nilainya. Pembagian coba-coba, `while i * i <= n`, memerlukan $O(\sqrt N)$ pembagian untuk menguji bilangan $N$, tetapi $N$ memiliki $n=\log_2N$ bit (lihat [berapa nilai yang dapat dimuat bit](https://nunada.my.id/artikel/bilangan-biner/#bits-and-bytes)), sehingga biayanya $O\left(2^{n/2}\right)$: eksponensial terhadap ukuran masukan, itulah sebabnya menguji bilangan 600 angka dengan pembagian coba-coba tidak ada harapan. - **Biaya tersembunyi operasi.** `x in a_list` adalah $O(n)$ tetapi `x in a_set` adalah $O(1)$ rata-rata; `s += "a"` pada string dapat menyalin seluruh string; `list.insert(0, x)` menggeser setiap elemen, $O(n)$, sedangkan `list.append(x)` adalah $O(1)$ teramortisasi; `sorted(a)` adalah $O(n\log n)$. - **Kasus terburuk mungkin tidak lazim.** Kasus terburuk quicksort adalah $n^2$ dan tidak ada yang keberatan, karena ia hampir tidak pernah terjadi dengan pivot acak. Pakai Big-O untuk memilih antara gagasan $n^2$ dan $n\log n$ sebelum menulis kode, dan pengukuran untuk memilih antara dua gagasan yang sekelas. ## Bagaimana mengukur kompleksitas dalam kode? **Hitung langkahnya, jangan mengukur waktunya: penghitung itu eksak, dapat diulang, dan tidak bergantung pada komputer.** Program di bawah menghitung perbandingan pencarian linear, pencarian biner, dan bubble sort untuk masukan $250$, $500$, dan $1000$ elemen, panggilan fungsi Fibonacci dengan dan tanpa memo, dan iterasi perulangan ganda dan perulangan pembagian dua. Menggandakan $n$ menambah satu pada pencarian biner, melipatduakan pencarian linear, dan melipatempatkan bubble sort. ```python def linear(a, target): """Comparisons made while looking for target in a list.""" steps = 0 for x in a: steps += 1 if x == target: break return steps def binary(a, target): """Comparisons made by binary search in a sorted list.""" lo, hi, steps = 0, len(a) - 1, 0 while lo <= hi: steps += 1 mid = (lo + hi) // 2 if a[mid] == target: return steps if a[mid] < target: lo = mid + 1 else: hi = mid - 1 return steps def bubble(a): """Comparisons made by bubble sort.""" a, steps = list(a), 0 for i in range(len(a) - 1): for j in range(len(a) - 1 - i): steps += 1 if a[j] > a[j + 1]: a[j], a[j + 1] = a[j + 1], a[j] return steps def fib_calls(n, memo=None): """Calls made by fib(n), without and with a dictionary of known values.""" calls = 0 def fib(k, known): nonlocal calls calls += 1 if k < 2: return k if known is not None and k in known: return known[k] value = fib(k - 1, known) + fib(k - 2, known) if known is not None: known[k] = value return value fib(n, memo) return calls for n in (250, 500, 1000): a = list(range(n)) print(n, linear(a, -1), binary(a, -1), bubble(a[::-1])) print(fib_calls(20), fib_calls(20, {})) print(2 ** 100 / 1e9 / (365.25 * 24 * 3600)) # 250 250 7 31125 # 500 500 8 124750 # 1000 1000 9 499500 # 21891 39 # 40169423537538.64 ``` ```javascript const count = (f, n) => { let steps = 0 f(n, () => steps++) return steps } const pairs = (n, tick) => { for (let i = 0; i < n; i++) for (let j = i + 1; j < n; j++) tick() } const halving = (n, tick) => { while (n > 1) { n = Math.floor(n / 2); tick() } } const subsets = (n, tick) => { const go = (i) => { if (i === n) return tick(); go(i + 1); go(i + 1) }; go(0) } const c = [1000, 2000, 4000].map((n) => count(pairs, n)) c // [499500, 1999000, 7998000] c.map((v, i) => (i ? v / c[i - 1] : null)) // [null, 4.002..., 4.001...]: doubling n quadruples a quadratic count ;[1e3, 1e6, 1e9].map((n) => count(halving, n)) // [9, 19, 29]: a thousand times more input adds about 10 steps ;[10, 14, 18].map((n) => count(subsets, n)) // [1024, 16384, 262144]: four more elements, sixteen times the work ``` ```cpp #include #include using namespace std; int main() { for (int n = 100; n <= 400; n = n * 2) { int pairs = 0; for (int i = 0; i < n; i++) for (int j = i + 1; j < n; j++) pairs++; // n(n - 1)/2 steps int halves = 0; for (int m = n; m > 1; m = m / 2) halves++; // about log2(n) steps printf("%d %d %d\n", n, pairs, halves); } return 0; } /* output: 100 4950 6 200 19900 7 400 79800 8 */ ``` ## Dari mana notasi Big-O berasal? **Big-O bermula dalam teori bilangan, jauh sebelum komputer, sebagai cara menyatakan seberapa besar suku galat.** - **1894.** Matematikawan Jerman Paul Bachmann memperkenalkan huruf $O$ dalam bukunya tentang teori bilangan analitik, untuk Ordnung, orde, sebuah suku. - **1909.** Edmund Landau memakainya dan menambahkan $o$ kecil ("tumbuh jauh lebih lambat"), dan notasi itu masih sering disebut notasi Landau. - **1914.** G. H. Hardy dan J. E. Littlewood memperkenalkan $\Omega$ untuk batas bawah pertumbuhan. - **1965.** Juris Hartmanis dan Richard Stearns menerbitkan On the computational complexity of algorithms, yang mengukur waktu suatu komputasi dan mendirikan teori kompleksitas komputasi. - **1968 dan 1976.** Donald Knuth memakai $O$ untuk analisis algoritma dalam The Art of Computer Programming, dan pada 1976 mendefinisikan ulang $\Omega$ dan memperkenalkan $\Theta$ sebagai batas ketat, memberi ketiga lambang itu arti yang mereka miliki dalam ilmu komputer sekarang. - **1971–1972.** Stephen Cook dan Richard Karp mendefinisikan NP-lengkap, pertanyaan masalah mana yang dapat diselesaikan dalam waktu polinomial sama sekali: garis antara $O(n^k)$ dan eksponensial yang digambar artikel ini dalam tabel laju pertumbuhan. ## Kesalahan apa yang sering terjadi pada Big-O? **Kesalahan paling umum pada Big-O adalah sembilan hal berikut, masing-masing dengan pernyataan yang benar.** | Kesalahan | Yang benar | |---|---| | ❌ Big-O adalah waktu jalan dalam detik | Ia adalah pertumbuhan banyaknya langkah menurut ukuran masukan; detiknya bergantung pada mesin. | | ❌ Menyimpan konstanta: $O(3n^2)$ | Konstanta dan suku rendah dibuang: $O(3n^2+5n)=O(n^2)$. | | ❌ Algoritma $O(n)$ selalu lebih cepat daripada $O(n^2)$ | Hanya untuk $n$ besar: $n^2<100n$ untuk $n<100$. | | ❌ Dua perulangan berurutan berbiaya $O(n^2)$ | Perulangan berurutan menjumlahkan, $O(n)+O(n)=O(n)$; hanya perulangan bersarang yang mengalikan. | | ❌ Setiap perulangan bersarang adalah $O(n^2)$ | Tergantung banyaknya yang dalam: perulangan dalam yang menggandakan penghitungnya berbiaya $\log n$, sehingga pasangannya $O(n\log n)$. | | ❌ Mengatakan "pencarian linear adalah $O(n^2)$" | Benar dan tidak berguna: beri batas ketat, $\Theta(n)$ pada kasus terburuk. | | ❌ Mengutip kasus terbaik | Jaminannya adalah kasus terburuk, dan kasus rata-rata harus menyebut masukan mana yang dirata-ratakan. | | ❌ $n$ adalah bilangan dalam masukan | $n$ adalah ukuran masukan: untuk bilangan $N$ ia adalah banyaknya angka, sehingga pembagian coba-coba bersifat eksponensial. | | ❌ Melupakan biaya operasi di dalamnya | `x in a_list`, penyambungan string, dan `insert(0, x)` masing-masing $O(n)$, di dalam perulangan. | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: notasi Big-O sekilas - **Definisi:** $f=O(g)$ jika $f(n)\le c\,g(n)$ untuk semua $n\ge n_0$; $\Omega$ batas bawah, $\Theta$ yang ketat. - **Buang** konstanta dan suku rendah: $3n^2+5n+7=O(n^2)$. - **Urutan:** $1\ll\log n\ll\sqrt n\ll n\ll n\log n$ $\ll n^2\ll n^3\ll2^n\ll n!$; kelas lebih penting daripada mesin. - **Menghitung:** urutan menjumlahkan, perulangan mengalikan, pembagian dua memberi $\log n$, rekursi memberi rekurensi; gandakan $n$ dan lihat rasionya. - **Kasus:** sebut terbaik, terburuk, atau rata-rata; biaya teramortisasi menyebarkan langkah mahal yang jarang ke banyak langkah murah. - **Teorema Master:** $T(n)=aT(n/b)+n^d$ membandingkan $d$ dengan $\log_ba$: $\Theta(n^d)$, $\Theta(n^d\log n)$, atau $\Theta(n^{\log_ba})$. - **Batas Big-O:** konstanta untuk $n$ kecil, memori, ukuran masukan adalah angkanya, dan biaya tersembunyi operasi. - **Berikutnya:** pencarian atau pengurutan dengan langkah yang dihitung. - **Kode:** hitung langkah dengan penghitung, jangan mengukur waktu. ## Glosarium: istilah penting - **Notasi Big-O**: Cara menyatakan bahwa suatu fungsi tumbuh tidak lebih cepat daripada fungsi lain, sampai faktor konstan dan untuk masukan besar. - **Kompleksitas waktu**: Banyaknya langkah dasar yang diambil sebuah algoritma, sebagai fungsi ukuran masukannya. - **Big Theta**: Batas ketat: suatu fungsi dibatasi dari atas dan dari bawah oleh kelipatan konstan dari fungsi yang sama. - **Kasus terburuk**: Masukan berukuran tertentu yang membuat algoritma mengambil langkah terbanyak, yang memberi jaminan. - **Biaya teramortisasi**: Biaya rata-rata per operasi pada barisan panjang, ketika operasi mahal jarang dan operasi murah sering. - **Relasi rekurensi**: Persamaan yang memberi biaya masalah berukuran n dalam biaya masalah yang lebih kecil. - **Teorema Master**: Aturan untuk menyelesaikan rekurensi berbentuk T(n) = aT(n/b) + n pangkat d dengan membandingkan d dengan logaritma a berbasis b. - **Kompleksitas ruang**: Banyaknya memori tambahan yang diperlukan sebuah algoritma, sebagai fungsi ukuran masukannya. ## Pertanyaan yang sering diajukan ### Apa itu notasi Big-O? Itu adalah cara menggambarkan bagaimana banyaknya langkah sebuah algoritma tumbuh menurut ukuran masukannya, dengan mengabaikan faktor konstan dan suku yang lebih kecil. Mengatakan algoritma O dari n kuadrat berarti langkahnya tumbuh paling banyak seperti n kuadrat. ### Bagaimana menghitung kompleksitas waktu? Hitung operasi dasar sebagai fungsi ukuran masukan. Pernyataan berurutan menjumlahkan, perulangan dan perulangan bersarang mengalikan, dan perulangan yang membagi dua penghitungnya berjalan log n kali. Lalu simpan hanya suku yang tumbuh paling cepat dan buang konstantanya. ### Apa beda O, Omega, dan Theta? Big O adalah batas atas pertumbuhan, Omega batas bawah, dan Theta keduanya, batas ketat. Pencarian linear adalah O dari n dan juga O dari n kuadrat, tetapi hanya yang pertama ketat; pada kasus terburuk ia Theta dari n. ### Mengapa pencarian biner O(log n)? Setiap perbandingan membagi dua selang yang masih dapat memuat target. Daftar n elemen hanya dapat dibagi dua sekitar log basis 2 dari n kali sebelum tersisa satu elemen, sehingga daftar seribu memerlukan paling banyak sepuluh perbandingan. ### Mengapa merge sort O(n log n)? Ia membagi daftar menjadi dua sekitar log n kali, dan setiap tingkat pembagian melakukan kerja total sekitar n untuk menggabungkan bagian-bagiannya. Jadi biayanya n untuk setiap dari log n tingkat, yaitu n log n pada semua kasus. ### Apa itu kompleksitas waktu teramortisasi? Itu adalah biaya rata-rata per operasi pada barisan kasus terburuk. Menambah ke larik dinamis biasanya konstan tetapi kadang menyalin semuanya; karena salinan itu berjumlah kurang dari dua kali banyaknya penambahan, biaya teramortisasinya konstan. ### Apa isi teorema Master? Untuk T dari n sama dengan a kali T dari n per b tambah n pangkat d, teorema ini membandingkan d dengan logaritma a berbasis b. Jika d lebih besar jawabannya n pangkat d, jika sama n pangkat d kali log n, dan jika lebih kecil n pangkat log a. ### Apakah algoritma O(n) selalu lebih cepat daripada yang O(n²)? Tidak, hanya untuk masukan yang cukup besar. Big-O menyembunyikan faktor konstan, sehingga algoritma dengan 100n langkah lebih lambat daripada yang n kuadrat langkah sampai n mencapai 100. Untuk masukan kecil metode yang lebih sederhana sering menang. --- # Floating-Point Numbers Source: https://nunada.my.id/articles/floating-point-numbers/ Updated: 2026-10-30 ## Quick answer **A floating-point number is a binary number in scientific notation, stored as a sign, an exponent and a fixed number of fraction bits, which is why it has a huge range but only about 16 decimal digits (for 64 bits).** Numbers are not evenly spaced: the gap doubles at every power of two, every operation rounds to the nearest value that fits, and the small errors can pile up, cancel digits or be absorbed. ### Key takeaways - A 64-bit double is $(-1)^s\times(1.f)_2\times2^{e}$: 1 sign bit, 11 exponent bits and 52 fraction bits. The leading 1 is not stored, so the precision is 53 bits, about 15.95 decimal digits. - The numbers are not evenly spaced. Between $2^k$ and $2^{k+1}$ there are always the same number of them, so the gap doubles at every power of two; from $2^{53}$ the gap in a double is $2$, and odd integers no longer exist. - Every basic operation is rounded to the nearest representable number, ties to even, so $\mathrm{fl}(a\circ b)=(a\circ b)(1+\delta)$ with $|\delta|\le u=2^{-53}\approx1.1\times10^{-16}$. The gap above $1$ is the machine epsilon $2^{-52}$. - Special patterns: $\pm0$, $\pm\infty$ and NaN, which is not equal even to itself; subnormal numbers fill the gap between $0$ and the smallest normal number, so that underflow is gradual. - Rounding errors accumulate when you add many numbers, vanish into a big number (absorption), and make subtracting two nearly equal numbers lose digits (cancellation). Compensated sums, algebraic rewriting and library functions such as `expm1` limit the damage. - Compare floats with a relative and an absolute tolerance, never with `==` after a calculation; use integers or decimal types for money; and choose float16, bfloat16, float32 or float64 by the range and the digits the problem needs. ## What is a floating-point number? **A floating-point number is a number written in binary scientific notation with a fixed number of digits: a sign, a significand (the digits) and an exponent that says where the point goes.** In decimal, scientific notation writes $-6.02\times10^{23}$ or $1.6\times10^{-19}$: a few significant digits and a power of ten. A computer does the same in base $2$: $$x=(-1)^s\times(1.f_1f_2f_3\ldots f_m)_2\times2^{e}.$$ The point "floats" because the exponent $e$ moves it, so the same format holds the size of the universe and the size of an atom. The price is that the number of digits $m+1$ is fixed, so every number has only a limited number of significant digits, however large or small it is. **Why not fixed point?** A fixed-point format keeps the point in one place, for example always $16$ binary digits after it. Then it cannot hold both $10^{30}$ and $10^{-30}$; floating point gives up some precision to cover that whole range. **The standard.** Almost all hardware follows IEEE 754. It defines a few binary formats, which differ in how many bits go to the exponent and to the fraction: | Format | Bits | Sign + exponent + fraction | Significant bits | Decimal digits | Largest value | |---|---|---|---|---|---| | half, float16 | 16 | 1 + 5 + 10 | 11 | about 3.3 | 65504 | | bfloat16 | 16 | 1 + 8 + 7 | 8 | about 2.4 | about $3.4\times10^{38}$ | | single, float32 | 32 | 1 + 8 + 23 | 24 | about 7.2 | about $3.4\times10^{38}$ | | double, float64 | 64 | 1 + 11 + 52 | 53 | about 15.95 | about $1.8\times10^{308}$ | The number of decimal digits is the number of significant bits times $\log_{10}2\approx0.301$. In Python a `float` is a double, in JavaScript every `Number` is a double, and in C and C++ `double` is a double and `float` is a single. This article is about what these formats do, in the way that matters when you write code; [real numbers](https://nunada.my.id/articles/real-numbers/#real-numbers-in-code) explains the short version, and [binary numbers](https://nunada.my.id/articles/binary-numbers/#binary-fractions) explains why $0.1$ has no finite binary expansion. ## How are the bits of a double laid out? **A double has three fields: 1 sign bit, 11 exponent bits and 52 fraction bits, and the value follows from the field of the exponent.** - **Normal numbers** (exponent field $1$ to $2046$): the value is $(-1)^s\times\left(1+\frac{F}{2^{52}}\right)\times2^{E-1023}$, where $E$ is the exponent field read as an integer, $F$ is the fraction field, and $1023$ is the bias. The leading $1$ is implied, which is why $52$ stored bits give $53$ bits of precision. The bias lets the exponent be stored without its own sign. - **Exponent field $0$:** the value $\pm0$ if the fraction is $0$, and otherwise a subnormal number $(-1)^s\times\frac{F}{2^{52}}\times2^{-1022}$ with no implied $1$. - **Exponent field $2047$** (all ones): $\pm\infty$ if the fraction is $0$, and otherwise NaN. **Two examples.** The number $-2.5=-1.25\times2^1$ has sign $1$, exponent field $1+1023=1024=10000000000_2$ and fraction $0100\ldots0$ (the $.25$ of $1.25$), so its pattern in hexadecimal is `C004000000000000`. The number $0.1$ is $1.6000000000000000888\ldots\times2^{-4}$: sign $0$, exponent field $1019$, and a fraction that repeats $1001\,1001\ldots$ and is rounded up at the end, giving `3FB999999999999A`. That last `A` is the rounding, and it is why the stored value is $$0.1000000000000000055511151231257827021181583404541015625,$$ slightly more than $0.1$. For a single, the numbers are the same except that the bias is $127$ and there are $8$ and $23$ bits. Type a number below and choose a format. The widget shows the three fields, the formula they stand for, the exact value that is stored, the error of the rounding and the neighbors above and below. ## Why are floating-point numbers not evenly spaced? **Between two consecutive powers of two, $2^k$ and $2^{k+1}$, a format always has the same number of values ($2^{52}$ for a double), so the gap between neighbors is $2^{k-52}$ and doubles at each power of two.** Near $1$ the gap is $2^{-52}\approx2.2\times10^{-16}$; near $1000$ it is $1.1\times10^{-13}$; near $10^{16}$ it is $2$. The relative spacing, the gap divided by the number, stays between $2^{-53}$ and $2^{-52}$ everywhere, and that is what "about 16 digits" means. The gap between a number and the next one is called an ulp, the unit in the last place. A format with very few bits shows it plainly. Take $1$ sign bit, $3$ exponent bits (bias $3$) and $2$ fraction bits. Its non-negative numbers are $$0,\ \tfrac1{16},\ \tfrac1{8},\ \tfrac3{16},\ \tfrac14,\ \tfrac5{16},\ \tfrac38,\ \tfrac7{16},\ \tfrac12,\ \tfrac58,\ \tfrac34,\ \tfrac78,\ 1,\ \tfrac54,\ \tfrac32,\ \tfrac74,\ 2,\ \ldots,\ 14.$$ Between $\frac14$ and $\frac12$ there are four numbers, a quarter of the gap apart, as there are between $1$ and $2$, but there the gap is four times larger. The numbers below $\frac14$, the subnormal numbers, share one gap, $\frac1{16}$, which is the gap of the first binade: that is what lets the format reach $0$ gradually instead of jumping from $\frac14$ to $0$. Two consequences matter in code. First, **integers are exact only up to $2^{53}$** in a double ($9\,007\,199\,254\,740\,992$) and up to $2^{24}=16\,777\,216$ in a single: above that the gap is $2$, so $2^{53}+1$ rounds back to $2^{53}$. Second, a large number absorbs a small one: `1e16 + 1 == 1e16` is true. Choose the number of bits below and slide through the numbers. The table gives the gap of each power of two. ## How does a computer round, and what is machine epsilon? **IEEE 754 requires that + − × ÷ and the square root give the correctly rounded result: the exact answer rounded to the nearest number of the format, and in a tie to the one whose last fraction bit is even.** Rounding to the nearest even avoids a bias: with ties always rounded up, long calculations would drift upward. The other modes (toward $0$, toward $+\infty$, toward $-\infty$) exist for interval arithmetic and special cases. **The standard model.** Provided nothing overflows or underflows, $$\mathrm{fl}(a\circ b)=(a\circ b)(1+\delta),\qquad|\delta|\le u,$$ where $\circ$ is any of the operations and $u=2^{-53}\approx1.11\times10^{-16}$ for a double is the unit roundoff. Each operation is as accurate as the format allows, and the whole story of numerical error is how these small relative errors combine. **Machine epsilon.** The gap between $1$ and the next double is $2^{-52}\approx2.22\times10^{-16}$, called the machine epsilon (in Python `sys.float_info.epsilon`, in JavaScript `Number.EPSILON`); it is twice the unit roundoff. In a single it is $2^{-23}\approx1.19\times10^{-7}$ and in a half $2^{-10}\approx9.8\times10^{-4}$. **What is exact.** The result of an operation is exact when it fits: integers up to $2^{53}$, fractions with a power of two in the denominator such as $0.5$ and $0.375$, and anything times a power of two (unless it overflows or underflows). That is why $0.5+0.25=0.75$ is true in floating point while $0.1+0.2=0.3$ is not: the sum $0.1+0.2$ is $0.30000000000000004$, one ulp above the double that is nearest to $0.3$. ## What are infinity, NaN, negative zero and subnormal numbers? **IEEE 754 reserves some patterns for values that are not ordinary numbers, so that every operation has an answer and a long calculation does not stop at the first problem.** - **Infinity.** An exponent field of all ones with fraction $0$ is $\pm\infty$. It is the result of an overflow, such as `Number.MAX_VALUE * 10`, and of dividing a non-zero number by zero in JavaScript or C. Python raises `ZeroDivisionError` for `1 / 0.0`, but `float('inf')` exists, and NumPy returns `inf` with a warning. - **NaN**, "not a number". An exponent field of all ones with a non-zero fraction. It is the result of $0/0$, $\infty-\infty$ and $\sqrt{-1}$ (where these do not raise errors). NaN is unordered: it is not equal to anything, **not even itself**, so `x != x` is the test for NaN (or `isnan`, `Number.isNaN`, `Object.is`), and every comparison with NaN is false. It spreads: any operation with a NaN gives NaN. - **Negative zero.** Sign $1$ with everything else $0$. It is equal to $0$ in comparisons, but $\frac1{+0}=+\infty$ and $\frac1{-0}=-\infty$, which keeps the sign of a limit that approaches $0$ from below. - **Subnormal numbers.** Without them the smallest positive double would be the smallest normal number $2^{-1022}\approx2.2\times10^{-308}$, with a gap to $0$ much larger than the gaps near it. The subnormal numbers (exponent field $0$) fill that gap evenly down to $2^{-1074}\approx4.9\times10^{-324}$, so underflow is gradual: $x-y=0$ happens only when $x=y$. **Overflow and underflow.** A result above the largest double, $1.7976931348623157\times10^{308}$, rounds to $\infty$; a result below half of $2^{-1074}$ rounds to $0$. In practice these appear in products and in exponentials, and the cure is to work with logarithms, or to scale: the length of a vector $\sqrt{x^2+y^2}$ overflows for $x=10^{200}$ although the answer does not, and `hypot(x, y)` avoids it. ## Why do rounding errors add up, and how do you limit them? **Each addition rounds, and the rounding errors of a long sum do not cancel: they add up, and the error of a naive sum grows roughly in proportion to the number of terms.** Add $0.1$ ten times in a double, one at a time, and the result is $0.9999999999999999$; in a single it is $1.0000001192092896$. Add it a million times and a double gives $100000.00000133288$, off by $1.3\times10^{-6}$, about $90\,000$ ulps. The bound for $n$ terms is about $n\cdot u$ times the sum of the absolute values. A large partial sum also **absorbs** small terms: once the total is $2^{53}$ the gap is $2$, so adding $1$ changes nothing, however many times you do it. **Three remedies.** 1. **Kahan summation** keeps a second number $c$ that holds the part that was rounded away in the last addition, and puts it back in the next one: $y=x_i-c$, $t=s+y$, $c=(t-s)-y$, $s=t$. The error then no longer grows with $n$: it stays within an ulp or two. A compiler that rearranges floating-point arithmetic freely can remove the compensation, so the option for strict arithmetic matters. 2. **Pairwise summation** adds in a tree, so that the terms have a similar size and the error grows like $\log n$ instead of $n$. NumPy does this. 3. **Exact summation.** Python's `math.fsum` returns the correctly rounded sum of the exact values by keeping partial sums that do not lose anything. It is the reference to use in tests. Since Python 3.12 the built-in `sum` of floats also uses a compensated algorithm, so `sum([0.1] * 10)` gives `1.0` there, whereas a plain loop still gives `0.9999999999999999`. Try it below: pick a value, a count and a precision. ## What is catastrophic cancellation? **When two nearly equal numbers are subtracted, the leading digits cancel and what is left is mostly the old rounding errors: the result is exact, but the information in it is gone.** Take two computed numbers $a\approx1.0000000000000002$ and $b\approx1$. Each carries a relative error of up to $10^{-16}$, and their difference $2.2\times10^{-16}$ is computed without any new error, but it is of the same size as the errors that $a$ and $b$ already had, so the difference may have no correct digit. The relative error of a subtraction is magnified by about $\frac{|a|+|b|}{|a-b|}$. **Examples.** - $\dfrac{1-\cos x}{x^2}$ for $x=10^{-8}$: $\cos x=1-5\times10^{-17}$ rounds to $1$, so the naive formula gives $0$, and the true value is $\frac12$. Using $1-\cos x=2\sin^2\frac x2$ gives $0.5$. - $\dfrac{e^x-1}{x}$ for $x=10^{-15}$: $e^x$ rounds to $1.000000000000001$, and the naive formula gives $1.1102230246251565$ instead of $1$. The library function `expm1(x)` computes $e^x-1$ directly, and gives $1.0000000000000004$ (the last digit is rounding). - $\sqrt{x^2+1}-x$ for large $x$: for $x=10^8$ the naive formula gives $0$; the stable form $\dfrac1{\sqrt{x^2+1}+x}$ gives $5\times10^{-9}$. - The small root of $x^2-bx+1=0$ for $b=10^8$: $\frac{b-\sqrt{b^2-4}}{2}$ gives $7.45\times10^{-9}$, while the stable form $\frac{2}{b+\sqrt{b^2-4}}$ gives the correct $10^{-8}$. **The cure** is almost never more precision: it is to avoid the subtraction by algebra (a conjugate, an identity), by a series for small $x$, or by a library function made for it (`expm1`, `log1p`, `hypot`). Cancellation also explains why the difference quotient with a tiny $h$ in numerical differentiation gets worse, not better, below $h\approx10^{-8}$. A system of equations whose lines are almost parallel suffers the same way, in its determinant: see [nearly parallel lines](https://nunada.my.id/articles/linear-systems-two-variables/#nearly-parallel-lines). Move $x$ in each of the four cases below and read the number of correct digits. ## How should you compare two floating-point numbers? **Compare computed floats with a tolerance that has a relative part and an absolute part: $|a-b|\le\max\left(\text{rel}\cdot\max(|a|,|b|),\ \text{abs}\right)$.** This is what Python's `math.isclose(a, b, rel_tol=1e-09, abs_tol=0.0)` does, and what you write by hand in JavaScript and C++. - A purely **absolute** tolerance such as $10^{-9}$ is wrong for large numbers: near $10^{16}$ two neighbors are $2$ apart, so no two different numbers are within $10^{-9}$, and near $10^{-12}$ everything is "equal". - A purely **relative** tolerance is wrong near zero: $10^{-300}$ and $0$ are not close in relative terms, although both are "zero" for the problem. So give an absolute part, as small as the scale of the data justifies, when the true value can be zero. - The relative part should be a few times the unit roundoff times the number of operations: $10^{-9}$ is a common choice for doubles, and about $10^{-5}$ for singles. - **ulps.** In tests of numerical code the distance in ulps, the number of floats between the two numbers, is a measure that scales with the size: `0.1 + 0.2` and `0.3` are $1$ ulp apart. - **Never loop on equality.** `while x != 1.0: x += 0.1` never ends, because $x$ steps over $1.0$ and goes on forever. Count with an integer, or loop while `x < 1.0 - 1e-9`. - **NaN** is never close to anything, itself included; test for it separately. **Money.** Prices are not real numbers: they are integers of the smallest unit. Store cents, or use a decimal type (Python `decimal.Decimal`, Java `BigDecimal`, C# `decimal`), where $0.1+0.2=0.3$ holds exactly because the base is $10$. ## Which type should you use: float16, float32, float64 or a decimal? **Use a double unless you have a reason not to; use less precision when memory and speed matter more than digits, and an exact type when the answer must be exact.** - **float64 (double):** the default for science and engineering and for most programs. About 16 digits and a range up to $10^{308}$. - **float32 (single):** graphics, games and GPUs, where $7$ digits are enough and halving the memory doubles the throughput. Be careful with sums of many terms and with integers above $2^{24}$ (it counts from $16\,777\,216$ upward in steps of $2$). - **float16 and bfloat16:** machine learning. Half precision has $11$ bits of precision and a maximum of $65504$; bfloat16 keeps the range of a single (8 exponent bits) with only $8$ bits of precision, which suits the large dynamic range of neural-network training. Both are used with care, often accumulating in float32. - **Decimal, integers, fractions:** money, counts and exact ratios. Python's `fractions.Fraction` and `decimal.Decimal` are exact for the numbers they can hold but slower. - **Arbitrary precision** (`mpmath`, `BigDecimal`, GMP): when a calculation needs more digits than a double has, at a cost in speed. **Two famous failures.** In February 1991 a Patriot missile battery at Dhahran failed to intercept a Scud. Its clock counted tenths of a second in a $24$-bit register, and $0.1$ is not exact in binary: the error was about $0.000000095$ s per tick, which after about $100$ hours of operation was about $0.34$ s, enough for a Scud, which travels more than $1.6$ km each second, to be half a kilometer away from where the system looked for it. In June 1996 the first Ariane 5 rocket was lost about $37$ seconds after launch when a $64$-bit floating-point value was converted to a $16$-bit signed integer that was too small for it: an overflow, not a rounding error, but in the same family, a conversion that was never checked. ## How do you inspect floating-point numbers in code? **Every language lets you look at the bits and the spacing: Python with `struct`, `math.ulp` and `decimal.Decimal`, JavaScript with a `DataView`, and C++ with a loop that finds the machine epsilon.** The programs below show the bit patterns of $0.1$ and $-2.5$, the exact value of $0.1$, the epsilon and the ulp, the neighbor of `0.1 + 0.2`, the three kinds of sum, absorption, tolerance comparison, cancellation and NaN. ```python import math import struct import sys from decimal import Decimal def bits(x): """The 64 bits of a double as sign, exponent and fraction.""" b = format(struct.unpack('>Q', struct.pack('>d', x))[0], '064b') return b[0], b[1:12], b[12:] def naive(xs): total = 0.0 for x in xs: total += x return total def kahan(xs): total = comp = 0.0 for x in xs: y = x - comp t = total + y comp = (t - total) - y total = t return total print(bits(0.1)) print(bits(-2.5)) print(Decimal(0.1)) print(sys.float_info.epsilon, math.ulp(1.0), math.ulp(2.0 ** 53)) print(math.nextafter(0.1 + 0.2, 0.0) == 0.3) print(naive([0.1] * 10), kahan([0.1] * 10), math.fsum([0.1] * 10)) print(naive([0.1] * 1000000), kahan([0.1] * 1000000), math.fsum([0.1] * 1000000)) print(1e16 + 1 == 1e16, 2.0 ** 53 + 1 == 2.0 ** 53) print(math.isclose(0.1 + 0.2, 0.3), 0.1 + 0.2 == 0.3) x = 1e-8 print((1 - math.cos(x)) / x ** 2, 2 * math.sin(x / 2) ** 2 / x ** 2) print((math.exp(1e-15) - 1) / 1e-15, math.expm1(1e-15) / 1e-15) print(float('nan') == float('nan'), math.isnan(float('nan')), float('inf') - float('inf')) print(Decimal('0.1') + Decimal('0.2') == Decimal('0.3')) # ('0', '01111111011', '1001100110011001100110011001100110011001100110011010') # ('1', '10000000000', '0100000000000000000000000000000000000000000000000000') # 0.1000000000000000055511151231257827021181583404541015625 # 2.220446049250313e-16 2.220446049250313e-16 2.0 # True # 0.9999999999999999 1.0 1.0 # 100000.00000133288 100000.0 100000.0 # True True # True False # 0.0 0.5 # 1.1102230246251565 1.0000000000000004 # False True nan # True ``` ```javascript const bits = (x) => { const v = new DataView(new ArrayBuffer(8)) v.setFloat64(0, x) return v.getBigUint64(0).toString(2).padStart(64, '0') } bits(1) // '0011111111110000000000000000000000000000000000000000000000000000' bits(0.1) // '0011111110111001100110011001100110011001100110011001100110011010' Number.EPSILON // 2.220446049250313e-16 ;[Math.fround(0.1), 0.1] // [0.10000000149011612, 0.1]: the nearest single to 0.1 ;[2 ** 53 + 1 === 2 ** 53, 2 ** 53 + 2] // [true, 9007199254740994] ;[0 / 0, 1 / 0, 1 / -0] // [NaN, Infinity, -Infinity] ;[NaN === NaN, Object.is(NaN, NaN)] // [false, true] ;[Object.is(0, -0), 0 === -0] // [false, true] ;[Number.MAX_VALUE * 10, 5e-324 / 2] // [Infinity, 0]: overflow, and underflow past the smallest subnormal ;[0.1 + 0.2, 0.1 + 0.2 === 0.3] // [0.30000000000000004, false] Math.abs(0.1 + 0.2 - 0.3) < Number.EPSILON // true: a tolerance of one machine epsilon is fine near 1 ;[Math.fround(16777217), 16777217] // [16777216, 16777217]: a single cannot hold 2^24 + 1 let s32 = 0 for (let i = 0; i < 10; i++) s32 = Math.fround(s32 + Math.fround(0.1)) s32 // 1.0000001192092896: ten tenths in single precision ``` ```cpp #include #include #include using namespace std; int main() { double eps = 1; int count = 0; while (1 + eps / 2 > 1) { // halve until 1 + eps/2 is rounded back to 1 eps = eps / 2; count = count + 1; } printf("%d %.17f\n", count, eps); // 52 halvings: eps = 2^-52 double s = 0; for (int i = 0; i < 10; i++) s = s + 0.1; printf("%.17f %d\n", s, s == 1.0); // ten times 0.1 is not 1 double big = 9007199254740992.0; // 2^53 printf("%d %d\n", big + 1 == big, big + 2 == big); // 1 0: the 1 is absorbed, the 2 is a whole gap return 0; } /* output: 52 0.00000000000000022 0.99999999999999989 0 1 0 */ ``` ## Where does floating point come from? **Floating point is older than the electronic computer, and for decades each machine had its own format until a standard made programs portable.** - **1914.** Leonardo Torres Quevedo proposed floating-point arithmetic for a mechanical calculator in his Essays on Automatics. - **1930s–1941.** Konrad Zuse's machines, the Z1 and the Z3, used binary floating point, with a sign, an exponent and a fraction. - **1954.** The IBM 704 had floating-point arithmetic in hardware, and through the 1960s and 1970s every maker chose its own base, size and rounding, so that the same program gave different answers on different computers. - **1980s.** William Kahan, who had worked on Intel's 8087 coprocessor, led the committee that wrote **IEEE 754**, published in 1985: formats, correct rounding, infinities, NaN and gradual underflow. Kahan received the Turing Award in 1989. - **1994.** The Pentium FDIV bug, a few wrong entries in a table used by the divider, gave results that were wrong in the fourth or fifth significant digit or beyond, and showed that floating-point hardware had to be tested as carefully as software; Intel recalled the chips. - **2008 and 2019.** The standard was revised: fused multiply-add (computing $a\times b+c$ with one rounding), decimal formats, half precision as an exchange format, and clearer rules for NaN and for operations such as the minimum and the maximum. - **2010s.** bfloat16, with the exponent range of a single and only $8$ bits of precision, was designed for machine-learning hardware, and half precision became common on GPUs. ## What mistakes do people make with floating-point numbers? **The most common mistakes with floating-point numbers are the nine below, each with the correct statement.** | Mistake | Correct | |---|---| | ❌ Test a computed float with `==` | Compare with a relative and an absolute tolerance, or by the distance in ulps. | | ❌ Floats are evenly spaced | The gap doubles at every power of two: $2^{-52}$ near $1$, $2$ near $2^{53}$. | | ❌ Floats hold all integers | Doubles are exact only up to $2^{53}$ and singles up to $2^{24}$. | | ❌ A float has 16 digits after the point | It has about 16 significant digits, wherever the point is. | | ❌ Add a small number to a big one and trust it | It may be absorbed: `1e16 + 1 == 1e16`. | | ❌ Use more precision to fix subtraction | Rewrite the formula so that nearly equal numbers are not subtracted. | | ❌ Loop with `while x != 1.0` | The float steps over the value: count with an integer. | | ❌ NaN equals NaN | NaN is not equal to anything, itself included; use `isnan`. | | ❌ Use floats for money | Store integer cents or use a decimal type. | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: floating-point numbers at a glance - **Format:** $(-1)^s\times(1.f)_2\times2^e$; a double is $1+11+52$ bits, bias $1023$, $53$ bits of precision, about $16$ digits. - **Spacing:** the gap doubles at every power of two; integers are exact up to $2^{53}$ (a single: $2^{24}$). - **Rounding:** correctly rounded, ties to even, relative error at most $u=2^{-53}$; machine epsilon $2^{-52}$. - **Special values:** $\pm0$, $\pm\infty$, NaN (not equal to itself), subnormal numbers for gradual underflow. - **Errors:** they accumulate in sums, are absorbed by large numbers, and cancellation destroys digits in subtractions of nearly equal numbers. - **Remedies:** Kahan or pairwise or exact sums, algebraic rewriting, `expm1`, `log1p`, `hypot`. - **Compare:** with a relative and an absolute tolerance, or in ulps; never loop on `==`. - **Choose:** float64 by default, float32 or lower for memory and speed, integers or decimals for money. - **Code:** `struct`, `math.ulp`, `math.fsum`, `math.isclose`, `decimal` in Python; `DataView` and `Number.EPSILON` in JavaScript. ## Glossary: key terms - **Floating-point number**: A number stored as a sign, an exponent and a fixed number of significant bits, so that the point floats with the exponent. - **IEEE 754**: The standard that defines the binary floating-point formats, correct rounding, infinities, NaN and gradual underflow used by almost all hardware. - **Machine epsilon**: The gap between 1 and the next number of a format: 2 to the power minus 52 for a double. - **Ulp**: The unit in the last place: the gap between a floating-point number and the next one. - **Subnormal number**: A number below the smallest normal one, stored with exponent field zero and no implied leading 1, which makes underflow gradual. - **NaN**: Not a number: the result of operations such as zero over zero, not equal even to itself. - **Absorption**: The loss of a small number when it is added to a much larger one, because the sum rounds back to the larger number. - **Catastrophic cancellation**: The loss of most correct digits when two nearly equal numbers are subtracted, exposing the rounding errors they already had. ## Frequently asked questions ### What is a floating-point number? It is a number stored in binary scientific notation: a sign, an exponent and a fixed number of fraction bits. The exponent moves the binary point, which gives a huge range, while the fixed number of bits limits the precision. ### What is the difference between float and double? A float usually means a 32-bit single with 24 bits of precision, about 7 decimal digits, and a double is a 64-bit number with 53 bits of precision, about 16 digits. Python and JavaScript numbers are doubles. ### How are the bits of a double organized? One sign bit, eleven exponent bits with a bias of 1023, and fifty-two fraction bits with an implied leading 1. Exponent fields of all zeros and all ones are reserved for zero, subnormal numbers, infinity and NaN. ### What is machine epsilon? It is the gap between 1 and the next number a format can store: 2 to the power minus 52, about 2.2 times ten to the minus 16, for a double. It measures the relative precision of the format. ### Why is NaN not equal to itself? IEEE 754 defines every comparison with NaN as false, because NaN stands for the lack of a value, and two missing values need not be the same. So testing x not equal to x is a way to detect NaN, as is a function like isnan. ### What are subnormal numbers? They are numbers smaller than the smallest normal number, stored with an exponent field of zero and no implied leading 1. They fill the gap next to zero evenly, so that underflow is gradual and subtracting two different numbers never gives zero. ### What is catastrophic cancellation? It is the loss of most correct digits when two nearly equal numbers are subtracted. The leading digits cancel and the result is dominated by the rounding errors the numbers already had, so the formula has to be rewritten to avoid the subtraction. ### Which floating-point type should I use? Use a 64-bit double by default. Use a 32-bit float for graphics and when memory matters, and 16-bit formats for machine learning. For money use integers or a decimal type, since binary floats cannot hold amounts such as 0.10 exactly. --- # Bilangan Floating-Point Source: https://nunada.my.id/artikel/bilangan-floating-point/ Updated: 2026-10-30 ## Jawaban singkat **Bilangan floating-point adalah bilangan biner dalam notasi ilmiah, disimpan sebagai tanda, eksponen, dan sejumlah tetap bit pecahan, sehingga rentangnya sangat besar tetapi hanya sekitar 16 angka desimal (untuk 64 bit).** Bilangan tidak berjarak sama: jaraknya berlipat dua di setiap pangkat dua, setiap operasi membulatkan ke nilai terdekat yang muat, dan galat kecilnya dapat menumpuk, menghapus angka, atau terserap. ### Poin penting - Sebuah double 64 bit adalah $(-1)^s\times(1.f)_2\times2^{e}$: 1 bit tanda, 11 bit eksponen, dan 52 bit pecahan. Angka 1 di depan tidak disimpan, sehingga ketelitiannya 53 bit, sekitar 15,95 angka desimal. - Bilangannya tidak berjarak sama. Di antara $2^k$ dan $2^{k+1}$ selalu ada jumlah yang sama, sehingga jaraknya berlipat dua di setiap pangkat dua; mulai $2^{53}$ jarak pada double adalah $2$, dan bilangan bulat ganjil tidak ada lagi. - Setiap operasi dasar dibulatkan ke bilangan terdekat yang dapat disajikan, seri ke genap, sehingga $\mathrm{fl}(a\circ b)=(a\circ b)(1+\delta)$ dengan $|\delta|\le u=2^{-53}\approx1{,}1\times10^{-16}$. Jarak di atas $1$ adalah epsilon mesin $2^{-52}$. - Pola khusus: $\pm0$, $\pm\infty$, dan NaN, yang tidak sama bahkan dengan dirinya sendiri; bilangan subnormal mengisi celah antara $0$ dan bilangan normal terkecil, sehingga underflow berlangsung bertahap. - Galat pembulatan menumpuk ketika kamu menjumlahkan banyak bilangan, hilang ke dalam bilangan besar (penyerapan), dan membuat pengurangan dua bilangan yang hampir sama kehilangan angka (pembatalan). Jumlah berkompensasi, penulisan ulang aljabar, dan fungsi pustaka seperti `expm1` membatasi kerusakannya. - Bandingkan float dengan toleransi relatif dan mutlak, jangan dengan `==` setelah perhitungan; pakai bilangan bulat atau tipe desimal untuk uang; dan pilih float16, bfloat16, float32, atau float64 menurut rentang dan angka yang diperlukan soal. ## Apa itu bilangan floating-point? **Bilangan floating-point adalah bilangan yang ditulis dalam notasi ilmiah biner dengan jumlah angka tetap: tanda, signifikan (angkanya), dan eksponen yang menyatakan letak titiknya.** Dalam desimal, notasi ilmiah menulis $-6{,}02\times10^{23}$ atau $1{,}6\times10^{-19}$: beberapa angka signifikan dan pangkat sepuluh. Komputer melakukan hal yang sama dalam basis $2$: $$x=(-1)^s\times(1.f_1f_2f_3\ldots f_m)_2\times2^{e}.$$ Titiknya "mengambang" karena eksponen $e$ menggesernya, sehingga format yang sama memuat ukuran alam semesta dan ukuran atom. Harganya adalah jumlah angka $m+1$ tetap, sehingga setiap bilangan hanya memiliki angka signifikan yang terbatas, sebesar atau sekecil apa pun ia. **Mengapa bukan titik tetap?** Format titik tetap menjaga titik di satu tempat, misalnya selalu $16$ angka biner setelahnya. Maka ia tidak dapat memuat $10^{30}$ dan $10^{-30}$ sekaligus; floating-point mengorbankan sebagian ketelitian untuk menjangkau seluruh rentang itu. **Standarnya.** Hampir semua perangkat keras mengikuti IEEE 754. Ia mendefinisikan beberapa format biner, yang berbeda dalam banyaknya bit untuk eksponen dan untuk pecahan: | Format | Bit | Tanda + eksponen + pecahan | Bit signifikan | Angka desimal | Nilai terbesar | |---|---|---|---|---|---| | half, float16 | 16 | 1 + 5 + 10 | 11 | sekitar 3,3 | 65504 | | bfloat16 | 16 | 1 + 8 + 7 | 8 | sekitar 2,4 | sekitar $3{,}4\times10^{38}$ | | single, float32 | 32 | 1 + 8 + 23 | 24 | sekitar 7,2 | sekitar $3{,}4\times10^{38}$ | | double, float64 | 64 | 1 + 11 + 52 | 53 | sekitar 15,95 | sekitar $1{,}8\times10^{308}$ | Banyaknya angka desimal adalah banyaknya bit signifikan dikali $\log_{10}2\approx0{,}301$. Di Python `float` adalah double, di JavaScript setiap `Number` adalah double, dan di C dan C++ `double` adalah double dan `float` adalah single. Artikel ini membahas apa yang dilakukan format-format ini, dengan cara yang penting ketika kamu menulis kode; [bilangan real](https://nunada.my.id/artikel/bilangan-real/#real-numbers-in-code) menjelaskan versi singkatnya, dan [bilangan biner](https://nunada.my.id/artikel/bilangan-biner/#binary-fractions) menjelaskan mengapa $0{,}1$ tidak punya ekspansi biner berhingga. ## Bagaimana bit sebuah double disusun? **Sebuah double memiliki tiga bidang: 1 bit tanda, 11 bit eksponen, dan 52 bit pecahan, dan nilainya mengikuti bidang eksponen.** - **Bilangan normal** (bidang eksponen $1$ sampai $2046$): nilainya $(-1)^s\times\left(1+\frac{F}{2^{52}}\right)\times2^{E-1023}$, dengan $E$ bidang eksponen yang dibaca sebagai bilangan bulat, $F$ bidang pecahan, dan $1023$ adalah bias. Angka $1$ di depan tersirat, itulah sebabnya $52$ bit tersimpan memberi ketelitian $53$ bit. Bias memungkinkan eksponen disimpan tanpa tandanya sendiri. - **Bidang eksponen $0$:** nilai $\pm0$ jika pecahannya $0$, dan selain itu bilangan subnormal $(-1)^s\times\frac{F}{2^{52}}\times2^{-1022}$ tanpa angka $1$ tersirat. - **Bidang eksponen $2047$** (berisi satu semua): $\pm\infty$ jika pecahannya $0$, dan selain itu NaN. **Dua contoh.** Bilangan $-2{,}5=-1{,}25\times2^1$ bertanda $1$, bidang eksponen $1+1023=1024=10000000000_2$ dan pecahan $0100\ldots0$ (bagian $0{,}25$ dari $1{,}25$), sehingga polanya dalam heksadesimal adalah `C004000000000000`. Bilangan $0{,}1$ adalah $1{,}6000000000000000888\ldots\times2^{-4}$: tanda $0$, bidang eksponen $1019$, dan pecahan yang berulang $1001\,1001\ldots$ dan dibulatkan ke atas di ujungnya, menghasilkan `3FB999999999999A`. `A` terakhir itu adalah pembulatannya, dan itulah sebabnya nilai yang tersimpan adalah $$0{,}1000000000000000055511151231257827021181583404541015625,$$ sedikit lebih dari $0{,}1$. Untuk single, bilangannya sama kecuali bias $127$ dan ada $8$ dan $23$ bit. Ketik sebuah bilangan di bawah dan pilih format. Widget menunjukkan tiga bidang, rumus yang diwakilinya, nilai tepat yang tersimpan, galat pembulatannya, dan tetangga di atas dan di bawah. ## Mengapa bilangan floating-point tidak berjarak sama? **Di antara dua pangkat dua berurutan, $2^k$ dan $2^{k+1}$, suatu format selalu memiliki jumlah nilai yang sama ($2^{52}$ untuk double), sehingga jarak antartetangga adalah $2^{k-52}$ dan berlipat dua di setiap pangkat dua.** Di dekat $1$ jaraknya $2^{-52}\approx2{,}2\times10^{-16}$; di dekat $1000$ jaraknya $1{,}1\times10^{-13}$; di dekat $10^{16}$ jaraknya $2$. Jarak relatif, jarak dibagi bilangannya, tetap di antara $2^{-53}$ dan $2^{-52}$ di mana-mana, dan itulah arti "sekitar 16 angka". Jarak antara sebuah bilangan dan bilangan berikutnya disebut ulp, unit pada tempat terakhir. Format dengan sangat sedikit bit memperlihatkannya dengan jelas. Ambil $1$ bit tanda, $3$ bit eksponen (bias $3$), dan $2$ bit pecahan. Bilangan tak negatifnya adalah $$0,\ \tfrac1{16},\ \tfrac1{8},\ \tfrac3{16},\ \tfrac14,\ \tfrac5{16},\ \tfrac38,\ \tfrac7{16},\ \tfrac12,\ \tfrac58,\ \tfrac34,\ \tfrac78,\ 1,\ \tfrac54,\ \tfrac32,\ \tfrac74,\ 2,\ \ldots,\ 14.$$ Di antara $\frac14$ dan $\frac12$ ada empat bilangan, berjarak seperempat celah, seperti di antara $1$ dan $2$, tetapi di sana jaraknya empat kali lebih besar. Bilangan di bawah $\frac14$, bilangan subnormal, berbagi satu jarak, $\frac1{16}$, yaitu jarak binade pertama: itulah yang membuat format mencapai $0$ secara bertahap, bukan melompat dari $\frac14$ ke $0$. Dua akibat penting dalam kode. Pertama, **bilangan bulat tepat hanya sampai $2^{53}$** pada double ($9\,007\,199\,254\,740\,992$) dan sampai $2^{24}=16\,777\,216$ pada single: di atasnya jaraknya $2$, sehingga $2^{53}+1$ dibulatkan kembali ke $2^{53}$. Kedua, bilangan besar menyerap bilangan kecil: `1e16 + 1 == 1e16` bernilai benar. Pilih banyaknya bit di bawah dan geser melewati bilangannya. Tabel memberi jarak tiap pangkat dua. ## Bagaimana komputer membulatkan, dan apa itu epsilon mesin? **IEEE 754 mewajibkan + − × ÷ dan akar kuadrat menghasilkan hasil yang dibulatkan dengan tepat: jawaban eksak yang dibulatkan ke bilangan format terdekat, dan pada seri ke yang bit pecahan terakhirnya genap.** Pembulatan ke genap terdekat menghindari bias: dengan seri selalu dibulatkan ke atas, perhitungan panjang akan bergeser ke atas. Mode lain (ke arah $0$, ke arah $+\infty$, ke arah $-\infty$) ada untuk aritmetika selang dan kasus khusus. **Model standar.** Asalkan tidak ada overflow atau underflow, $$\mathrm{fl}(a\circ b)=(a\circ b)(1+\delta),\qquad|\delta|\le u,$$ dengan $\circ$ operasi apa pun dan $u=2^{-53}\approx1{,}11\times10^{-16}$ untuk double adalah pembulatan satuan. Setiap operasi seteliti yang diizinkan format, dan seluruh cerita galat numerik adalah bagaimana galat relatif kecil ini bergabung. **Epsilon mesin.** Jarak antara $1$ dan double berikutnya adalah $2^{-52}\approx2{,}22\times10^{-16}$, disebut epsilon mesin (di Python `sys.float_info.epsilon`, di JavaScript `Number.EPSILON`); ia dua kali pembulatan satuan. Pada single nilainya $2^{-23}\approx1{,}19\times10^{-7}$ dan pada half $2^{-10}\approx9{,}8\times10^{-4}$. **Apa yang tepat.** Hasil sebuah operasi tepat bila muat: bilangan bulat sampai $2^{53}$, pecahan dengan pangkat dua di penyebut seperti $0{,}5$ dan $0{,}375$, dan apa pun dikali pangkat dua (kecuali overflow atau underflow). Itulah sebabnya $0{,}5+0{,}25=0{,}75$ benar dalam floating point sedangkan $0{,}1+0{,}2=0{,}3$ tidak: jumlah $0{,}1+0{,}2$ adalah $0{,}30000000000000004$, satu ulp di atas double yang terdekat dengan $0{,}3$. ## Apa itu tak hingga, NaN, nol negatif, dan bilangan subnormal? **IEEE 754 mencadangkan beberapa pola untuk nilai yang bukan bilangan biasa, sehingga setiap operasi punya jawaban dan perhitungan panjang tidak berhenti pada masalah pertama.** - **Tak hingga.** Bidang eksponen berisi satu semua dengan pecahan $0$ adalah $\pm\infty$. Ia hasil overflow, seperti `Number.MAX_VALUE * 10`, dan dari membagi bilangan tak nol dengan nol di JavaScript atau C. Python memunculkan `ZeroDivisionError` untuk `1 / 0.0`, tetapi `float('inf')` ada, dan NumPy mengembalikan `inf` dengan peringatan. - **NaN**, "bukan bilangan". Bidang eksponen berisi satu semua dengan pecahan tak nol. Ia hasil $0/0$, $\infty-\infty$, dan $\sqrt{-1}$ (bila ini tidak memunculkan galat). NaN tak terurut: ia tidak sama dengan apa pun, **bahkan tidak dengan dirinya sendiri**, sehingga `x != x` adalah uji untuk NaN (atau `isnan`, `Number.isNaN`, `Object.is`), dan setiap perbandingan dengan NaN salah. Ia menular: operasi apa pun dengan NaN menghasilkan NaN. - **Nol negatif.** Tanda $1$ dengan sisanya $0$. Ia sama dengan $0$ dalam perbandingan, tetapi $\frac1{+0}=+\infty$ dan $\frac1{-0}=-\infty$, yang menjaga tanda limit yang mendekati $0$ dari bawah. - **Bilangan subnormal.** Tanpa mereka, double positif terkecil adalah bilangan normal terkecil $2^{-1022}\approx2{,}2\times10^{-308}$, dengan celah ke $0$ jauh lebih besar daripada celah di dekatnya. Bilangan subnormal (bidang eksponen $0$) mengisi celah itu secara merata sampai $2^{-1074}\approx4{,}9\times10^{-324}$, sehingga underflow berlangsung bertahap: $x-y=0$ hanya terjadi ketika $x=y$. **Overflow dan underflow.** Hasil di atas double terbesar, $1{,}7976931348623157\times10^{308}$, dibulatkan ke $\infty$; hasil di bawah setengah $2^{-1074}$ dibulatkan ke $0$. Dalam praktik ini muncul pada hasil kali dan eksponensial, dan obatnya adalah bekerja dengan logaritma, atau menskalakan: panjang vektor $\sqrt{x^2+y^2}$ overflow untuk $x=10^{200}$ padahal jawabannya tidak, dan `hypot(x, y)` menghindarinya. ## Mengapa galat pembulatan menumpuk, dan bagaimana membatasinya? **Setiap penjumlahan membulatkan, dan galat pembulatan pada jumlah yang panjang tidak saling menghapus: ia menumpuk, dan galat jumlah naif tumbuh kira-kira sebanding dengan banyaknya suku.** Jumlahkan $0{,}1$ sepuluh kali pada double, satu per satu, dan hasilnya $0{,}9999999999999999$; pada single hasilnya $1{,}0000001192092896$. Jumlahkan sejuta kali dan double memberi $100000{,}00000133288$, meleset $1{,}3\times10^{-6}$, sekitar $90\,000$ ulp. Batas untuk $n$ suku sekitar $n\cdot u$ kali jumlah nilai mutlaknya. Jumlah parsial yang besar juga **menyerap** suku kecil: begitu totalnya $2^{53}$ jaraknya $2$, sehingga menambah $1$ tidak mengubah apa pun, berapa kali pun kamu melakukannya. **Tiga obat.** 1. **Penjumlahan Kahan** menyimpan bilangan kedua $c$ yang memuat bagian yang dibulatkan pada penjumlahan terakhir, dan memasukkannya kembali pada penjumlahan berikutnya: $y=x_i-c$, $t=s+y$, $c=(t-s)-y$, $s=t$. Galatnya lalu tidak lagi tumbuh bersama $n$: ia tetap dalam satu atau dua ulp. Kompilator yang menyusun ulang aritmetika floating-point dengan bebas dapat menghilangkan kompensasinya, sehingga opsi untuk aritmetika ketat penting. 2. **Penjumlahan berpasangan** menjumlahkan dalam pohon, sehingga suku-sukunya berukuran mirip dan galat tumbuh seperti $\log n$, bukan $n$. NumPy melakukannya. 3. **Penjumlahan tepat.** `math.fsum` di Python mengembalikan jumlah nilai eksak yang dibulatkan dengan tepat dengan menyimpan jumlah parsial yang tidak kehilangan apa pun. Ia acuan yang dipakai dalam uji. Sejak Python versi `3.12` `sum` bawaan untuk float juga memakai algoritma berkompensasi, sehingga `sum([0.1] * 10)` memberi `1.0` di sana, sedangkan perulangan biasa tetap memberi `0.9999999999999999`. Cobalah di bawah: pilih nilai, jumlah, dan ketelitian. ## Apa itu pembatalan katastrofik? **Ketika dua bilangan yang hampir sama dikurangkan, angka terdepan saling menghapus dan yang tersisa kebanyakan galat pembulatan lama: hasilnya eksak, tetapi informasi di dalamnya hilang.** Ambil dua bilangan hasil hitung $a\approx1{,}0000000000000002$ dan $b\approx1$. Masing-masing membawa galat relatif sampai $10^{-16}$, dan selisihnya $2{,}2\times10^{-16}$ dihitung tanpa galat baru, tetapi ia sebesar galat yang sudah dimiliki $a$ dan $b$, sehingga selisihnya mungkin tidak memiliki satu pun angka benar. Galat relatif pengurangan diperbesar sekitar $\frac{|a|+|b|}{|a-b|}$. **Contoh.** - $\dfrac{1-\cos x}{x^2}$ untuk $x=10^{-8}$: $\cos x=1-5\times10^{-17}$ dibulatkan ke $1$, sehingga rumus naif memberi $0$, padahal nilai sebenarnya $\frac12$. Memakai $1-\cos x=2\sin^2\frac x2$ memberi $0{,}5$. - $\dfrac{e^x-1}{x}$ untuk $x=10^{-15}$: $e^x$ dibulatkan ke $1{,}000000000000001$, dan rumus naif memberi $1{,}1102230246251565$, bukan $1$. Fungsi pustaka `expm1(x)` menghitung $e^x-1$ langsung, dan memberi $1{,}0000000000000004$ (angka terakhir adalah pembulatan). - $\sqrt{x^2+1}-x$ untuk $x$ besar: untuk $x=10^8$ rumus naif memberi $0$; bentuk stabil $\dfrac1{\sqrt{x^2+1}+x}$ memberi $5\times10^{-9}$. - Akar kecil $x^2-bx+1=0$ untuk $b=10^8$: $\frac{b-\sqrt{b^2-4}}{2}$ memberi $7{,}45\times10^{-9}$, sedangkan bentuk stabil $\frac{2}{b+\sqrt{b^2-4}}$ memberi $10^{-8}$ yang benar. **Obatnya** hampir tidak pernah ketelitian lebih besar: ia menghindari pengurangan dengan aljabar (sekawan, identitas), dengan deret untuk $x$ kecil, atau dengan fungsi pustaka yang dibuat untuknya (`expm1`, `log1p`, `hypot`). Pembatalan juga menjelaskan mengapa hasil bagi selisih dengan $h$ sangat kecil pada diferensiasi numerik justru memburuk, bukan membaik, di bawah $h\approx10^{-8}$. Sistem persamaan yang garisnya hampir sejajar mengalami hal yang sama, pada determinannya: lihat [garis yang hampir sejajar](https://nunada.my.id/artikel/sistem-persamaan-linear-dua-variabel/#nearly-parallel-lines). Geser $x$ pada tiap empat kasus di bawah dan baca banyaknya angka benar. ## Bagaimana membandingkan dua bilangan floating-point? **Bandingkan float hasil hitung dengan toleransi yang memiliki bagian relatif dan bagian mutlak: $|a-b|\le\max\left(\text{rel}\cdot\max(|a|,|b|),\ \text{abs}\right)$.** Inilah yang dilakukan `math.isclose(a, b, rel_tol=1e-09, abs_tol=0.0)` di Python, dan yang kamu tulis sendiri di JavaScript dan C++. - Toleransi **mutlak** murni seperti $10^{-9}$ salah untuk bilangan besar: di dekat $10^{16}$ dua tetangga berjarak $2$, sehingga tidak ada dua bilangan berbeda yang berjarak kurang dari $10^{-9}$, dan di dekat $10^{-12}$ semuanya "sama". - Toleransi **relatif** murni salah di dekat nol: $10^{-300}$ dan $0$ tidak dekat secara relatif, padahal keduanya "nol" bagi soalnya. Jadi beri bagian mutlak, sekecil yang dibenarkan skala datanya, bila nilai sebenarnya dapat nol. - Bagian relatif sebaiknya beberapa kali pembulatan satuan dikali banyaknya operasi: $10^{-9}$ pilihan umum untuk double, dan sekitar $10^{-5}$ untuk single. - **ulp.** Dalam uji kode numerik jarak dalam ulp, banyaknya float di antara kedua bilangan, adalah ukuran yang menyesuaikan dengan besarnya: `0.1 + 0.2` dan `0.3` berjarak $1$ ulp. - **Jangan pernah mengulang berdasarkan kesamaan.** `while x != 1.0: x += 0.1` tidak pernah berhenti, karena $x$ melangkahi $1{,}0$ dan terus berjalan. Hitung dengan bilangan bulat, atau ulangi selama `x < 1.0 - 1e-9`. - **NaN** tidak pernah dekat dengan apa pun, termasuk dirinya; ujilah secara terpisah. **Uang.** Harga bukan bilangan real: ia bilangan bulat dari satuan terkecil. Simpan sen, atau pakai tipe desimal (`decimal.Decimal` di Python, `BigDecimal` di Java, `decimal` di C#), tempat $0{,}1+0{,}2=0{,}3$ berlaku tepat karena basisnya $10$. ## Tipe apa yang dipakai: float16, float32, float64, atau desimal? **Pakai double kecuali ada alasan untuk tidak; pakai ketelitian lebih rendah bila memori dan kecepatan lebih penting daripada angka, dan tipe eksak bila jawabannya harus eksak.** - **float64 (double):** bawaan untuk sains dan rekayasa dan untuk kebanyakan program. Sekitar 16 angka dan rentang sampai $10^{308}$. - **float32 (single):** grafika, permainan, dan GPU, tempat $7$ angka cukup dan separuh memori melipatduakan lajunya. Hati-hati dengan jumlah banyak suku dan dengan bilangan bulat di atas $2^{24}$ (ia mencacah dari $16\,777\,216$ ke atas dengan langkah $2$). - **float16 dan bfloat16:** pembelajaran mesin. Half punya ketelitian $11$ bit dan maksimum $65504$; bfloat16 mempertahankan rentang single (8 bit eksponen) dengan ketelitian hanya $8$ bit, yang cocok untuk rentang dinamis besar pelatihan jaringan saraf. Keduanya dipakai dengan hati-hati, sering dengan akumulasi dalam float32. - **Desimal, bilangan bulat, pecahan:** uang, hitungan, dan rasio eksak. `fractions.Fraction` dan `decimal.Decimal` di Python eksak untuk bilangan yang dapat mereka muat tetapi lebih lambat. - **Ketelitian sembarang** (`mpmath`, `BigDecimal`, GMP): ketika perhitungan memerlukan lebih banyak angka daripada yang dimiliki double, dengan biaya kecepatan. **Dua kegagalan terkenal.** Pada Februari 1991 baterai rudal Patriot di Dhahran gagal mencegat sebuah Scud. Jamnya menghitung persepuluh detik dalam register $24$ bit, dan $0{,}1$ tidak eksak dalam biner: galatnya sekitar $0{,}000000095$ detik per detakan, yang setelah sekitar $100$ jam operasi menjadi sekitar $0{,}34$ detik, cukup agar Scud, yang menempuh lebih dari $1{,}6$ km setiap detik, berada setengah kilometer dari tempat sistem mencarinya. Pada Juni 1996 roket Ariane 5 pertama hilang sekitar $37$ detik setelah peluncuran ketika sebuah nilai floating-point $64$ bit diubah menjadi bilangan bulat bertanda $16$ bit yang terlalu kecil untuknya: overflow, bukan galat pembulatan, tetapi dalam keluarga yang sama, konversi yang tidak pernah diperiksa. ## Bagaimana memeriksa bilangan floating-point dalam kode? **Setiap bahasa memungkinkanmu melihat bit dan jaraknya: Python dengan `struct`, `math.ulp`, dan `decimal.Decimal`, JavaScript dengan `DataView`, dan C++ dengan perulangan yang mencari epsilon mesin.** Program di bawah menunjukkan pola bit $0{,}1$ dan $-2{,}5$, nilai tepat $0{,}1$, epsilon dan ulp, tetangga `0.1 + 0.2`, tiga jenis jumlah, penyerapan, perbandingan dengan toleransi, pembatalan, dan NaN. ```python import math import struct import sys from decimal import Decimal def bits(x): """The 64 bits of a double as sign, exponent and fraction.""" b = format(struct.unpack('>Q', struct.pack('>d', x))[0], '064b') return b[0], b[1:12], b[12:] def naive(xs): total = 0.0 for x in xs: total += x return total def kahan(xs): total = comp = 0.0 for x in xs: y = x - comp t = total + y comp = (t - total) - y total = t return total print(bits(0.1)) print(bits(-2.5)) print(Decimal(0.1)) print(sys.float_info.epsilon, math.ulp(1.0), math.ulp(2.0 ** 53)) print(math.nextafter(0.1 + 0.2, 0.0) == 0.3) print(naive([0.1] * 10), kahan([0.1] * 10), math.fsum([0.1] * 10)) print(naive([0.1] * 1000000), kahan([0.1] * 1000000), math.fsum([0.1] * 1000000)) print(1e16 + 1 == 1e16, 2.0 ** 53 + 1 == 2.0 ** 53) print(math.isclose(0.1 + 0.2, 0.3), 0.1 + 0.2 == 0.3) x = 1e-8 print((1 - math.cos(x)) / x ** 2, 2 * math.sin(x / 2) ** 2 / x ** 2) print((math.exp(1e-15) - 1) / 1e-15, math.expm1(1e-15) / 1e-15) print(float('nan') == float('nan'), math.isnan(float('nan')), float('inf') - float('inf')) print(Decimal('0.1') + Decimal('0.2') == Decimal('0.3')) # ('0', '01111111011', '1001100110011001100110011001100110011001100110011010') # ('1', '10000000000', '0100000000000000000000000000000000000000000000000000') # 0.1000000000000000055511151231257827021181583404541015625 # 2.220446049250313e-16 2.220446049250313e-16 2.0 # True # 0.9999999999999999 1.0 1.0 # 100000.00000133288 100000.0 100000.0 # True True # True False # 0.0 0.5 # 1.1102230246251565 1.0000000000000004 # False True nan # True ``` ```javascript const bits = (x) => { const v = new DataView(new ArrayBuffer(8)) v.setFloat64(0, x) return v.getBigUint64(0).toString(2).padStart(64, '0') } bits(1) // '0011111111110000000000000000000000000000000000000000000000000000' bits(0.1) // '0011111110111001100110011001100110011001100110011001100110011010' Number.EPSILON // 2.220446049250313e-16 ;[Math.fround(0.1), 0.1] // [0.10000000149011612, 0.1]: the nearest single to 0.1 ;[2 ** 53 + 1 === 2 ** 53, 2 ** 53 + 2] // [true, 9007199254740994] ;[0 / 0, 1 / 0, 1 / -0] // [NaN, Infinity, -Infinity] ;[NaN === NaN, Object.is(NaN, NaN)] // [false, true] ;[Object.is(0, -0), 0 === -0] // [false, true] ;[Number.MAX_VALUE * 10, 5e-324 / 2] // [Infinity, 0]: overflow, and underflow past the smallest subnormal ;[0.1 + 0.2, 0.1 + 0.2 === 0.3] // [0.30000000000000004, false] Math.abs(0.1 + 0.2 - 0.3) < Number.EPSILON // true: a tolerance of one machine epsilon is fine near 1 ;[Math.fround(16777217), 16777217] // [16777216, 16777217]: a single cannot hold 2^24 + 1 let s32 = 0 for (let i = 0; i < 10; i++) s32 = Math.fround(s32 + Math.fround(0.1)) s32 // 1.0000001192092896: ten tenths in single precision ``` ```cpp #include #include #include using namespace std; int main() { double eps = 1; int count = 0; while (1 + eps / 2 > 1) { // halve until 1 + eps/2 is rounded back to 1 eps = eps / 2; count = count + 1; } printf("%d %.17f\n", count, eps); // 52 halvings: eps = 2^-52 double s = 0; for (int i = 0; i < 10; i++) s = s + 0.1; printf("%.17f %d\n", s, s == 1.0); // ten times 0.1 is not 1 double big = 9007199254740992.0; // 2^53 printf("%d %d\n", big + 1 == big, big + 2 == big); // 1 0: the 1 is absorbed, the 2 is a whole gap return 0; } /* output: 52 0.00000000000000022 0.99999999999999989 0 1 0 */ ``` ## Dari mana floating-point berasal? **Floating-point lebih tua daripada komputer elektronik, dan selama puluhan tahun setiap mesin memiliki formatnya sendiri sampai sebuah standar membuat program dapat dipindahkan.** - **1914.** Leonardo Torres Quevedo mengusulkan aritmetika floating-point untuk kalkulator mekanis dalam Essays on Automatics. - **1930-an–1941.** Mesin Konrad Zuse, Z1 dan Z3, memakai floating-point biner, dengan tanda, eksponen, dan pecahan. - **1954.** IBM 704 memiliki aritmetika floating-point di perangkat keras, dan sepanjang 1960-an dan 1970-an setiap pembuat memilih basis, ukuran, dan pembulatannya sendiri, sehingga program yang sama memberi jawaban berbeda di komputer berbeda. - **1980-an.** William Kahan, yang pernah mengerjakan koprosesor 8087 Intel, memimpin panitia yang menulis **IEEE 754**, terbit pada 1985: format, pembulatan tepat, tak hingga, NaN, dan underflow bertahap. Kahan menerima Penghargaan Turing pada 1989. - **1994.** Galat FDIV Pentium, beberapa entri yang salah pada tabel yang dipakai pembagi, memberi hasil yang salah pada angka signifikan keempat atau kelima atau lebih jauh, dan menunjukkan bahwa perangkat keras floating-point harus diuji secermat perangkat lunak; Intel menarik kembali cip itu. - **2008 dan 2019.** Standar direvisi: fused multiply-add (menghitung $a\times b+c$ dengan satu pembulatan), format desimal, half precision sebagai format pertukaran, dan aturan yang lebih jelas untuk NaN dan untuk operasi seperti minimum dan maksimum. - **2010-an.** bfloat16, dengan rentang eksponen single dan ketelitian hanya $8$ bit, dirancang untuk perangkat keras pembelajaran mesin, dan half precision menjadi umum pada GPU. ## Kesalahan apa yang sering terjadi pada bilangan floating-point? **Kesalahan paling umum pada bilangan floating-point adalah sembilan hal berikut, masing-masing dengan pernyataan yang benar.** | Kesalahan | Yang benar | |---|---| | ❌ Menguji float hasil hitung dengan `==` | Bandingkan dengan toleransi relatif dan mutlak, atau dengan jarak dalam ulp. | | ❌ Float berjarak sama | Jaraknya berlipat dua di setiap pangkat dua: $2^{-52}$ di dekat $1$, $2$ di dekat $2^{53}$. | | ❌ Float memuat semua bilangan bulat | Double tepat hanya sampai $2^{53}$ dan single sampai $2^{24}$. | | ❌ Float punya 16 angka setelah titik | Ia punya sekitar 16 angka signifikan, di mana pun titiknya. | | ❌ Menambah bilangan kecil ke yang besar dan memercayainya | Ia dapat terserap: `1e16 + 1 == 1e16`. | | ❌ Memakai ketelitian lebih besar untuk memperbaiki pengurangan | Tulis ulang rumusnya agar bilangan yang hampir sama tidak dikurangkan. | | ❌ Mengulang dengan `while x != 1.0` | Float melangkahi nilainya: hitung dengan bilangan bulat. | | ❌ NaN sama dengan NaN | NaN tidak sama dengan apa pun, termasuk dirinya; pakai `isnan`. | | ❌ Memakai float untuk uang | Simpan sen sebagai bilangan bulat atau pakai tipe desimal. | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: bilangan floating-point sekilas - **Format:** $(-1)^s\times(1.f)_2\times2^e$; double adalah $1+11+52$ bit, bias $1023$, ketelitian $53$ bit, sekitar $16$ angka. - **Jarak:** jaraknya berlipat dua di setiap pangkat dua; bilangan bulat tepat sampai $2^{53}$ (single: $2^{24}$). - **Pembulatan:** dibulatkan tepat, seri ke genap, galat relatif paling banyak $u=2^{-53}$; epsilon mesin $2^{-52}$. - **Nilai khusus:** $\pm0$, $\pm\infty$, NaN (tidak sama dengan dirinya), bilangan subnormal untuk underflow bertahap. - **Galat:** menumpuk pada jumlah, terserap oleh bilangan besar, dan pembatalan menghancurkan angka pada pengurangan bilangan yang hampir sama. - **Obat:** jumlah Kahan atau berpasangan atau tepat, penulisan ulang aljabar, `expm1`, `log1p`, `hypot`. - **Bandingkan:** dengan toleransi relatif dan mutlak, atau dalam ulp; jangan pernah mengulang dengan `==`. - **Pilih:** float64 sebagai bawaan, float32 atau lebih rendah untuk memori dan kecepatan, bilangan bulat atau desimal untuk uang. - **Kode:** `struct`, `math.ulp`, `math.fsum`, `math.isclose`, `decimal` di Python; `DataView` dan `Number.EPSILON` di JavaScript. ## Glosarium: istilah penting - **Bilangan floating-point**: Bilangan yang disimpan sebagai tanda, eksponen, dan sejumlah tetap bit signifikan, sehingga titiknya mengambang menurut eksponen. - **IEEE 754**: Standar yang mendefinisikan format floating-point biner, pembulatan tepat, tak hingga, NaN, dan underflow bertahap yang dipakai hampir semua perangkat keras. - **Epsilon mesin**: Jarak antara 1 dan bilangan berikutnya dari sebuah format: 2 pangkat minus 52 untuk double. - **Ulp**: Unit pada tempat terakhir: jarak antara sebuah bilangan floating-point dan bilangan berikutnya. - **Bilangan subnormal**: Bilangan di bawah yang normal terkecil, disimpan dengan bidang eksponen nol dan tanpa angka 1 di depan yang tersirat, yang membuat underflow bertahap. - **NaN**: Bukan bilangan: hasil operasi seperti nol per nol, tidak sama bahkan dengan dirinya sendiri. - **Penyerapan**: Hilangnya bilangan kecil ketika ditambahkan ke bilangan yang jauh lebih besar, karena jumlahnya dibulatkan kembali ke bilangan yang lebih besar. - **Pembatalan katastrofik**: Hilangnya sebagian besar angka benar ketika dua bilangan yang hampir sama dikurangkan, memperlihatkan galat pembulatan yang sudah mereka miliki. ## Pertanyaan yang sering diajukan ### Apa itu bilangan floating-point? Itu adalah bilangan yang disimpan dalam notasi ilmiah biner: tanda, eksponen, dan sejumlah tetap bit pecahan. Eksponen menggeser titik biner, yang memberi rentang sangat besar, sedangkan jumlah bit tetap membatasi ketelitian. ### Apa beda float dan double? Float biasanya berarti single 32 bit dengan ketelitian 24 bit, sekitar 7 angka desimal, dan double adalah bilangan 64 bit dengan ketelitian 53 bit, sekitar 16 angka. Bilangan Python dan JavaScript adalah double. ### Bagaimana bit sebuah double disusun? Satu bit tanda, sebelas bit eksponen dengan bias 1023, dan lima puluh dua bit pecahan dengan angka 1 di depan yang tersirat. Bidang eksponen berisi nol semua dan satu semua dicadangkan untuk nol, bilangan subnormal, tak hingga, dan NaN. ### Apa itu epsilon mesin? Itu adalah jarak antara 1 dan bilangan berikutnya yang dapat disimpan sebuah format: 2 pangkat minus 52, sekitar 2,2 kali sepuluh pangkat minus 16, untuk double. Ia mengukur ketelitian relatif format itu. ### Mengapa NaN tidak sama dengan dirinya sendiri? IEEE 754 mendefinisikan setiap perbandingan dengan NaN sebagai salah, karena NaN menyatakan tiadanya nilai, dan dua nilai yang hilang tidak harus sama. Jadi menguji x tidak sama dengan x adalah cara mendeteksi NaN, seperti juga fungsi isnan. ### Apa itu bilangan subnormal? Itu adalah bilangan yang lebih kecil daripada bilangan normal terkecil, disimpan dengan bidang eksponen nol dan tanpa angka 1 di depan yang tersirat. Mereka mengisi celah di sebelah nol secara merata, sehingga underflow bertahap dan mengurangkan dua bilangan berbeda tidak pernah memberi nol. ### Apa itu pembatalan katastrofik? Itu adalah hilangnya sebagian besar angka benar ketika dua bilangan yang hampir sama dikurangkan. Angka terdepan saling menghapus dan hasilnya didominasi galat pembulatan yang sudah dimiliki bilangan itu, sehingga rumusnya harus ditulis ulang untuk menghindari pengurangan. ### Tipe floating-point mana yang harus saya pakai? Pakai double 64 bit sebagai bawaan. Pakai float 32 bit untuk grafika dan ketika memori penting, dan format 16 bit untuk pembelajaran mesin. Untuk uang pakai bilangan bulat atau tipe desimal, karena float biner tidak dapat memuat jumlah seperti 0,10 dengan tepat. --- # Newton’s Method Source: https://nunada.my.id/articles/newtons-method/ Updated: 2026-10-22 ## Quick answer **Newton's method solves $f(x)=0$ by replacing the curve with its tangent line: from a guess $x_n$ it takes the point where the tangent crosses the $x$-axis, $x_{n+1}=x_n-\frac{f(x_n)}{f'(x_n)}$, and repeats.** Near a simple root the number of correct digits roughly doubles at each step, but a bad start, a horizontal tangent or a multiple root can make it cycle, run away or crawl. ### Key takeaways - A root of $f$ is a number $r$ with $f(r)=0$. Few equations have a formula for their roots, so we approximate: pick a first guess $x_0$ by graphing or by the Intermediate Value Theorem, then improve it step by step. - The formula comes from the tangent line at $(x_n,f(x_n))$: setting $y=0$ in $y=f(x_n)+f'(x_n)(x-x_n)$ gives $x_{n+1}=x_n-\frac{f(x_n)}{f'(x_n)}$, which needs $f'(x_n)\ne0$. - Convergence at a simple root is quadratic: $e_{n+1}=\frac{f''(\xi)}{2f'(x_n)}e_n^2$ for some $\xi$ between $x_n$ and the root, so the error is squared at every step. At a root of multiplicity $m$ it is only linear, with ratio $\frac{m-1}{m}$. - The method is local: it can cycle ($x^3-2x+2$ from $0$), run off ($\sqrt[3]{x}$ gives $x_{n+1}=-2x_n$), stop at a horizontal tangent, or reach a root you did not want ($\sin x$ from $1.7$ reaches $3\pi$). - Applied to $x^n-a=0$ it needs no derivative, $x_{new}=\frac{(n-1)x+a/x^{n-1}}{n}$, the Babylonian rule for square roots; applied to $\frac1x-a=0$ it gives $x(2-ax)$, a way to divide without dividing. - Stop when the step is smaller than you need, check that $f(x)$ is small as well, and keep a safeguard such as a bracket from the Intermediate Value Theorem and a limit on the number of steps. ## What is Newton’s method? **Newton's method, also called the Newton–Raphson method, is a way to approximate a solution of $f(x)=0$ using tangent lines.** A value of $x$ where $f$ is zero is a root of $f$ and a solution of the equation. For a linear equation $ax+b=0$ and a quadratic $ax^2+bx+c=0$ there are formulas, but for most equations, such as $x^3-x-1=0$ or $\cos x=x$, there is none, and numbers are the only answer. The method is both fast and simple, and it is used in calculators, in software, and in engineering wherever a hard equation has to be solved. **The idea.** Suppose $x_0$ is a rough guess of a root. Near $x_0$ the curve $y=f(x)$ is almost its tangent line (this is the [linearization](https://nunada.my.id/articles/linearization-and-differentials/#linearization) of $f$), and a line is easy to solve. So take the point $x_1$ where the tangent at $\left(x_0,f(x_0)\right)$ crosses the $x$-axis: it is usually closer to the root than $x_0$. Then do the same at $x_1$ to get $x_2$, and continue until the numbers stop changing. **The formula.** The tangent line at $\left(x_n,f(x_n)\right)$ is $$y=f(x_n)+f'(x_n)\,(x-x_n).$$ It crosses the $x$-axis where $y=0$: $$0=f(x_n)+f'(x_n)(x-x_n)\quad\Rightarrow\quad x=x_n-\frac{f(x_n)}{f'(x_n)}\qquad\text{if }f'(x_n)\ne0.$$ This value is the next approximation: $$x_{n+1}=x_n-\frac{f(x_n)}{f'(x_n)}$$ Each step goes up (or down) from $x_n$ to the curve and then follows the tangent line to the axis. **The procedure.** 1. Guess a first approximation $x_0$, with the help of a graph, or of a sign change of $f$ on an interval (the Intermediate Value Theorem). 2. Use the formula to get $x_1$, $x_2$, and so on. 3. Stop when the steps are smaller than the accuracy you need, and check that $f(x_n)$ is close to zero. An equation such as $f(x)=g(x)$ is solved by applying the method to $f(x)-g(x)$, and a question such as "where does the curve $y=x^3-x$ cross the line $y=1$?" is the same as finding the roots of $x^3-x-1$. ## How does Newton’s method work on real equations? **Three examples show the method at work: a square root, a cubic with a single real root, and an equation from astronomy.** **Example 1: the square root of 2.** Approximate the positive root of $f(x)=x^2-2$. With $f'(x)=2x$ the formula becomes $$x_{n+1}=x_n-\frac{x_n^2-2}{2x_n}=\frac{x_n}{2}+\frac1{x_n}.$$ From $x_0=1$ we get $x_1=\frac32=1.5$, then $x_2=\frac{17}{12}\approx1.41667$ and $x_3=\frac{577}{408}\approx1.41422$. The true value is $\sqrt2=1.41421356\ldots$, so the errors are about $0.414$, $0.086$, $0.0025$ and $0.000002$, and the next step is correct to twelve decimals. Each step roughly doubles the number of correct digits. **Example 2: a cubic.** Find the $x$-coordinate where the curve $y=x^3-x$ crosses the line $y=1$. That is a root of $f(x)=x^3-x-1$. Since $f(1)=-1$ and $f(2)=5$, the Intermediate Value Theorem gives a root in $(1,2)$. With $f'(x)=3x^2-1$, $$x_{n+1}=x_n-\frac{x_n^3-x_n-1}{3x_n^2-1}.$$ Starting at $x_0=1$ gives $x_1=1.5$, $x_2=1.347826087$, $x_3=1.325200399$, $x_4=1.324718174$ and $x_5=1.324717957$, and $x_6$ agrees with it to nine decimals: $f(x_5)$ is zero up to the accuracy of the computation. The curve is [concave up](https://nunada.my.id/articles/concavity-and-curve-sketching/#concavity) for $x>0$, since $f''(x)=6x>0$, so once an approximation is to the right of the root the tangents lie below the curve and the approximations fall steadily toward it. Starting much farther away, at $x_0=3$, still works, in seven steps; in fact any start to the right of $\frac1{\sqrt3}$ leads to this root. **Example 3: a planet.** To calculate where a planet is, astronomers solve equations such as $x=1+0.5\sin x$ (Kepler's equation, with $x$ in radians). The function $f(x)=x-1-0.5\sin x$ has $f'(x)=1-0.5\cos x$, and a graph suggests a root near $1.5$. One step from $x_0=1.5$ gives $$x_1=1.5-\frac{1.5-1-0.5\sin1.5}{1-0.5\cos1.5}\approx1.49870,$$ which is already the root to five decimals. Type a function and a starting value below, or choose one of the examples. The slider takes the steps one at a time, and the picture shows each tangent: up to the curve, then along the tangent to the axis. ## How fast does Newton’s method converge? **Near a simple root Newton's method converges quadratically: the error is roughly squared at each step, so the number of correct digits roughly doubles.** Write $e_n=x_n-r$ for the error, where $r$ is the root. If $f$ has a continuous second derivative and $f'(r)\ne0$, then $$e_{n+1}=\frac{f''(\xi)}{2f'(x_n)}\,e_n^2\qquad\text{for some }\xi\text{ between }x_n\text{ and }r.$$ Proof. Taylor's formula at $x_n$, evaluated at the root, gives $0=f(x_n)-f'(x_n)e_n+\frac12f''(\xi)e_n^2$, that is $f'(x_n)e_n-f(x_n)=\frac12f''(\xi)e_n^2$. Then $$e_{n+1}=e_n-\frac{f(x_n)}{f'(x_n)}=\frac{f'(x_n)e_n-f(x_n)}{f'(x_n)}=\frac{f''(\xi)}{2f'(x_n)}\,e_n^2.$$ ∎ When $x_n\to r$ this says $\frac{e_{n+1}}{e_n^2}\to\frac{f''(r)}{2f'(r)}$. For $\sqrt2$ the constant is $\frac{2}{2\cdot2\sqrt2}\approx0.354$, and the table below shows the ratios close to it. **Comparison with bisection.** The bisection method halves a bracket at each step, a gain of about $0.3$ digits per step, so ten digits take about thirty-three steps. Newton's method needs four or five, but it needs the derivative, a good start, and no safety net. **It is a local result.** The formula $|e_{n+1}|\le M\,e_n^2$, with $M$ a bound for $\frac{|f''|}{2|f'|}$ near the root, gives $M|e_n|\le(M|e_0|)^{2^n}$. So if the first error satisfies $M|e_0|<1$ the method converges, and very fast; if the start is farther away, nothing is promised. **Multiple roots.** If $f(x)=(x-r)^m g(x)$ with $m>1$ then $f'(r)=0$ and the argument above fails: the error shrinks only by the factor $\frac{m-1}{m}$ at each step. For $(x-1)^2$ the error is halved, as in bisection; for $(x-1)^6$ only a sixth of the error is removed at each step. For $f(x)=(x-1)^{40}$ and $x_0=2$ the factor is $\frac{39}{40}$, and after $100$ steps the approximation is still about $1.08$. Using $x_{n+1}=x_n-m\frac{f(x_n)}{f'(x_n)}$ restores quadratic convergence when $m$ is known. **Stopping.** For a simple root a tiny step $|x_{n+1}-x_n|$ means the error is tinier still. Do not rely on $|f(x_n)|$ alone: a flat curve such as $(x-1)^{40}$ has $f(x)$ below $10^{-15}$ while $x$ is still $0.4$ away from the root. Choose a case below: the table gives the error, the correct digits and both ratios, with bisection beside it for the simple roots. ## When does Newton’s method fail? **Newton's method does not always converge, and when it does, it may converge to a root you did not have in mind.** If it converges, the limit is a root: when $x_n\to L$ and $f$ and $f'$ are continuous with $f'(L)\ne0$, letting $n\to\infty$ in the formula gives $\frac{f(L)}{f'(L)}=0$. The trouble is whether it converges at all. The usual failures are these. 1. **A horizontal tangent.** If $f'(x_n)=0$ the tangent never meets the axis and the formula divides by zero; if $f'(x_n)$ is merely tiny the next guess is thrown far away. 2. **A cycle.** For $f(x)=x^3-2x+2$ and $x_0=0$ the tangent at $0$ meets the axis at $1$, and the tangent at $1$ meets it at $0$: the approximations are $0,1,0,1,\ldots$ forever, while the real root is near $-1.77$. In the textbook the function $f(x)=\sqrt{x-r}$ for $x\ge r$ and $-\sqrt{r-x}$ for $x1$ the convergence is only linear, as above. **Basins of attraction.** The set of starting values that lead to one root is its basin. The basins of different roots are usually separated by simple boundaries, but they can interleave in a fine pattern. For $f(x)=x^3-x$, with roots $-1$, $0$ and $1$, every start beyond $\frac1{\sqrt3}\approx0.577$ goes to $1$, every start between $-\frac1{\sqrt5}$ and $\frac1{\sqrt5}$ goes to $0$, and between $\frac1{\sqrt5}\approx0.447$ and $\frac1{\sqrt3}$ the roots reached change with every small move of the start. So a small change of $x_0$ can change the answer. **Safeguards.** Graph the function first; start from a bracket $[a,b]$ with $f(a)f(b)<0$ and fall back to a bisection step whenever Newton's step leaves the bracket; limit the number of steps; stop on both $|x_{n+1}-x_n|$ and $|f(x_{n+1})|$. The first widget shows each failure with its steps, and the second colours the starting values by the root they reach. ## Where is Newton’s method used? **Newton's method is behind the square root and the division of many calculators and programs, and behind any problem that comes down to solving one equation.** **Square roots.** For $f(x)=x^2-a$ the formula is $x_{n+1}=\frac12\left(x_n+\frac a{x_n}\right)$: replace the guess by the average of $x_n$ and $\frac a{x_n}$, one of which is too small and one too large. For $x^n-a$ the derivative disappears into $$x_{n+1}=\frac{(n-1)\,x_n+\dfrac{a}{x_n^{\,n-1}}}{n}.$$ **Division.** For $f(x)=\frac1x-a$ the root is $\frac1a$ and the formula simplifies to $x_{n+1}=x_n(2-a\,x_n)$, with no division at all: a computer can find a reciprocal with only multiplication and subtraction, as long as $0 { let x = x0 for (let n = 0; n < max; n++) { const h = 1e-6 * (1 + Math.abs(x)) const d = (f(x + h) - f(x - h)) / (2 * h) if (d === 0 || !Number.isFinite(d)) return { x, n, status: 'flat' } const next = x - f(x) / d if (Math.abs(next - x) < tol * (1 + Math.abs(x))) return { x: next, n: n + 1, status: 'converged' } x = next } return { x, n: max, status: 'unfinished' } } const r1 = newton((x) => x ** 3 - x - 1, 1) ;[+r1.x.toFixed(10), r1.n, r1.status] // [1.3247179572, 6, 'converged'] const r2 = newton((x) => Math.cos(x) - x, 1) ;[+r2.x.toFixed(10), r2.n, r2.status] // [0.7390851332, 5, 'converged']: cos x = x const r3 = newton((x) => x * x - 1, 0) ;[r3.x, r3.n, r3.status] // [0, 0, 'flat']: the tangent at 0 is horizontal const r4 = newton(Math.sin, 1.7) ;[+r4.x.toFixed(10), r4.n, r4.status] // [9.4247779608, 4, 'converged']: not the root 0 but 3 pi newton((x) => x ** 3 - 2 * x + 2, 0, { max: 8 }).status // 'unfinished': the iterates go 0, 1, 0, 1, ... ``` ```cpp #include #include #include using namespace std; int main() { double a = 2; double x = 1; // the first guess for (int n = 0; n <= 5; n++) { printf("%d %.12f %.12f\n", n, x, fabs(x - sqrt(a))); x = (x + a / x) / 2; // Newton's method for x*x - a = 0 } return 0; } /* output: 0 1.000000000000 0.414213562373 1 1.500000000000 0.085786437627 2 1.416666666667 0.002453104294 3 1.414215686275 0.000002123901 4 1.414213562375 0.000000000002 5 1.414213562373 0.000000000000 */ ``` ## Who invented Newton’s method? **The idea of improving a guess for a root is four thousand years old, and the method carries the names of Newton and Raphson because of how they wrote it, not because they were the first to improve guesses.** - **Babylon, about 1800–1600 BC.** The clay tablet YBC 7289 gives $\sqrt2$ as $1;24,51,10$ in base $60$, which is $1.41421296\ldots$, correct to six decimals. Averaging a guess and the number divided by the guess, the rule of Example 1, is a likely way to get it. - **Heron of Alexandria, first century.** Heron described the averaging rule for square roots, which is why the formula is also called Heron's method. - **Isaac Newton, 1669.** In De analysi, written in 1669 and printed in 1711, Newton solved $y^3-2y-5=0$ by starting at $2$, writing $y=2+p$, dropping the powers of $p$ above the first, and repeating on the new polynomial. It was an algebraic process on the equation, not a formula for $x_{n+1}$. - **Joseph Raphson, 1690.** Raphson published a way of repeating a single formula for polynomials, without rewriting the equation each time, which is the shape of the method we use. - **Thomas Simpson, 1740.** Simpson described the method with derivatives, the form $x-\frac{f(x)}{f'(x)}$, for any equation and even for two equations at once. - **Fourier and Cauchy, 1820s.** Joseph Fourier and Augustin-Louis Cauchy studied when the method converges. - **Cayley, 1879.** Arthur Cayley asked which root Newton's method reaches from a start in the complex plane. For a quadratic the plane splits along a line; for a cubic the boundaries became the fractals later studied by Julia and Fatou. - **Kantorovich, 1948.** Leonid Kantorovich proved a convergence theorem that needs conditions only at the starting point, and that works for systems of equations. ## What mistakes do people make with Newton’s method? **The most common mistakes with Newton's method are the nine below, each with the correct statement.** | Mistake | Correct | |---|---| | ❌ Start anywhere | The start matters: graph $f$ or find a sign change first. From $x_0=1.7$, $\sin x$ goes to $3\pi$, not to $0$. | | ❌ Apply the formula to an equation, not to a function | Write the equation as $f(x)=0$ first: $x=1+0.5\sin x$ becomes $f(x)=x-1-0.5\sin x$. | | ❌ Divide when $f'(x_n)=0$ | A horizontal tangent never meets the axis: choose another start. | | ❌ Assume it always converges | $\sqrt[3]{x}$ gives $x_{n+1}=-2x_n$, and $x^3-2x+2$ from $0$ cycles between $0$ and $1$. | | ❌ Stop when $|f(x_n)|$ is small | A flat curve can be tiny far from its root; also check that the step is small. | | ❌ Expect the digits to double at every root | At a root of multiplicity $m$ the error shrinks only by $\frac{m-1}{m}$ per step. | | ❌ Round the approximations early | Keep all the digits while iterating and round only the final answer. | | ❌ Use degrees in trigonometric functions | The derivatives of sine and cosine assume radians. | | ❌ Assume it finds the root you want, or all roots | Each start goes to one root, which may be far away; look at the basins. | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: Newton’s method at a glance - **The formula:** $x_{n+1}=x_n-\frac{f(x_n)}{f'(x_n)}$, the zero of the tangent line at $x_n$; it needs $f'(x_n)\ne0$. - **How to use it:** write the equation as $f(x)=0$, choose $x_0$ from a graph or a sign change, iterate, and stop when the step and $f(x_n)$ are both small. - **Speed:** quadratic at a simple root, $e_{n+1}=\frac{f''(\xi)}{2f'(x_n)}e_n^2$; linear, with ratio $\frac{m-1}{m}$, at a root of multiplicity $m$. - **Failures:** a horizontal tangent, a cycle ($x^3-2x+2$ from $0$), running off ($\sqrt[3]{x}$, $\arctan x$ far out), the wrong root ($\sin x$ from $1.7$). - **Basins:** the starts that reach each root; the boundaries between them can be fine. - **By hand:** $\frac12\left(x+\frac ax\right)$ for $\sqrt a$ and $x(2-ax)$ for $\frac1a$. - **Safeguards:** a bracket and bisection as a fallback, a step limit, and a check of both the step and $|f|$. - **Next:** antiderivatives, the reverse of differentiation. - **Code:** a loop with a stopping rule; SymPy `lambdify` and `diff`, or a central difference. ## Glossary: key terms - **Root**: A number r where a function is zero, f(r) = 0, and so a solution of the equation f(x) = 0. - **Newton’s method**: An iteration that replaces each approximation of a root by the point where the tangent line of the function crosses the x-axis. - **Iteration**: Repeating the same formula, each time on the result of the last step, to produce a sequence of approximations. - **Quadratic convergence**: A rate at which the error is roughly squared at each step, so the number of correct digits doubles. - **Multiple root**: A root where the derivative is also zero, so that the function has a factor (x − r) raised to a power m greater than one. - **Basin of attraction**: The set of starting values from which an iteration converges to a given root. - **Bisection method**: A root-finding method that halves a bracket where the function changes sign; it is slower than Newton’s method but cannot fail inside the bracket. ## Frequently asked questions ### What is Newton’s method? It is a way to approximate a solution of f of x equal to zero. From a guess it takes the point where the tangent line of the function crosses the x-axis, and repeats. The formula is x minus f of x divided by f prime of x. ### How do you choose the starting value? Graph the function, or find an interval where it changes sign, and pick a value near the root you want. A start close to a simple root converges very fast; a start far away may cycle, run off or reach another root. ### How fast does Newton’s method converge? At a simple root it converges quadratically: the error is roughly squared at each step, so the number of correct digits doubles. At a multiple root it is only linear, and the error shrinks by the factor m minus one over m. ### When does Newton’s method fail? When the derivative is zero at an approximation, when the approximations cycle or run off to infinity, when the start is too far from the root, or when the root is multiple and the convergence is slow. It can also reach a root that is not the one you wanted. ### When should you stop iterating? Stop when the change between two approximations is smaller than the accuracy you need, and also check that f of x is close to zero. A small value of f alone is not enough for a flat curve, and a limit on the number of steps protects against cycles. ### How is Newton’s method used to compute square roots? Apply it to x squared minus a. The formula becomes the average of x and a divided by x, which is the Babylonian rule. Starting from 1, the square root of 2 is correct to twelve decimals after four steps. ### What is the difference between Newton’s method and bisection? Bisection halves a bracket where the function changes sign, so it always works there but gains only about a third of a digit per step. Newton’s method needs the derivative and a good start, and when it works it doubles the correct digits at each step. ### Who invented Newton’s method? Isaac Newton solved equations this way in 1669, and Joseph Raphson published a simpler repeating formula in 1690. Thomas Simpson gave the form with derivatives in 1740. The averaging rule for square roots is much older, from Babylon and Heron. --- # Metode Newton Source: https://nunada.my.id/artikel/metode-newton/ Updated: 2026-10-22 ## Jawaban singkat **Metode Newton menyelesaikan $f(x)=0$ dengan mengganti kurva dengan garis singgungnya: dari tebakan $x_n$ ia mengambil titik tempat garis singgung memotong sumbu-$x$, $x_{n+1}=x_n-\frac{f(x_n)}{f'(x_n)}$, lalu mengulang.** Di dekat akar sederhana banyaknya angka benar kira-kira berlipat dua di setiap langkah, tetapi awal yang buruk, garis singgung mendatar, atau akar ganda dapat membuatnya berputar, menjauh, atau merangkak. ### Poin penting - Akar $f$ adalah bilangan $r$ dengan $f(r)=0$. Hanya sedikit persamaan yang rumus akarnya ada, sehingga kita menghampiri: pilih tebakan awal $x_0$ dengan grafik atau Teorema Nilai Antara, lalu perbaiki langkah demi langkah. - Rumus ini berasal dari garis singgung di $(x_n,f(x_n))$: menyetel $y=0$ pada $y=f(x_n)+f'(x_n)(x-x_n)$ memberi $x_{n+1}=x_n-\frac{f(x_n)}{f'(x_n)}$, yang memerlukan $f'(x_n)\ne0$. - Konvergensi di akar sederhana bersifat kuadrat: $e_{n+1}=\frac{f''(\xi)}{2f'(x_n)}e_n^2$ untuk suatu $\xi$ di antara $x_n$ dan akar, sehingga galatnya dikuadratkan di setiap langkah. Di akar berkelipatan $m$ ia hanya linear, dengan rasio $\frac{m-1}{m}$. - Metode ini bersifat lokal: ia dapat berputar ($x^3-2x+2$ dari $0$), menjauh ($\sqrt[3]{x}$ memberi $x_{n+1}=-2x_n$), berhenti di garis singgung mendatar, atau mencapai akar yang tidak kamu inginkan ($\sin x$ dari $1,7$ mencapai $3\pi$). - Diterapkan pada $x^n-a=0$ ia tidak memerlukan turunan, $x_{new}=\frac{(n-1)x+a/x^{n-1}}{n}$, aturan Babilonia untuk akar kuadrat; diterapkan pada $\frac1x-a=0$ ia memberi $x(2-ax)$, cara membagi tanpa membagi. - Berhenti ketika langkahnya lebih kecil daripada yang kamu perlukan, periksa bahwa $f(x)$ juga kecil, dan simpan pengaman seperti selang dari Teorema Nilai Antara dan batas banyaknya langkah. ## Apa itu metode Newton? **Metode Newton, disebut juga metode Newton–Raphson, adalah cara menghampiri solusi $f(x)=0$ dengan garis singgung.** Nilai $x$ tempat $f$ bernilai nol adalah akar $f$ dan solusi persamaan itu. Untuk persamaan linear $ax+b=0$ dan kuadrat $ax^2+bx+c=0$ ada rumusnya, tetapi untuk kebanyakan persamaan, seperti $x^3-x-1=0$ atau $\cos x=x$, tidak ada, dan bilangan adalah satu-satunya jawaban. Metode ini cepat dan sederhana, dan dipakai di kalkulator, di perangkat lunak, dan di bidang teknik di mana pun persamaan sulit harus diselesaikan. **Gagasannya.** Misalkan $x_0$ tebakan kasar suatu akar. Di dekat $x_0$ kurva $y=f(x)$ hampir sama dengan garis singgungnya (ini adalah [linearisasi](https://nunada.my.id/artikel/linearisasi-dan-diferensial/#linearization) $f$), dan garis mudah diselesaikan. Jadi ambil titik $x_1$ tempat garis singgung di $\left(x_0,f(x_0)\right)$ memotong sumbu-$x$: biasanya ia lebih dekat ke akar daripada $x_0$. Lalu lakukan hal yang sama di $x_1$ untuk mendapat $x_2$, dan lanjutkan sampai bilangannya berhenti berubah. **Rumusnya.** Garis singgung di $\left(x_n,f(x_n)\right)$ adalah $$y=f(x_n)+f'(x_n)\,(x-x_n).$$ Garis itu memotong sumbu-$x$ di tempat $y=0$: $$0=f(x_n)+f'(x_n)(x-x_n)\quad\Rightarrow\quad x=x_n-\frac{f(x_n)}{f'(x_n)}\qquad\text{jika }f'(x_n)\ne0.$$ Nilai ini adalah hampiran berikutnya: $$x_{n+1}=x_n-\frac{f(x_n)}{f'(x_n)}$$ Setiap langkah naik (atau turun) dari $x_n$ ke kurva lalu menyusuri garis singgung ke sumbu. **Prosedurnya.** 1. Tebak hampiran pertama $x_0$, dengan bantuan grafik, atau perubahan tanda $f$ pada suatu selang (Teorema Nilai Antara). 2. Pakai rumus untuk mendapat $x_1$, $x_2$, dan seterusnya. 3. Berhenti ketika langkahnya lebih kecil daripada ketelitian yang kamu perlukan, dan periksa bahwa $f(x_n)$ dekat dengan nol. Persamaan seperti $f(x)=g(x)$ diselesaikan dengan menerapkan metode pada $f(x)-g(x)$, dan pertanyaan seperti "di mana kurva $y=x^3-x$ memotong garis $y=1$?" sama dengan mencari akar $x^3-x-1$. ## Bagaimana metode Newton bekerja pada persamaan nyata? **Tiga contoh memperlihatkan metode ini bekerja: akar kuadrat, kubik dengan satu akar real, dan persamaan dari astronomi.** **Contoh 1: akar kuadrat 2.** Hampiri akar positif $f(x)=x^2-2$. Dengan $f'(x)=2x$ rumusnya menjadi $$x_{n+1}=x_n-\frac{x_n^2-2}{2x_n}=\frac{x_n}{2}+\frac1{x_n}.$$ Dari $x_0=1$ kita dapat $x_1=\frac32=1{,}5$, lalu $x_2=\frac{17}{12}\approx1{,}41667$ dan $x_3=\frac{577}{408}\approx1{,}41422$. Nilai sebenarnya $\sqrt2=1{,}41421356\ldots$, sehingga galatnya sekitar $0{,}414$, $0{,}086$, $0{,}0025$, dan $0{,}000002$, dan langkah berikutnya benar sampai dua belas desimal. Setiap langkah kira-kira melipatduakan banyaknya angka benar. **Contoh 2: kubik.** Tentukan absis tempat kurva $y=x^3-x$ memotong garis $y=1$. Itu adalah akar $f(x)=x^3-x-1$. Karena $f(1)=-1$ dan $f(2)=5$, Teorema Nilai Antara memberi akar di $(1,2)$. Dengan $f'(x)=3x^2-1$, $$x_{n+1}=x_n-\frac{x_n^3-x_n-1}{3x_n^2-1}.$$ Mulai dari $x_0=1$ memberi $x_1=1{,}5$, $x_2=1{,}347826087$, $x_3=1{,}325200399$, $x_4=1{,}324718174$, dan $x_5=1{,}324717957$, dan $x_6$ sama dengannya sampai sembilan desimal: $f(x_5)$ nol sejauh ketelitian hitung. Kurvanya [cekung ke atas](https://nunada.my.id/artikel/kecekungan-dan-penggambaran-kurva/#concavity) untuk $x>0$, karena $f''(x)=6x>0$, sehingga begitu hampiran ada di kanan akar, garis singgungnya berada di bawah kurva dan hampiran turun tetap menuju akar. Mulai jauh lebih jauh, di $x_0=3$, tetap berhasil, dalam tujuh langkah; bahkan setiap awal di kanan $\frac1{\sqrt3}$ menuju akar ini. **Contoh 3: sebuah planet.** Untuk menghitung posisi planet, astronom menyelesaikan persamaan seperti $x=1+0{,}5\sin x$ (persamaan Kepler, dengan $x$ dalam radian). Fungsi $f(x)=x-1-0{,}5\sin x$ memiliki $f'(x)=1-0{,}5\cos x$, dan grafik menunjukkan akar di dekat $1{,}5$. Satu langkah dari $x_0=1{,}5$ memberi $$x_1=1{,}5-\frac{1{,}5-1-0{,}5\sin1{,}5}{1-0{,}5\cos1{,}5}\approx1{,}49870,$$ yang sudah merupakan akar sampai lima desimal. Ketik sebuah fungsi dan nilai awal di bawah, atau pilih salah satu contoh. Penggeser mengambil langkah satu per satu, dan gambar menunjukkan tiap garis singgung: naik ke kurva, lalu menyusuri garis singgung ke sumbu. ## Seberapa cepat metode Newton konvergen? **Di dekat akar sederhana metode Newton konvergen secara kuadrat: galatnya kira-kira dikuadratkan di setiap langkah, sehingga banyaknya angka benar kira-kira berlipat dua.** Tulis $e_n=x_n-r$ untuk galat, dengan $r$ akarnya. Jika $f$ memiliki turunan kedua kontinu dan $f'(r)\ne0$, maka $$e_{n+1}=\frac{f''(\xi)}{2f'(x_n)}\,e_n^2\qquad\text{untuk suatu }\xi\text{ di antara }x_n\text{ dan }r.$$ Bukti. Rumus Taylor di $x_n$, dihitung di akar, memberi $0=f(x_n)-f'(x_n)e_n+\frac12f''(\xi)e_n^2$, yaitu $f'(x_n)e_n-f(x_n)=\frac12f''(\xi)e_n^2$. Maka $$e_{n+1}=e_n-\frac{f(x_n)}{f'(x_n)}=\frac{f'(x_n)e_n-f(x_n)}{f'(x_n)}=\frac{f''(\xi)}{2f'(x_n)}\,e_n^2.$$ ∎ Ketika $x_n\to r$ ini berarti $\frac{e_{n+1}}{e_n^2}\to\frac{f''(r)}{2f'(r)}$. Untuk $\sqrt2$ konstantanya $\frac{2}{2\cdot2\sqrt2}\approx0{,}354$, dan tabel di bawah menunjukkan rasionya dekat dengan itu. **Perbandingan dengan bisection.** Metode bisection membagi dua selang di setiap langkah, kenaikan sekitar $0{,}3$ angka per langkah, sehingga sepuluh angka memerlukan sekitar tiga puluh tiga langkah. Metode Newton memerlukan empat atau lima, tetapi ia memerlukan turunan, awal yang baik, dan tanpa jaring pengaman. **Ini hasil lokal.** Rumus $|e_{n+1}|\le M\,e_n^2$, dengan $M$ batas untuk $\frac{|f''|}{2|f'|}$ di dekat akar, memberi $M|e_n|\le(M|e_0|)^{2^n}$. Jadi jika galat pertama memenuhi $M|e_0|<1$ metodenya konvergen, dan sangat cepat; jika awalnya lebih jauh, tidak ada yang dijanjikan. **Akar ganda.** Jika $f(x)=(x-r)^m g(x)$ dengan $m>1$ maka $f'(r)=0$ dan argumen di atas gagal: galat hanya mengecil dengan faktor $\frac{m-1}{m}$ di setiap langkah. Untuk $(x-1)^2$ galatnya dibagi dua, seperti pada bisection; untuk $(x-1)^6$ hanya seperenam galat yang hilang di setiap langkah. Untuk $f(x)=(x-1)^{40}$ dan $x_0=2$ faktornya $\frac{39}{40}$, dan setelah $100$ langkah hampirannya masih sekitar $1{,}08$. Memakai $x_{n+1}=x_n-m\frac{f(x_n)}{f'(x_n)}$ mengembalikan konvergensi kuadrat bila $m$ diketahui. **Berhenti.** Untuk akar sederhana langkah $|x_{n+1}-x_n|$ yang kecil berarti galatnya lebih kecil lagi. Jangan hanya mengandalkan $|f(x_n)|$: kurva datar seperti $(x-1)^{40}$ memiliki $f(x)$ di bawah $10^{-15}$ padahal $x$ masih $0{,}4$ dari akarnya. Pilih satu kasus di bawah: tabel memberi galat, angka benar, dan kedua rasio, dengan bisection di sebelahnya untuk akar sederhana. ## Kapan metode Newton gagal? **Metode Newton tidak selalu konvergen, dan ketika konvergen, ia dapat menuju akar yang tidak kamu maksud.** Jika ia konvergen, limitnya adalah akar: ketika $x_n\to L$ dan $f$ dan $f'$ kontinu dengan $f'(L)\ne0$, mengambil $n\to\infty$ pada rumus memberi $\frac{f(L)}{f'(L)}=0$. Masalahnya adalah apakah ia konvergen sama sekali. Kegagalan yang lazim adalah berikut. 1. **Garis singgung mendatar.** Jika $f'(x_n)=0$ garis singgung tidak pernah memotong sumbu dan rumusnya membagi dengan nol; jika $f'(x_n)$ hanya sangat kecil tebakan berikutnya terlempar jauh. 2. **Siklus.** Untuk $f(x)=x^3-2x+2$ dan $x_0=0$ garis singgung di $0$ memotong sumbu di $1$, dan garis singgung di $1$ memotongnya di $0$: hampirannya $0,1,0,1,\ldots$ selamanya, sedangkan akar nyatanya dekat $-1{,}77$. Dalam buku, fungsi $f(x)=\sqrt{x-r}$ untuk $x\ge r$ dan $-\sqrt{r-x}$ untuk $x1$ konvergensinya hanya linear, seperti di atas. **Daerah tarikan.** Himpunan nilai awal yang menuju satu akar disebut daerah tarikannya. Daerah tarikan akar yang berbeda biasanya dipisahkan oleh batas sederhana, tetapi dapat saling menyelip dalam pola halus. Untuk $f(x)=x^3-x$, dengan akar $-1$, $0$, dan $1$, setiap awal di atas $\frac1{\sqrt3}\approx0{,}577$ menuju $1$, setiap awal di antara $-\frac1{\sqrt5}$ dan $\frac1{\sqrt5}$ menuju $0$, dan di antara $\frac1{\sqrt5}\approx0{,}447$ dan $\frac1{\sqrt3}$ akar yang dicapai berubah dengan setiap pergeseran kecil awalnya. Jadi perubahan kecil pada $x_0$ dapat mengubah jawabannya. **Pengaman.** Gambar fungsinya lebih dahulu; mulai dari selang $[a,b]$ dengan $f(a)f(b)<0$ dan kembali ke langkah bisection bila langkah Newton keluar dari selang; batasi banyaknya langkah; berhenti berdasarkan $|x_{n+1}-x_n|$ dan $|f(x_{n+1})|$ sekaligus. Widget pertama menunjukkan tiap kegagalan dengan langkahnya, dan yang kedua mewarnai nilai awal menurut akar yang dicapainya. ## Di mana metode Newton dipakai? **Metode Newton ada di balik akar kuadrat dan pembagian banyak kalkulator dan program, dan di balik setiap masalah yang berujung pada penyelesaian satu persamaan.** **Akar kuadrat.** Untuk $f(x)=x^2-a$ rumusnya $x_{n+1}=\frac12\left(x_n+\frac a{x_n}\right)$: ganti tebakan dengan rata-rata $x_n$ dan $\frac a{x_n}$, yang satu terlalu kecil dan yang lain terlalu besar. Untuk $x^n-a$ turunannya lenyap menjadi $$x_{n+1}=\frac{(n-1)\,x_n+\dfrac{a}{x_n^{\,n-1}}}{n}.$$ **Pembagian.** Untuk $f(x)=\frac1x-a$ akarnya $\frac1a$ dan rumusnya menyederhana menjadi $x_{n+1}=x_n(2-a\,x_n)$, tanpa pembagian sama sekali: komputer dapat mencari kebalikan hanya dengan perkalian dan pengurangan, asalkan $0 { let x = x0 for (let n = 0; n < max; n++) { const h = 1e-6 * (1 + Math.abs(x)) const d = (f(x + h) - f(x - h)) / (2 * h) if (d === 0 || !Number.isFinite(d)) return { x, n, status: 'flat' } const next = x - f(x) / d if (Math.abs(next - x) < tol * (1 + Math.abs(x))) return { x: next, n: n + 1, status: 'converged' } x = next } return { x, n: max, status: 'unfinished' } } const r1 = newton((x) => x ** 3 - x - 1, 1) ;[+r1.x.toFixed(10), r1.n, r1.status] // [1.3247179572, 6, 'converged'] const r2 = newton((x) => Math.cos(x) - x, 1) ;[+r2.x.toFixed(10), r2.n, r2.status] // [0.7390851332, 5, 'converged']: cos x = x const r3 = newton((x) => x * x - 1, 0) ;[r3.x, r3.n, r3.status] // [0, 0, 'flat']: the tangent at 0 is horizontal const r4 = newton(Math.sin, 1.7) ;[+r4.x.toFixed(10), r4.n, r4.status] // [9.4247779608, 4, 'converged']: not the root 0 but 3 pi newton((x) => x ** 3 - 2 * x + 2, 0, { max: 8 }).status // 'unfinished': the iterates go 0, 1, 0, 1, ... ``` ```cpp #include #include #include using namespace std; int main() { double a = 2; double x = 1; // the first guess for (int n = 0; n <= 5; n++) { printf("%d %.12f %.12f\n", n, x, fabs(x - sqrt(a))); x = (x + a / x) / 2; // Newton's method for x*x - a = 0 } return 0; } /* output: 0 1.000000000000 0.414213562373 1 1.500000000000 0.085786437627 2 1.416666666667 0.002453104294 3 1.414215686275 0.000002123901 4 1.414213562375 0.000000000002 5 1.414213562373 0.000000000000 */ ``` ## Siapa yang menemukan metode Newton? **Gagasan memperbaiki tebakan akar berumur empat ribu tahun, dan metode ini memakai nama Newton dan Raphson karena cara mereka menuliskannya, bukan karena mereka yang pertama memperbaiki tebakan.** - **Babilonia, sekitar 1800–1600 SM.** Lempeng tanah liat YBC 7289 memberi $\sqrt2$ sebagai $1;24,51,10$ dalam basis $60$, yaitu $1{,}41421296\ldots$, benar sampai enam desimal. Merata-ratakan tebakan dan bilangan dibagi tebakan, aturan pada Contoh 1, adalah cara yang mungkin untuk mendapatkannya. - **Heron dari Aleksandria, abad pertama.** Heron menjelaskan aturan perata-rataan untuk akar kuadrat, itulah sebabnya rumus itu disebut juga metode Heron. - **Isaac Newton, 1669.** Dalam De analysi, ditulis pada 1669 dan dicetak pada 1711, Newton menyelesaikan $y^3-2y-5=0$ dengan mulai dari $2$, menulis $y=2+p$, membuang pangkat $p$ di atas satu, dan mengulang pada polinom baru. Itu proses aljabar pada persamaannya, bukan rumus untuk $x_{n+1}$. - **Joseph Raphson, 1690.** Raphson menerbitkan cara mengulang satu rumus untuk polinom, tanpa menulis ulang persamaan setiap kali, yang merupakan bentuk metode yang kita pakai. - **Thomas Simpson, 1740.** Simpson menjelaskan metode itu dengan turunan, bentuk $x-\frac{f(x)}{f'(x)}$, untuk persamaan apa pun dan bahkan untuk dua persamaan sekaligus. - **Fourier dan Cauchy, 1820-an.** Joseph Fourier dan Augustin-Louis Cauchy mempelajari kapan metode ini konvergen. - **Cayley, 1879.** Arthur Cayley bertanya akar mana yang dicapai metode Newton dari awal di bidang kompleks. Untuk kuadrat bidang terbelah di sepanjang garis; untuk kubik batasnya menjadi fraktal yang kemudian dipelajari Julia dan Fatou. - **Kantorovich, 1948.** Leonid Kantorovich membuktikan teorema konvergensi yang hanya memerlukan syarat di titik awal, dan yang berlaku untuk sistem persamaan. ## Kesalahan apa yang sering terjadi pada metode Newton? **Kesalahan paling umum pada metode Newton adalah sembilan hal berikut, masing-masing dengan pernyataan yang benar.** | Kesalahan | Yang benar | |---|---| | ❌ Mulai dari mana saja | Awal itu penting: gambar $f$ atau cari perubahan tanda lebih dahulu. Dari $x_0=1{,}7$, $\sin x$ menuju $3\pi$, bukan $0$. | | ❌ Menerapkan rumus pada persamaan, bukan fungsi | Tulis persamaan sebagai $f(x)=0$ lebih dahulu: $x=1+0{,}5\sin x$ menjadi $f(x)=x-1-0{,}5\sin x$. | | ❌ Membagi ketika $f'(x_n)=0$ | Garis singgung mendatar tidak pernah memotong sumbu: pilih awal lain. | | ❌ Mengira selalu konvergen | $\sqrt[3]{x}$ memberi $x_{n+1}=-2x_n$, dan $x^3-2x+2$ dari $0$ berputar antara $0$ dan $1$. | | ❌ Berhenti ketika $|f(x_n)|$ kecil | Kurva datar dapat kecil jauh dari akarnya; periksa juga bahwa langkahnya kecil. | | ❌ Mengharapkan angka berlipat dua di setiap akar | Pada akar berkelipatan $m$ galat hanya mengecil dengan $\frac{m-1}{m}$ per langkah. | | ❌ Membulatkan hampiran terlalu dini | Simpan semua angka saat beriterasi dan bulatkan hanya jawaban akhir. | | ❌ Memakai derajat pada fungsi trigonometri | Turunan sinus dan kosinus mengandaikan radian. | | ❌ Mengira ia menemukan akar yang kamu mau, atau semua akar | Tiap awal menuju satu akar, yang mungkin jauh; lihat daerah tarikannya. | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: metode Newton sekilas - **Rumusnya:** $x_{n+1}=x_n-\frac{f(x_n)}{f'(x_n)}$, nol garis singgung di $x_n$; ia memerlukan $f'(x_n)\ne0$. - **Cara memakainya:** tulis persamaan sebagai $f(x)=0$, pilih $x_0$ dari grafik atau perubahan tanda, beriterasi, dan berhenti ketika langkah dan $f(x_n)$ sama-sama kecil. - **Kecepatan:** kuadrat di akar sederhana, $e_{n+1}=\frac{f''(\xi)}{2f'(x_n)}e_n^2$; linear, dengan rasio $\frac{m-1}{m}$, di akar berkelipatan $m$. - **Kegagalan:** garis singgung mendatar, siklus ($x^3-2x+2$ dari $0$), menjauh ($\sqrt[3]{x}$, $\arctan x$ jauh di luar), akar yang keliru ($\sin x$ dari $1{,}7$). - **Daerah tarikan:** awal yang mencapai tiap akar; batas di antaranya dapat sangat halus. - **Dengan tangan:** $\frac12\left(x+\frac ax\right)$ untuk $\sqrt a$ dan $x(2-ax)$ untuk $\frac1a$. - **Pengaman:** selang dan bisection sebagai cadangan, batas langkah, dan pemeriksaan langkah serta $|f|$. - **Berikutnya:** antiturunan, kebalikan dari diferensiasi. - **Kode:** perulangan dengan aturan berhenti; SymPy `lambdify` dan `diff`, atau selisih pusat. ## Glosarium: istilah penting - **Akar**: Bilangan r tempat fungsi bernilai nol, f(r) = 0, sehingga merupakan solusi persamaan f(x) = 0. - **Metode Newton**: Iterasi yang mengganti setiap hampiran akar dengan titik tempat garis singgung fungsi memotong sumbu-x. - **Iterasi**: Mengulang rumus yang sama, setiap kali pada hasil langkah terakhir, untuk menghasilkan barisan hampiran. - **Konvergensi kuadrat**: Laju yang galatnya kira-kira dikuadratkan di setiap langkah, sehingga banyaknya angka benar berlipat dua. - **Akar ganda**: Akar tempat turunannya juga nol, sehingga fungsi memiliki faktor (x − r) berpangkat m yang lebih besar dari satu. - **Daerah tarikan**: Himpunan nilai awal tempat suatu iterasi konvergen ke akar tertentu. - **Metode bisection**: Metode pencarian akar yang membagi dua selang tempat fungsi berubah tanda; ia lebih lambat daripada metode Newton tetapi tidak dapat gagal di dalam selang. ## Pertanyaan yang sering diajukan ### Apa itu metode Newton? Itu adalah cara menghampiri solusi f(x) sama dengan nol. Dari sebuah tebakan ia mengambil titik tempat garis singgung fungsi memotong sumbu-x, lalu mengulang. Rumusnya x dikurangi f(x) dibagi f aksen dari x. ### Bagaimana memilih nilai awal? Gambar fungsinya, atau cari selang tempat ia berubah tanda, dan pilih nilai di dekat akar yang kamu inginkan. Awal yang dekat dengan akar sederhana konvergen sangat cepat; awal yang jauh dapat berputar, menjauh, atau mencapai akar lain. ### Seberapa cepat metode Newton konvergen? Di akar sederhana ia konvergen secara kuadrat: galatnya kira-kira dikuadratkan di setiap langkah, sehingga banyaknya angka benar berlipat dua. Di akar ganda ia hanya linear, dan galat mengecil dengan faktor m dikurangi satu per m. ### Kapan metode Newton gagal? Ketika turunannya nol di suatu hampiran, ketika hampirannya berputar atau menjauh ke tak hingga, ketika awalnya terlalu jauh dari akar, atau ketika akarnya ganda dan konvergensinya lambat. Ia juga dapat mencapai akar yang bukan yang kamu inginkan. ### Kapan berhenti beriterasi? Berhentilah ketika perubahan antara dua hampiran lebih kecil daripada ketelitian yang kamu perlukan, dan periksa juga bahwa f(x) dekat dengan nol. Nilai f yang kecil saja tidak cukup untuk kurva datar, dan batas banyaknya langkah melindungi dari siklus. ### Bagaimana metode Newton dipakai untuk menghitung akar kuadrat? Terapkan pada x kuadrat dikurangi a. Rumusnya menjadi rata-rata x dan a dibagi x, yaitu aturan Babilonia. Dimulai dari 1, akar kuadrat 2 benar sampai dua belas desimal setelah empat langkah. ### Apa beda metode Newton dan bisection? Bisection membagi dua selang tempat fungsi berubah tanda, sehingga selalu berhasil di sana tetapi hanya menambah sekitar sepertiga angka per langkah. Metode Newton memerlukan turunan dan awal yang baik, dan ketika berhasil ia melipatduakan angka benar di setiap langkah. ### Siapa yang menemukan metode Newton? Isaac Newton menyelesaikan persamaan dengan cara ini pada 1669, dan Joseph Raphson menerbitkan rumus berulang yang lebih sederhana pada 1690. Thomas Simpson memberi bentuk dengan turunan pada 1740. Aturan perata-rataan untuk akar kuadrat jauh lebih tua, dari Babilonia dan Heron. --- # Applied Optimization Source: https://nunada.my.id/articles/applied-optimization/ Updated: 2026-10-22 ## Quick answer **To solve an applied optimization problem, write the quantity you want to make largest or smallest as a function of one variable, state the domain that the situation allows, and test the critical points and the endpoints of that domain.** A constraint is used to eliminate every other variable, and the answer is read back in the words of the problem: the dimensions, the price, the time, not just the value of $x$. ### Key takeaways - The strategy has four steps: read the problem and find the unknown to optimize; introduce variables and write every relation (a picture helps); express the unknown as a function of one variable with its domain; test the critical points and endpoints. - The domain comes from the situation, not from the formula: lengths cannot be negative and cut pieces cannot be larger than the sheet. A closed domain calls for the closed interval method; an open one calls for limits at the ends or the sign of $f'$ and $f''$. - Classic answers worth remembering: the closed can of a given volume uses the least metal when $h=2r$ (open top: $h=r$); a rectangle on a river fence is twice as long as it is wide; a rectangle in a semicircle has its corner at $45^\circ$ and area $R^2$. - Three laws are optimization results: light takes the quickest path, which gives Snell's law $\frac{\sin\theta_1}{c_1}=\frac{\sin\theta_2}{c_2}$; profit peaks where marginal revenue equals marginal cost; and the delivery cycle $x=\sqrt{\frac{2K}{hd}}$ makes delivery cost equal storage cost. - A lone critical point on an interval is the absolute extreme when $f''$ keeps one sign on the whole interval, or when $f'$ changes sign there and the function runs off to the same side at the open ends. - Check the answer against the problem: the units, whether the quantity must be a whole number (compare the whole numbers on both sides of the optimum), and whether the result answers what was asked. ## How do you solve an applied optimization problem? **An optimization problem asks for the best value of something: the rectangle of fixed perimeter with the most area, the cheapest can for a given volume, the production run with the largest profit.** The best value is a largest or smallest value of a function, and the [closed interval method](https://nunada.my.id/articles/extreme-values-on-closed-intervals/#closed-interval-method) already tells us how to find it. What is new is that the function is not given: you have to build it from a description in words. **The four steps.** 1. Read the problem until you know what is given and which unknown is to be maximized or minimized. 2. Introduce variables. Name every relevant quantity, list every relation between them as an equation, and draw a picture whenever you can. 3. Write the function. Use the relations to express the unknown as a function of a single variable, and say for which values of that variable the situation makes sense. This is the longest step. 4. Test the critical points and the endpoints of that domain, with whatever you know about the shape of the graph, and use $f'$ and $f''$ to classify the critical points. **Example.** You have 800 m of wire to fence a rectangular field that lies along a river, so only three sides need a fence. What is the largest area? The unknown is the area $A$. Call the two sides that meet the river $x$ and the side parallel to it $y$; the wire gives $2x+y=800$, so $y=800-2x$ and $$A(x)=x(800-2x),\qquad 0\le x\le400,$$ because neither side can be negative. Then $A'(x)=800-4x$ is zero at $x=200$, and the values are $A(0)=0$, $A(200)=80000$ and $A(400)=0$. The largest area is $80000$ m², with sides $200$ m and $y=400$ m: the side along the river is twice each of the others, not equal to them. ## How do you optimize boxes, cans and inscribed shapes? **Geometry problems are the best place to practice step 3, because a constraint such as a fixed volume or a fixed perimeter must be used to remove a variable.** **Example 1: the open box.** An open-top box is made from a $12$ cm by $12$ cm sheet of tin by cutting a square of side $x$ from each corner and folding up the sides. The box has base $(12-2x)\times(12-2x)$ and height $x$, so $$V(x)=x(12-2x)^2=144x-48x^2+4x^3.$$ The sheet is only $12$ cm wide, so $0\le x\le6$. Then $V'(x)=144-96x+12x^2=12(x-2)(x-6)$, which is zero at $x=2$ and $x=6$; the second is an endpoint, and $V(0)=V(6)=0$. The only interior critical point gives $V(2)=128$, so the largest volume is $128$ cm³ with squares of side $2$ cm (a box $8$ by $8$ by $2$). The widget in the article on extreme values lets you change the sheet. **Example 2: the one-liter can.** A closed can shaped like a cylinder must hold $1000$ cm³. The metal used is the surface area $A=2\pi r^2+2\pi rh$, and the volume gives $\pi r^2h=1000$, so $h=\frac{1000}{\pi r^2}$ and $$A(r)=2\pi r^2+\frac{2000}{r},\qquad r>0.$$ The domain has no endpoints, so look at the derivative: $A'(r)=4\pi r-\frac{2000}{r^2}=0$ gives $r^3=\frac{500}{\pi}$, that is $r=\sqrt[3]{\frac{500}{\pi}}\approx5.42$ cm. Since $A''(r)=4\pi+\frac{4000}{r^3}>0$ for every $r>0$, the graph is concave up everywhere and this critical point is the absolute minimum. Then $h=\frac{1000}{\pi r^2}=2r\approx10.84$ cm. For any volume the best closed can has $h=2r$: as tall as it is wide. Real cans differ because of seams, thicker lids, and the shelf they stand on, which are not in the model. With no lid the ends cost half as much and the best can has $h=r$; if the ends are cut from squares of side $2r$ and the waste counts, the metal is $8r^2+2\pi rh$ and the best ratio is $\frac hr=\frac8\pi\approx2.55$. **Example 3: the rectangle in a semicircle.** A rectangle is inscribed in a semicircle of radius $2$, with one side on the diameter. Put the center at the origin and let the upper right corner be $\left(x,\sqrt{4-x^2}\right)$. The rectangle has length $2x$, height $\sqrt{4-x^2}$ and area $$A(x)=2x\sqrt{4-x^2},\qquad 0\le x\le2.$$ Then $A'(x)=2\sqrt{4-x^2}-\frac{2x^2}{\sqrt{4-x^2}}=\frac{8-4x^2}{\sqrt{4-x^2}}$, zero at $x=\sqrt2$ and not defined at the endpoint $x=2$. With $A(0)=A(2)=0$ and $A(\sqrt2)=4$, the largest area is $4$, for a rectangle $2\sqrt2$ long and $\sqrt2$ high. For a semicircle of radius $R$ the same steps give $x=\frac{R}{\sqrt2}$ and area $R^2$: the corner sits at $45^\circ$. A useful trick: $A$ is largest where $A^2=4x^2(4-x^2)$ is largest, which has no root to differentiate. Choose a problem below. The widget shows the same four steps for fifteen textbook problems: what $x$ stands for, the relations, the domain, the graph, the table of critical points and ends with the best one marked, and the answer in the words of the problem. The can deserves its own look, because its answer does not depend on the volume. Change the volume, the kind of can and the radius below: the best radius changes with $V$, but the ratio $\frac hr$ does not. ## Why does light obey Snell’s law? **Fermat's principle says that light travels from one point to another along the path of least time, and from it the law of refraction follows as a calculus problem.** In a uniform medium the quickest path is the shortest, a straight line. When the path crosses from a medium where light has speed $c_1$ into one where it has speed $c_2$, it bends, and calculus tells us exactly how much. **Example 4: refraction.** Let the boundary between the media be the $x$-axis, put $A=(0,a)$ in the first medium and $B=(d,-b)$ in the second, and let the ray cross at $P=(x,0)$ for some $x$ in $[0,d]$. Distance is rate times time, so the time is distance divided by speed on each piece: $$t(x)=\frac{\sqrt{a^2+x^2}}{c_1}+\frac{\sqrt{b^2+(d-x)^2}}{c_2},\qquad 0\le x\le d.$$ The derivative is $$t'(x)=\frac{x}{c_1\sqrt{a^2+x^2}}-\frac{d-x}{c_2\sqrt{b^2+(d-x)^2}}=\frac{\sin\theta_1}{c_1}-\frac{\sin\theta_2}{c_2},$$ where $\theta_1$ and $\theta_2$ are the angles that the two pieces make with the normal to the boundary. This is continuous, it is negative at $x=0$ and positive at $x=d$, and it is increasing because $$t''(x)=\frac{a^2}{c_1\left(a^2+x^2\right)^{3/2}}+\frac{b^2}{c_2\left(b^2+(d-x)^2\right)^{3/2}}>0.$$ So $t'$ has exactly one zero, the Intermediate Value Theorem finds it, and it is the absolute minimum of $t$. At that point $$\frac{\sin\theta_1}{c_1}=\frac{\sin\theta_2}{c_2},$$ which is Snell's law, the law of refraction. The ray bends toward the normal in the slower medium. **A mirror.** If the ray bounces off a plane mirror and $B$ is on the same side, the speed is the same on both pieces, $c_1=c_2$, and $t'=0$ says $\sin\theta_1=\sin\theta_2$: the angle of incidence equals the angle of reflection. The same equation describes a lifeguard who runs on the sand and swims in the water, or Jane rowing and walking in the gallery above. Change the two media, the positions and the crossing point below. The orange path is yours and the green one is the quickest. ## How do cost, profit and inventory problems work? **In economics the best level of production is usually where the marginal revenue equals the marginal cost.** Let $r(x)$ be the revenue from selling $x$ items, $c(x)$ the cost of producing them, and $p(x)=r(x)-c(x)$ the profit. Items are whole numbers, but we learn most by treating $x$ as a real number and the functions as differentiable. The derivatives $r'$, $c'$ and $p'$ are the marginal revenue, marginal cost and marginal profit (see [marginal analysis](https://nunada.my.id/articles/the-derivative-as-a-rate-of-change/#marginal-analysis)). If the profit has a maximum at a critical point, then $$p'(x)=r'(x)-c'(x)=0,\qquad\text{so}\qquad r'(x)=c'(x).$$ At a production level that maximizes profit, marginal revenue equals marginal cost. **Example 5: MP3 players.** Suppose $r(x)=9x$ and $c(x)=x^3-6x^2+15x$ are the revenue and the cost in millions of dollars, with $x$ in millions of players. Then $r'(x)=9$ and $c'(x)=3x^2-12x+15$, and $c'(x)=r'(x)$ gives $3x^2-12x+6=0$, that is $x^2-4x+2=0$ and $x=2\pm\sqrt2$, about $0.586$ and $3.414$. The second derivative of the profit is $p''(x)=-c''(x)=-(6x-12)$, which is negative at $x=2+\sqrt2$ and positive at $x=2-\sqrt2$. So a maximum profit occurs at $x\approx3.414$ million players, where $p=4+4\sqrt2\approx9.66$ million dollars, and a maximum loss at $x\approx0.586$ million. The company breaks even where $r=c$, at $x=3\pm\sqrt3$, so the maximum profit is between the break-even points. If the price falls below $3$ the equation has no solution, because the marginal cost is never below $3$: every extra player then costs more than it earns, and the best plan is to make none. **Example 6: how often to deliver.** A cabinetmaker uses $5$ units of cherry wood a day. Each delivery costs $5000$ dollars, and storing a unit costs $10$ dollars a day. If a delivery comes every $x$ days she must order $5x$ units, and the average amount in storage is about $\frac{5x}{2}$ units, held for $x$ days. The cost of one cycle is $5000+\frac{5x}{2}\cdot10\cdot x$, and the average daily cost is that divided by $x$: $$c(x)=\frac{5000}{x}+25x,\qquad x>0.$$ Then $c'(x)=-\frac{5000}{x^2}+25=0$ gives $x^2=200$, $x=10\sqrt2\approx14.14$ days (the negative root is outside the domain), and $c''(x)=\frac{10000}{x^3}>0$ on the whole domain, so this is the absolute minimum: $c\approx707.11$ dollars a day, for an order of about $70$ units. Whole days are better for the schedule: $14$ days costs $707.14$ and $15$ days costs $708.33$. **The general rule.** With a cost $K$ per delivery, $d$ units used a day and a storage cost $h$ per unit per day, $c(x)=\frac Kx+\frac{hd}{2}x$ has its minimum at $$x=\sqrt{\frac{2K}{hd}},$$ and there the two terms are equal, $\frac Kx=\frac{hd}{2}x$: the delivery cost per day equals the storage cost per day. In inventory management the same result is the Wilson lot size formula: for an average weekly cost $A(q)=\frac{km}{q}+cm+\frac{hq}{2}$ of ordering, paying for and holding $q$ items, the best order is $q=\sqrt{\frac{2km}{h}}$. Drag the price and the production level in the first widget and the costs in the second. ## What if the domain is open, or has no endpoint to test? **When the domain is open, such as $r>0$, there is no endpoint to compare, so you show that the critical point is the absolute extreme by the shape of the function.** Four tools do it, from the strongest to the most common. 1. The sign of $f''$ on the whole domain. If $f''>0$ everywhere, the graph is concave up, a critical point is a minimum and it is the absolute minimum. This settled the can and the delivery cycle. 2. The sign of $f'$. If $f'<0$ to the left of the only critical point and $f'>0$ to its right, the function falls and then rises, which is the [First Derivative Test](https://nunada.my.id/articles/monotonic-functions-and-the-first-derivative-test/#first-derivative-test), and the point is the absolute minimum. 3. Limits at the open ends. If $f$ grows without bound at both ends, then no end can beat the critical value, so the lowest critical value is the absolute minimum. If $f$ only levels off toward a value, compare the critical value with that limit: a function can approach a value it never reaches, and then the extreme does not exist. 4. One critical point. A continuous function on an interval that has a single critical point cannot turn around anywhere else, so a local minimum there is the absolute minimum on the interval. **Example 7: the poster.** A poster needs $312.5$ cm² of print, with margins of $10$ cm at the top and bottom and $5$ cm on each side. If the print is $x$ wide it is $\frac{312.5}{x}$ high, and the paper is $x+10$ by $\frac{312.5}{x}+20$: $$P(x)=(x+10)\left(\frac{312.5}{x}+20\right)=20x+\frac{3125}{x}+512.5,\qquad x>0.$$ Then $P'(x)=20-\frac{3125}{x^2}=0$ gives $x=12.5$, and $P''(x)=\frac{6250}{x^3}>0$, so it is the absolute minimum: print $12.5$ by $25$, paper $22.5$ by $45$ cm, using $1012.5$ cm² of paper. As $x\to0^+$ and as $x\to\infty$ the area $P\to\infty$, so there is no largest poster, and asking for one would have no answer. **Whole numbers.** If $x$ counts people or days, the real optimum is only a guide. The best whole number is one of the two on either side of it, and you compare their values, as with $14$ and $15$ days above. A tour with $x$ people at a fare of $300-2x$ dollars, fixed cost $6000$ and $32$ per person, has profit $p(x)=268x-2x^2-6000$ on $50\le x\le80$, with $p'(x)=268-4x=0$ at $x=67$, which happens to be a whole number: $67$ people, a fare of $166$ and a profit of $2978$. The widget above includes this problem. **Check the answer.** Does it fall inside the domain? Is it a maximum or a minimum, as the problem asks? Are the units consistent? Does it answer the question asked, such as the dimensions or the least amount of material, and not just the value of $x$? ## How do you optimize in code? **In code, SymPy follows the four steps exactly: differentiate, solve $f'=0$, keep the roots inside the domain, and compare them with the value or limit at each end.** Without a CAS, a derivative-free search finds the minimum of a function that falls and then rises (a unimodal function): the golden-section search shrinks the interval around the minimum by the same ratio each time, and bisection on the sign of $f'$ does the same with the derivative. A search that uses only values of $f$ can locate the minimum to about the square root of the machine precision, roughly $10^{-8}$, because $f$ is flat there; the derivative gives a better answer. ```python import sympy as sp x = sp.symbols('x', positive=True) def optimize(f, a, b, want='min'): """Best value of f on (a, b): the critical points inside, plus the value or limit at each end.""" rows = [(s, sp.simplify(f.subs(x, s))) for s in sp.solve(sp.diff(f, x), x) if s.is_real and a < s < b] rows += [(end, sp.limit(f, x, end)) for end in (a, b)] pick = min if want == 'min' else max return pick(rows, key=lambda row: float(row[1])), rows problems = ( ('box', x * (12 - 2 * x) ** 2, 0, 6, 'max'), # Example 1 ('can', 2 * sp.pi * x ** 2 + 2000 / x, 0, sp.oo, 'min'), # Example 2 ('poster', 20 * x + 3125 / x + sp.Rational(1025, 2), 0, sp.oo, 'min'), # Example 7 ('beam over a wall', (x + 5) * sp.sqrt(1 + 4 / x ** 2), 0, sp.oo, 'min'), # a 2 m wall, 5 m from a building ) for name, f, a, b, want in problems: (xb, fb), _ = optimize(f, a, b, want) print(name, xb, '->', sp.simplify(fb), '=', round(float(fb), 4)) # box 2 -> 128 = 128.0 # can 5*2**(2/3)/pi**(1/3) -> 300*2**(1/3)*pi**(1/3) = 553.581 # poster 25/2 -> 2025/2 = 1012.5 # beam over a wall 20**(1/3) -> sqrt(5)*(20**(1/3) + 5)**(3/2)/5 = 9.5823 ``` ```javascript // golden-section search: the smallest value of a function that falls and then rises on [a, b] const golden = (f, a, b, tol = 1e-9) => { const g = (Math.sqrt(5) - 1) / 2 let c = b - g * (b - a) let d = a + g * (b - a) while (b - a > tol) { if (f(c) < f(d)) b = d else a = c c = b - g * (b - a) d = a + g * (b - a) } return (a + b) / 2 } const can = (r) => 2 * Math.PI * r * r + 2000 / r // the one-liter can of Example 2 const r = golden(can, 0.1, 50) ;[r, 1000 / (Math.PI * r * r), can(r)].map((v) => +v.toFixed(4)) // [5.4193, 10.8385, 553.581] const beam = (x) => (x + 5) * Math.sqrt(1 + 4 / (x * x)) // the shortest beam over a wall const xb = golden(beam, 0.1, 50) ;[xb, beam(xb)].map((v) => +v.toFixed(4)) // [2.7144, 9.5823] // the same radius from the derivative: bisect on the sign of A'(r) = 4 pi r - 2000 / r^2 let lo = 0.1 let hi = 50 for (let i = 0; i < 60; i++) { const mid = (lo + hi) / 2 if (4 * Math.PI * mid - 2000 / (mid * mid) < 0) lo = mid else hi = mid } +lo.toFixed(6) // 5.419261 ``` ```cpp #include #include #include using namespace std; double area(double r) { return 2 * 3.14159265358979 * r * r + 2000 / r; // metal for a one-liter can } int main() { double lo = 0.1; double hi = 50; for (int i = 0; i < 100; i++) { // ternary search: the area falls and then rises double m1 = lo + (hi - lo) / 3; double m2 = hi - (hi - lo) / 3; if (area(m1) < area(m2)) hi = m2; else lo = m1; } double r = (lo + hi) / 2; double h = 1000 / (3.14159265358979 * r * r); printf("r=%.4f h=%.4f A=%.4f\n", r, h, area(r)); printf("h/r=%.4f\n", h / r); // the best closed can is as tall as it is wide return 0; } /* output: r=5.4193 h=10.8385 A=553.5810 h/r=2.0000 */ ``` ## Where does optimization come from? **The oldest optimization problems are geometric, and the calculus way of solving them is only about four centuries old.** - **Dido's problem, ancient.** The legend in Virgil's Aeneid says that Queen Dido was allowed as much land as an ox hide could surround, and cut the hide into a thin strip: how should a given length enclose the largest area? The answer, a circle, is among the first optimization problems. - **Johannes Kepler, 1615.** Kepler studied the volume of wine barrels and noticed that near the largest volume a small change of shape hardly changes the volume. That flatness at the top is exactly what $f'=0$ says. - **Pierre de Fermat, about 1629–1636.** Fermat described a method for maxima and minima: compare $f(x)$ with $f(x+e)$, divide by $e$, and then set $e$ to zero. Without the name, it is the derivative equal to zero. - **Snell and Fermat, 1621 and 1662.** Willebrord Snell found the law of refraction around 1621 without publishing it; Descartes printed it in 1637. In 1662 Fermat showed that it follows from the principle that light takes the path of least time, one of the first physical laws stated as an optimization. - **Harris and Wilson, 1913 and 1934.** Ford W. Harris derived the economic order quantity in 1913, and R. H. Wilson popularized it in 1934, which is why the inventory result is called the Wilson lot size formula. - **Today.** Setting the derivative to zero, and its many-variable version with the gradient, is the core of fitting a line to data and of training machine-learning models, where the minimum is found by a search that moves downhill. ## What mistakes do people make in optimization problems? **The most common mistakes in applied optimization are the nine below, each with the correct statement.** | Mistake | Correct | |---|---| | ❌ Differentiate with two variables left in, such as $A=2\pi r^2+2\pi rh$ | Use the constraint $\pi r^2h=1000$ first: $A(r)=2\pi r^2+\frac{2000}{r}$, then differentiate. | | ❌ Forget the domain | The situation sets it: $0\le x\le6$ for the box. A critical point outside it, like $x=-10\sqrt2$ for the deliveries, is thrown away. | | ❌ Test only the critical points | The endpoints can win: $x^3-3x$ on $[-2,3]$ has the critical point $x=-1$ with value $2$, but the maximum is $18$ at $x=3$. | | ❌ Assume a critical point is a maximum | Classify it: for the can, $A''(r)>0$ everywhere, so it is a minimum; with $A''<0$ it would be a maximum. | | ❌ Answer with the value of $x$ | Answer what was asked: the largest volume is $V(2)=128$ cm³, and the cut is $2$ cm. | | ❌ Optimize the wrong quantity | Minimize the surface area of the can, not its volume, which is fixed. | | ❌ Mix units | Keep cm with cm, hours with hours, and thousand rupiah with thousand rupiah. | | ❌ Round the real optimum | If $x$ must be a whole number, compare the whole numbers on both sides: $14$ days costs $707.14$, $15$ days $708.33$. | | ❌ Expect the nicest shape | The best field on a river is $200$ by $400$, not a square, and the best rectangle in a semicircle is twice as long as it is high. | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: applied optimization at a glance - **The four steps:** read; introduce variables and relations; write the objective as a function of one variable with its domain; test critical points and endpoints. - **Domain:** from the situation; closed means compare the endpoints, open means limits at the ends or the sign of $f'$ and $f''$. - **Geometry:** closed can $h=2r$, open can $h=r$, field on a river twice as long as it is wide, rectangle in a semicircle of radius $R$ has area $R^2$. - **Light:** the quickest path gives $\frac{\sin\theta_1}{c_1}=\frac{\sin\theta_2}{c_2}$; a mirror gives equal angles. - **Economics:** $r'(x)=c'(x)$ at maximum profit; the delivery cycle $x=\sqrt{\frac{2K}{hd}}$; the Wilson lot size $q=\sqrt{\frac{2km}{h}}$. - **Whole numbers:** compare the two whole numbers around the optimum. - **Check:** units, domain, maximum or minimum, and the quantity asked. - **Code:** SymPy `diff`, `solve`, `limit`, or a golden-section search for a function that falls and then rises. ## Glossary: key terms - **Objective function**: The quantity to be made largest or smallest, written as a function of one variable. - **Constraint**: A relation between the variables, such as a fixed volume or a fixed length of wire, used to remove all but one of them. - **Domain**: The values of the variable for which the situation makes sense, which may be closed or open. - **Critical point**: An interior point of the domain where the derivative is zero or does not exist. - **Marginal cost**: The derivative of the cost function, about the cost of making one more item. - **Fermat’s principle**: Light travels between two points along the path that takes the least time. - **Snell’s law**: The law of refraction: the sine of the angle from the normal divided by the speed is the same on both sides of a boundary. - **Wilson lot size**: The order quantity that minimizes the average cost of ordering and holding stock, the square root of twice the ordering cost times the demand over the holding cost. ## Frequently asked questions ### What is an optimization problem in calculus? It is a problem that asks for the largest or smallest value of some quantity, such as the greatest area or the least cost. You write the quantity as a function of one variable, find its domain, and use the derivative to find where it is largest or smallest. ### What are the steps to solve an optimization problem? Read the problem, introduce variables and write the relations, express the quantity as a function of one variable with its domain, and then test the critical points and the endpoints. Finally, answer in the words of the problem, with units. ### Why do you have to check the endpoints? On a closed domain the best value can be at an endpoint, where the derivative need not be zero. Only comparing the critical points with the endpoints guarantees the right answer, as the function x cubed minus 3x on minus 2 to 3 shows. ### How do you know a critical point is a maximum or a minimum? Compare it with the endpoints on a closed domain. On an open domain use the second derivative: positive on the whole domain means a minimum, negative means a maximum. You can also check that the first derivative changes sign, or look at the limits at the ends. ### What shape of can uses the least metal? For a closed cylindrical can of a given volume, the height equals the diameter, so h is twice r. With no lid the height equals the radius. The result does not depend on the volume, which is why the ratio is the same for every size. ### Why does profit peak where marginal revenue equals marginal cost? Profit is revenue minus cost, so its derivative is marginal revenue minus marginal cost. At a maximum that derivative is zero, so the two marginals are equal. Before that point one more item adds more revenue than cost, and after it adds less. ### What is the Wilson lot size or economic order quantity? It is the order size that minimizes the average cost of ordering and storing stock. It equals the square root of twice the ordering cost times the demand, divided by the holding cost per item. At that size the ordering and storing costs are equal. ### How does Fermat’s principle give Snell’s law? Write the time of a ray from A to B through a point on the boundary, and set the derivative with respect to that point equal to zero. The result says that the sine of the angle divided by the speed is the same on both sides, which is Snell’s law. --- # Optimisasi Terapan Source: https://nunada.my.id/artikel/optimisasi-terapan/ Updated: 2026-10-22 ## Jawaban singkat **Untuk menyelesaikan soal optimisasi terapan, tulis besaran yang ingin dibuat terbesar atau terkecil sebagai fungsi satu peubah, tentukan domain yang diizinkan oleh keadaannya, lalu uji titik kritis dan ujung domain itu.** Kendala dipakai untuk menghilangkan semua peubah lain, dan jawabannya dibaca kembali dengan kata-kata soal: ukuran, harga, waktu, bukan hanya nilai $x$. ### Poin penting - Strateginya empat langkah: baca soal dan tentukan besaran yang dioptimalkan; perkenalkan peubah dan tulis setiap hubungan (gambar membantu); nyatakan besaran itu sebagai fungsi satu peubah beserta domainnya; uji titik kritis dan ujungnya. - Domain berasal dari keadaan soal, bukan dari rumusnya: panjang tidak boleh negatif dan potongan tidak boleh lebih besar daripada karton. Domain tertutup memakai metode selang tertutup; domain terbuka memakai limit di ujung atau tanda $f'$ dan $f''$. - Jawaban klasik yang perlu diingat: kaleng tertutup dengan volume tertentu memakai logam paling sedikit saat $h=2r$ (tanpa tutup: $h=r$); persegi panjang di tepi sungai panjangnya dua kali lebarnya; persegi panjang dalam setengah lingkaran punya sudut di $45^\circ$ dan luas $R^2$. - Tiga hukum adalah hasil optimisasi: cahaya menempuh jalur tercepat, yang memberi hukum Snell $\frac{\sin\theta_1}{c_1}=\frac{\sin\theta_2}{c_2}$; laba memuncak ketika pendapatan marjinal sama dengan biaya marjinal; dan siklus pengiriman $x=\sqrt{\frac{2K}{hd}}$ membuat biaya pengiriman sama dengan biaya penyimpanan. - Satu titik kritis tunggal pada suatu selang adalah ekstrem mutlak jika $f''$ tetap satu tanda di seluruh selang, atau jika $f'$ berganti tanda di sana dan fungsi menuju sisi yang sama di ujung terbuka. - Periksa jawaban dengan soalnya: satuannya, apakah besarannya harus bilangan bulat (bandingkan bilangan bulat di kedua sisi optimum), dan apakah hasilnya menjawab yang ditanyakan. ## Bagaimana menyelesaikan soal optimisasi terapan? **Soal optimisasi meminta nilai terbaik dari sesuatu: persegi panjang dengan keliling tetap yang luasnya terbesar, kaleng termurah untuk volume tertentu, produksi dengan laba terbesar.** Nilai terbaik adalah nilai terbesar atau terkecil suatu fungsi, dan [metode selang tertutup](https://nunada.my.id/artikel/nilai-ekstrem-pada-selang-tertutup/#closed-interval-method) sudah menunjukkan cara mencarinya. Yang baru adalah fungsinya tidak diberikan: kamu harus membangunnya dari uraian dengan kata-kata. **Empat langkah.** 1. Baca soal sampai kamu tahu apa yang diketahui dan besaran mana yang harus dimaksimumkan atau diminimumkan. 2. Perkenalkan peubah. Beri nama setiap besaran yang relevan, tulis setiap hubungan di antaranya sebagai persamaan, dan gambarlah bila bisa. 3. Tulis fungsinya. Pakai hubungan itu untuk menyatakan besaran yang dicari sebagai fungsi satu peubah, dan tentukan untuk nilai peubah mana keadaannya masuk akal. Inilah langkah yang paling panjang. 4. Uji titik kritis dan ujung domain itu, dengan apa pun yang kamu ketahui tentang bentuk grafiknya, dan pakai $f'$ dan $f''$ untuk menggolongkan titik kritisnya. **Contoh.** Kamu punya kawat 800 m untuk memagari tanah persegi panjang yang berbatasan dengan sungai, sehingga hanya tiga sisi yang perlu pagar. Berapa luas terbesar? Besaran yang dicari adalah luas $A$. Sebut dua sisi yang tegak lurus sungai $x$ dan sisi yang sejajar sungai $y$; kawat memberi $2x+y=800$, sehingga $y=800-2x$ dan $$A(x)=x(800-2x),\qquad 0\le x\le400,$$ karena tidak ada sisi yang boleh negatif. Maka $A'(x)=800-4x$ nol di $x=200$, dan nilainya $A(0)=0$, $A(200)=80000$, dan $A(400)=0$. Luas terbesar $80000$ m², dengan sisi $200$ m dan $y=400$ m: sisi di sepanjang sungai dua kali masing-masing sisi lainnya, bukan sama dengannya. ## Bagaimana mengoptimalkan kotak, kaleng, dan bangun dalam? **Soal geometri adalah tempat terbaik melatih langkah 3, karena kendala seperti volume atau keliling tetap harus dipakai untuk menghilangkan satu peubah.** **Contoh 1: kotak terbuka.** Kotak tanpa tutup dibuat dari lembaran timah $12$ cm kali $12$ cm dengan memotong persegi bersisi $x$ dari setiap sudut lalu melipat sisinya. Kotak itu beralas $(12-2x)\times(12-2x)$ dan tinggi $x$, sehingga $$V(x)=x(12-2x)^2=144x-48x^2+4x^3.$$ Lembaran hanya selebar $12$ cm, sehingga $0\le x\le6$. Maka $V'(x)=144-96x+12x^2=12(x-2)(x-6)$, yang nol di $x=2$ dan $x=6$; yang kedua adalah ujung, dan $V(0)=V(6)=0$. Satu-satunya titik kritis di dalam memberi $V(2)=128$, sehingga volume terbesar $128$ cm³ dengan persegi bersisi $2$ cm (kotak $8$ kali $8$ kali $2$). Widget di artikel nilai ekstrem memungkinkan kamu mengubah ukuran lembarannya. **Contoh 2: kaleng satu liter.** Kaleng tertutup berbentuk tabung harus memuat $1000$ cm³. Logam yang terpakai adalah luas permukaan $A=2\pi r^2+2\pi rh$, dan volumenya memberi $\pi r^2h=1000$, sehingga $h=\frac{1000}{\pi r^2}$ dan $$A(r)=2\pi r^2+\frac{2000}{r},\qquad r>0.$$ Domainnya tidak punya ujung, jadi lihat turunannya: $A'(r)=4\pi r-\frac{2000}{r^2}=0$ memberi $r^3=\frac{500}{\pi}$, yaitu $r=\sqrt[3]{\frac{500}{\pi}}\approx5{,}42$ cm. Karena $A''(r)=4\pi+\frac{4000}{r^3}>0$ untuk setiap $r>0$, grafiknya cekung ke atas di mana-mana dan titik kritis ini adalah minimum mutlak. Maka $h=\frac{1000}{\pi r^2}=2r\approx10{,}84$ cm. Untuk volume mana pun kaleng tertutup terbaik memiliki $h=2r$: setinggi lebarnya. Kaleng nyata berbeda karena sambungan, tutup yang lebih tebal, dan rak tempat ia berdiri, yang tidak ada dalam model. Tanpa tutup, biaya bagian ujung separuhnya dan kaleng terbaik memiliki $h=r$; jika tutup dan alas dipotong dari persegi bersisi $2r$ dan sisa potongan dihitung, logamnya $8r^2+2\pi rh$ dan perbandingan terbaiknya $\frac hr=\frac8\pi\approx2{,}55$. **Contoh 3: persegi panjang dalam setengah lingkaran.** Sebuah persegi panjang dibuat di dalam setengah lingkaran berjari-jari $2$, dengan satu sisinya pada diameter. Letakkan pusat di titik asal dan misalkan sudut kanan atasnya $\left(x,\sqrt{4-x^2}\right)$. Persegi panjang itu berpanjang $2x$, tinggi $\sqrt{4-x^2}$, dan luas $$A(x)=2x\sqrt{4-x^2},\qquad 0\le x\le2.$$ Maka $A'(x)=2\sqrt{4-x^2}-\frac{2x^2}{\sqrt{4-x^2}}=\frac{8-4x^2}{\sqrt{4-x^2}}$, nol di $x=\sqrt2$ dan tidak terdefinisi di ujung $x=2$. Dengan $A(0)=A(2)=0$ dan $A(\sqrt2)=4$, luas terbesarnya $4$, untuk persegi panjang sepanjang $2\sqrt2$ dan setinggi $\sqrt2$. Untuk setengah lingkaran berjari-jari $R$ langkah yang sama memberi $x=\frac{R}{\sqrt2}$ dan luas $R^2$: sudutnya berada di $45^\circ$. Trik yang berguna: $A$ terbesar di tempat $A^2=4x^2(4-x^2)$ terbesar, yang tidak punya akar untuk diturunkan. Pilih satu soal di bawah. Widget ini menunjukkan empat langkah yang sama untuk lima belas soal dari buku: arti $x$, hubungannya, domain, grafik, tabel titik kritis dan ujung dengan yang terbaik ditandai, dan jawaban dalam kata-kata soal. Kaleng layak dilihat tersendiri, karena jawabannya tidak bergantung pada volume. Ubah volume, jenis kaleng, dan jari-jarinya di bawah: jari-jari terbaik berubah menurut $V$, tetapi perbandingan $\frac hr$ tidak. ## Mengapa cahaya mengikuti hukum Snell? **Prinsip Fermat menyatakan bahwa cahaya menempuh jalur dari satu titik ke titik lain dengan waktu paling singkat, dan darinya hukum pembiasan mengikuti sebagai soal kalkulus.** Dalam medium yang seragam jalur tercepat adalah yang terpendek, yaitu garis lurus. Ketika jalur berpindah dari medium tempat cahaya berkecepatan $c_1$ ke medium berkecepatan $c_2$, ia membelok, dan kalkulus menunjukkan tepat seberapa banyak. **Contoh 4: pembiasan.** Misalkan batas kedua medium adalah sumbu-$x$, letakkan $A=(0,a)$ di medium pertama dan $B=(d,-b)$ di medium kedua, dan misalkan sinar memotong di $P=(x,0)$ untuk suatu $x$ di $[0,d]$. Jarak adalah laju kali waktu, sehingga waktunya adalah jarak dibagi kecepatan pada tiap bagian: $$t(x)=\frac{\sqrt{a^2+x^2}}{c_1}+\frac{\sqrt{b^2+(d-x)^2}}{c_2},\qquad 0\le x\le d.$$ Turunannya $$t'(x)=\frac{x}{c_1\sqrt{a^2+x^2}}-\frac{d-x}{c_2\sqrt{b^2+(d-x)^2}}=\frac{\sin\theta_1}{c_1}-\frac{\sin\theta_2}{c_2},$$ dengan $\theta_1$ dan $\theta_2$ sudut yang dibentuk kedua bagian dengan garis normal batas. Ini kontinu, negatif di $x=0$ dan positif di $x=d$, dan naik karena $$t''(x)=\frac{a^2}{c_1\left(a^2+x^2\right)^{3/2}}+\frac{b^2}{c_2\left(b^2+(d-x)^2\right)^{3/2}}>0.$$ Jadi $t'$ memiliki tepat satu nol, Teorema Nilai Antara menemukannya, dan itulah minimum mutlak $t$. Di titik itu $$\frac{\sin\theta_1}{c_1}=\frac{\sin\theta_2}{c_2},$$ yaitu hukum Snell, hukum pembiasan. Sinar membelok mendekati normal di medium yang lebih lambat. **Cermin.** Jika sinar memantul pada cermin datar dan $B$ ada di sisi yang sama, kecepatan sama pada kedua bagian, $c_1=c_2$, dan $t'=0$ berarti $\sin\theta_1=\sin\theta_2$: sudut datang sama dengan sudut pantul. Persamaan yang sama menggambarkan penjaga pantai yang berlari di pasir dan berenang di air, atau Jane yang mendayung dan berjalan di galeri di atas. Ubah kedua medium, posisi, dan titik potongnya di bawah. Jalur oranye adalah jalurmu dan yang hijau adalah yang tercepat. ## Bagaimana soal biaya, laba, dan persediaan bekerja? **Dalam ekonomi, tingkat produksi terbaik biasanya ada di tempat pendapatan marjinal sama dengan biaya marjinal.** Misalkan $r(x)$ pendapatan dari penjualan $x$ barang, $c(x)$ biaya produksinya, dan $p(x)=r(x)-c(x)$ laba. Banyak barang adalah bilangan bulat, tetapi kita paling banyak belajar dengan memperlakukan $x$ sebagai bilangan real dan fungsinya terdiferensialkan. Turunan $r'$, $c'$, dan $p'$ adalah pendapatan marjinal, biaya marjinal, dan laba marjinal (lihat [analisis marjinal](https://nunada.my.id/artikel/turunan-sebagai-laju-perubahan/#marginal-analysis)). Jika laba memiliki maksimum di suatu titik kritis, maka $$p'(x)=r'(x)-c'(x)=0,\qquad\text{jadi}\qquad r'(x)=c'(x).$$ Pada tingkat produksi yang memaksimumkan laba, pendapatan marjinal sama dengan biaya marjinal. **Contoh 5: pemutar MP3.** Misalkan $r(x)=9x$ dan $c(x)=x^3-6x^2+15x$ adalah pendapatan dan biaya dalam miliaran rupiah, dengan $x$ dalam jutaan pemutar. Maka $r'(x)=9$ dan $c'(x)=3x^2-12x+15$, dan $c'(x)=r'(x)$ memberi $3x^2-12x+6=0$, yaitu $x^2-4x+2=0$ dan $x=2\pm\sqrt2$, sekitar $0{,}586$ dan $3{,}414$. Turunan kedua laba adalah $p''(x)=-c''(x)=-(6x-12)$, yang negatif di $x=2+\sqrt2$ dan positif di $x=2-\sqrt2$. Jadi laba maksimum terjadi di $x\approx3{,}414$ juta pemutar, dengan $p=4+4\sqrt2\approx9{,}66$ miliar rupiah, dan rugi terbesar di $x\approx0{,}586$ juta. Perusahaan impas di tempat $r=c$, yaitu $x=3\pm\sqrt3$, sehingga laba maksimum ada di antara titik impas. Jika harga turun di bawah $3$, persamaannya tidak punya penyelesaian, karena biaya marjinal tidak pernah di bawah $3$: setiap pemutar tambahan lebih mahal daripada hasilnya, dan rencana terbaik adalah tidak membuat apa pun. **Contoh 6: seberapa sering mengirim.** Seorang pembuat lemari memakai $5$ satuan kayu ceri sehari. Setiap pengiriman berbiaya $5000$ ribu rupiah, dan menyimpan satu satuan berbiaya $10$ ribu rupiah sehari. Jika pengiriman datang tiap $x$ hari ia harus memesan $5x$ satuan, dan jumlah rata-rata di gudang sekitar $\frac{5x}{2}$ satuan, disimpan selama $x$ hari. Biaya satu siklus $5000+\frac{5x}{2}\cdot10\cdot x$, dan biaya harian rata-ratanya adalah itu dibagi $x$: $$c(x)=\frac{5000}{x}+25x,\qquad x>0.$$ Maka $c'(x)=-\frac{5000}{x^2}+25=0$ memberi $x^2=200$, $x=10\sqrt2\approx14{,}14$ hari (akar negatif di luar domain), dan $c''(x)=\frac{10000}{x^3}>0$ di seluruh domain, sehingga ini minimum mutlak: $c\approx707{,}11$ ribu rupiah sehari, untuk pesanan sekitar $70$ satuan. Hari bulat lebih baik untuk jadwal: $14$ hari berbiaya $707{,}14$ dan $15$ hari berbiaya $708{,}33$. **Aturan umumnya.** Dengan biaya $K$ per pengiriman, $d$ satuan terpakai sehari, dan biaya simpan $h$ per satuan per hari, $c(x)=\frac Kx+\frac{hd}{2}x$ mencapai minimum di $$x=\sqrt{\frac{2K}{hd}},$$ dan di sana kedua sukunya sama, $\frac Kx=\frac{hd}{2}x$: biaya pengiriman per hari sama dengan biaya penyimpanan per hari. Dalam manajemen persediaan hasil yang sama adalah rumus ukuran lot Wilson: untuk biaya mingguan rata-rata $A(q)=\frac{km}{q}+cm+\frac{hq}{2}$ untuk memesan, membayar, dan menyimpan $q$ barang, pesanan terbaik adalah $q=\sqrt{\frac{2km}{h}}$. Geser harga dan tingkat produksi di widget pertama dan biayanya di widget kedua. ## Bagaimana jika domainnya terbuka, atau tidak punya ujung untuk diuji? **Ketika domainnya terbuka, seperti $r>0$, tidak ada ujung untuk dibandingkan, sehingga kamu menunjukkan bahwa titik kritis adalah ekstrem mutlak lewat bentuk fungsinya.** Empat alat melakukannya, dari yang paling kuat hingga yang paling lazim. 1. Tanda $f''$ di seluruh domain. Jika $f''>0$ di mana-mana, grafiknya cekung ke atas, titik kritis adalah minimum dan ia adalah minimum mutlak. Inilah yang menyelesaikan kaleng dan siklus pengiriman. 2. Tanda $f'$. Jika $f'<0$ di kiri satu-satunya titik kritis dan $f'>0$ di kanannya, fungsi turun lalu naik, yaitu [Uji Turunan Pertama](https://nunada.my.id/artikel/fungsi-monoton-dan-uji-turunan-pertama/#first-derivative-test), dan titik itu adalah minimum mutlak. 3. Limit di ujung terbuka. Jika $f$ membesar tanpa batas di kedua ujung, tidak ada ujung yang dapat mengalahkan nilai kritis, sehingga nilai kritis terendah adalah minimum mutlak. Jika $f$ hanya mendatar menuju suatu nilai, bandingkan nilai kritis dengan limit itu: fungsi dapat mendekati nilai yang tidak pernah dicapainya, dan ekstremnya lalu tidak ada. 4. Satu titik kritis. Fungsi kontinu pada suatu selang yang hanya memiliki satu titik kritis tidak dapat berbalik di tempat lain, sehingga minimum lokal di sana adalah minimum mutlak pada selang itu. **Contoh 7: poster.** Sebuah poster memerlukan cetakan seluas $312{,}5$ cm², dengan margin $10$ cm di atas dan bawah serta $5$ cm di tiap sisi. Jika cetakan selebar $x$ maka tingginya $\frac{312{,}5}{x}$, dan kertasnya $x+10$ kali $\frac{312{,}5}{x}+20$: $$P(x)=(x+10)\left(\frac{312{,}5}{x}+20\right)=20x+\frac{3125}{x}+512{,}5,\qquad x>0.$$ Maka $P'(x)=20-\frac{3125}{x^2}=0$ memberi $x=12{,}5$, dan $P''(x)=\frac{6250}{x^3}>0$, sehingga ini minimum mutlak: cetakan $12{,}5$ kali $25$, kertas $22{,}5$ kali $45$ cm, memakai kertas $1012{,}5$ cm². Ketika $x\to0^+$ dan ketika $x\to\infty$ luasnya $P\to\infty$, sehingga tidak ada poster terbesar, dan menanyakannya tidak akan punya jawaban. **Bilangan bulat.** Jika $x$ menghitung orang atau hari, optimum real hanyalah penunjuk. Bilangan bulat terbaik adalah salah satu dari dua di kedua sisinya, dan kamu membandingkan nilainya, seperti $14$ dan $15$ hari di atas. Sebuah tur dengan $x$ peserta dengan tarif $300-2x$ ribu rupiah, biaya tetap $6000$ dan $32$ per orang, berlaba $p(x)=268x-2x^2-6000$ pada $50\le x\le80$, dengan $p'(x)=268-4x=0$ di $x=67$, yang kebetulan bilangan bulat: $67$ peserta, tarif $166$, dan laba $2978$. Widget di atas memuat soal ini. **Periksa jawabannya.** Apakah jatuh di dalam domain? Apakah maksimum atau minimum, sesuai yang diminta soal? Apakah satuannya konsisten? Apakah menjawab yang ditanyakan, seperti ukuran atau bahan paling sedikit, dan bukan hanya nilai $x$? ## Bagaimana mengoptimalkan dengan kode? **Dalam kode, SymPy mengikuti empat langkah itu persis: turunkan, selesaikan $f'=0$, simpan akar yang ada di dalam domain, dan bandingkan dengan nilai atau limit di tiap ujung.** Tanpa CAS, pencarian tanpa turunan menemukan minimum fungsi yang turun lalu naik (fungsi unimodal): pencarian golden-section memperkecil selang di sekitar minimum dengan rasio yang sama setiap kali, dan bisection pada tanda $f'$ melakukan hal yang sama dengan turunannya. Pencarian yang hanya memakai nilai $f$ dapat menempatkan minimum hingga sekitar akar kuadrat ketelitian mesin, kira-kira $10^{-8}$, karena $f$ datar di sana; turunannya memberi jawaban yang lebih baik. ```python import sympy as sp x = sp.symbols('x', positive=True) def optimize(f, a, b, want='min'): """Best value of f on (a, b): the critical points inside, plus the value or limit at each end.""" rows = [(s, sp.simplify(f.subs(x, s))) for s in sp.solve(sp.diff(f, x), x) if s.is_real and a < s < b] rows += [(end, sp.limit(f, x, end)) for end in (a, b)] pick = min if want == 'min' else max return pick(rows, key=lambda row: float(row[1])), rows problems = ( ('box', x * (12 - 2 * x) ** 2, 0, 6, 'max'), # Example 1 ('can', 2 * sp.pi * x ** 2 + 2000 / x, 0, sp.oo, 'min'), # Example 2 ('poster', 20 * x + 3125 / x + sp.Rational(1025, 2), 0, sp.oo, 'min'), # Example 7 ('beam over a wall', (x + 5) * sp.sqrt(1 + 4 / x ** 2), 0, sp.oo, 'min'), # a 2 m wall, 5 m from a building ) for name, f, a, b, want in problems: (xb, fb), _ = optimize(f, a, b, want) print(name, xb, '->', sp.simplify(fb), '=', round(float(fb), 4)) # box 2 -> 128 = 128.0 # can 5*2**(2/3)/pi**(1/3) -> 300*2**(1/3)*pi**(1/3) = 553.581 # poster 25/2 -> 2025/2 = 1012.5 # beam over a wall 20**(1/3) -> sqrt(5)*(20**(1/3) + 5)**(3/2)/5 = 9.5823 ``` ```javascript // golden-section search: the smallest value of a function that falls and then rises on [a, b] const golden = (f, a, b, tol = 1e-9) => { const g = (Math.sqrt(5) - 1) / 2 let c = b - g * (b - a) let d = a + g * (b - a) while (b - a > tol) { if (f(c) < f(d)) b = d else a = c c = b - g * (b - a) d = a + g * (b - a) } return (a + b) / 2 } const can = (r) => 2 * Math.PI * r * r + 2000 / r // the one-liter can of Example 2 const r = golden(can, 0.1, 50) ;[r, 1000 / (Math.PI * r * r), can(r)].map((v) => +v.toFixed(4)) // [5.4193, 10.8385, 553.581] const beam = (x) => (x + 5) * Math.sqrt(1 + 4 / (x * x)) // the shortest beam over a wall const xb = golden(beam, 0.1, 50) ;[xb, beam(xb)].map((v) => +v.toFixed(4)) // [2.7144, 9.5823] // the same radius from the derivative: bisect on the sign of A'(r) = 4 pi r - 2000 / r^2 let lo = 0.1 let hi = 50 for (let i = 0; i < 60; i++) { const mid = (lo + hi) / 2 if (4 * Math.PI * mid - 2000 / (mid * mid) < 0) lo = mid else hi = mid } +lo.toFixed(6) // 5.419261 ``` ```cpp #include #include #include using namespace std; double area(double r) { return 2 * 3.14159265358979 * r * r + 2000 / r; // metal for a one-liter can } int main() { double lo = 0.1; double hi = 50; for (int i = 0; i < 100; i++) { // ternary search: the area falls and then rises double m1 = lo + (hi - lo) / 3; double m2 = hi - (hi - lo) / 3; if (area(m1) < area(m2)) hi = m2; else lo = m1; } double r = (lo + hi) / 2; double h = 1000 / (3.14159265358979 * r * r); printf("r=%.4f h=%.4f A=%.4f\n", r, h, area(r)); printf("h/r=%.4f\n", h / r); // the best closed can is as tall as it is wide return 0; } /* output: r=5.4193 h=10.8385 A=553.5810 h/r=2.0000 */ ``` ## Dari mana optimisasi berasal? **Soal optimisasi tertua bersifat geometri, dan cara kalkulus menyelesaikannya baru berumur sekitar empat abad.** - **Soal Dido, zaman kuno.** Legenda dalam Aeneid karya Virgil mengatakan bahwa Ratu Dido diizinkan memiliki tanah seluas yang dapat dikelilingi sehelai kulit sapi, dan ia memotong kulit itu menjadi tali tipis: bagaimana panjang tertentu harus mengelilingi luas terbesar? Jawabannya, lingkaran, termasuk soal optimisasi paling awal. - **Johannes Kepler, 1615.** Kepler mempelajari volume tong anggur dan memperhatikan bahwa di dekat volume terbesar perubahan kecil bentuk hampir tidak mengubah volume. Kedataran di puncak itu tepat apa yang dikatakan $f'=0$. - **Pierre de Fermat, sekitar 1629–1636.** Fermat menjelaskan metode untuk maksimum dan minimum: bandingkan $f(x)$ dengan $f(x+e)$, bagi dengan $e$, lalu jadikan $e$ nol. Tanpa nama itu, ini adalah turunan sama dengan nol. - **Snell dan Fermat, 1621 dan 1662.** Willebrord Snell menemukan hukum pembiasan sekitar 1621 tanpa menerbitkannya; Descartes mencetaknya pada 1637. Pada 1662 Fermat menunjukkan bahwa hukum itu mengikuti prinsip bahwa cahaya menempuh jalur dengan waktu paling singkat, salah satu hukum fisika pertama yang dinyatakan sebagai optimisasi. - **Harris dan Wilson, 1913 dan 1934.** Ford W. Harris menurunkan jumlah pesanan ekonomis pada 1913, dan R. H. Wilson mempopulerkannya pada 1934, itulah sebabnya hasil persediaan itu disebut rumus ukuran lot Wilson. - **Sekarang.** Menyamakan turunan dengan nol, dan versi banyak peubahnya dengan gradien, adalah inti pencocokan garis pada data dan pelatihan model pembelajaran mesin, tempat minimum dicari dengan pencarian yang bergerak menurun. ## Kesalahan apa yang sering terjadi pada soal optimisasi? **Kesalahan paling umum pada optimisasi terapan adalah sembilan hal berikut, masing-masing dengan pernyataan yang benar.** | Kesalahan | Yang benar | |---|---| | ❌ Menurunkan dengan dua peubah tersisa, seperti $A=2\pi r^2+2\pi rh$ | Pakai kendala $\pi r^2h=1000$ lebih dahulu: $A(r)=2\pi r^2+\frac{2000}{r}$, lalu turunkan. | | ❌ Melupakan domain | Keadaan soal menentukannya: $0\le x\le6$ untuk kotak. Titik kritis di luarnya, seperti $x=-10\sqrt2$ pada pengiriman, dibuang. | | ❌ Hanya menguji titik kritis | Ujung bisa menang: $x^3-3x$ pada $[-2,3]$ memiliki titik kritis $x=-1$ bernilai $2$, tetapi maksimumnya $18$ di $x=3$. | | ❌ Mengira titik kritis adalah maksimum | Golongkan: untuk kaleng, $A''(r)>0$ di mana-mana, sehingga ia minimum; dengan $A''<0$ ia akan menjadi maksimum. | | ❌ Menjawab dengan nilai $x$ | Jawab yang ditanyakan: volume terbesar adalah $V(2)=128$ cm³, dan potongannya $2$ cm. | | ❌ Mengoptimalkan besaran yang salah | Minimumkan luas permukaan kaleng, bukan volumenya, yang tetap. | | ❌ Mencampur satuan | Jaga cm dengan cm, jam dengan jam, dan ribu rupiah dengan ribu rupiah. | | ❌ Membulatkan optimum real | Jika $x$ harus bilangan bulat, bandingkan bilangan bulat di kedua sisinya: $14$ hari berbiaya $707{,}14$, $15$ hari $708{,}33$. | | ❌ Mengharapkan bentuk terindah | Lahan terbaik di tepi sungai berukuran $200$ kali $400$, bukan persegi, dan persegi panjang terbaik dalam setengah lingkaran dua kali lebih panjang daripada tingginya. | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: optimisasi terapan sekilas - **Empat langkah:** baca; perkenalkan peubah dan hubungan; tulis fungsi tujuan sebagai fungsi satu peubah beserta domainnya; uji titik kritis dan ujung. - **Domain:** dari keadaan soal; tertutup berarti bandingkan ujung, terbuka berarti limit di ujung atau tanda $f'$ dan $f''$. - **Geometri:** kaleng tertutup $h=2r$, kaleng tanpa tutup $h=r$, lahan di tepi sungai dua kali lebih panjang daripada lebarnya, persegi panjang dalam setengah lingkaran berjari-jari $R$ berluas $R^2$. - **Cahaya:** jalur tercepat memberi $\frac{\sin\theta_1}{c_1}=\frac{\sin\theta_2}{c_2}$; cermin memberi sudut yang sama. - **Ekonomi:** $r'(x)=c'(x)$ pada laba maksimum; siklus pengiriman $x=\sqrt{\frac{2K}{hd}}$; ukuran lot Wilson $q=\sqrt{\frac{2km}{h}}$. - **Bilangan bulat:** bandingkan dua bilangan bulat di sekitar optimum. - **Periksa:** satuan, domain, maksimum atau minimum, dan besaran yang ditanyakan. - **Kode:** SymPy `diff`, `solve`, `limit`, atau pencarian golden-section untuk fungsi yang turun lalu naik. ## Glosarium: istilah penting - **Fungsi tujuan**: Besaran yang akan dibuat terbesar atau terkecil, ditulis sebagai fungsi satu peubah. - **Kendala**: Hubungan di antara peubah, seperti volume tetap atau panjang kawat tetap, yang dipakai untuk menghilangkan semuanya kecuali satu. - **Domain**: Nilai peubah yang membuat keadaannya masuk akal, yang boleh tertutup atau terbuka. - **Titik kritis**: Titik di dalam domain tempat turunannya nol atau tidak ada. - **Biaya marjinal**: Turunan fungsi biaya, kira-kira biaya membuat satu barang lagi. - **Prinsip Fermat**: Cahaya bergerak antara dua titik menurut jalur yang memerlukan waktu paling singkat. - **Hukum Snell**: Hukum pembiasan: sinus sudut dari normal dibagi kecepatan sama di kedua sisi suatu batas. - **Ukuran lot Wilson**: Jumlah pesanan yang meminimumkan biaya rata-rata memesan dan menyimpan persediaan, akar dari dua kali biaya pesan kali permintaan dibagi biaya simpan. ## Pertanyaan yang sering diajukan ### Apa itu soal optimisasi dalam kalkulus? Itu adalah soal yang menanyakan nilai terbesar atau terkecil suatu besaran, seperti luas terbesar atau biaya terkecil. Kamu menulis besaran itu sebagai fungsi satu peubah, mencari domainnya, dan memakai turunan untuk mencari tempat ia terbesar atau terkecil. ### Apa langkah menyelesaikan soal optimisasi? Baca soal, perkenalkan peubah dan tulis hubungannya, nyatakan besaran itu sebagai fungsi satu peubah beserta domainnya, lalu uji titik kritis dan ujungnya. Terakhir, jawab dengan kata-kata soal, beserta satuannya. ### Mengapa ujung harus diperiksa? Pada domain tertutup nilai terbaik dapat berada di ujung, tempat turunan tidak harus nol. Hanya membandingkan titik kritis dengan ujung yang menjamin jawaban yang benar, seperti ditunjukkan fungsi x pangkat tiga dikurangi 3x pada selang minus 2 sampai 3. ### Bagaimana mengetahui titik kritis adalah maksimum atau minimum? Bandingkan dengan ujung pada domain tertutup. Pada domain terbuka pakai turunan kedua: positif di seluruh domain berarti minimum, negatif berarti maksimum. Kamu juga dapat memeriksa bahwa turunan pertama berganti tanda, atau melihat limit di ujungnya. ### Bentuk kaleng apa yang memakai logam paling sedikit? Untuk kaleng tabung tertutup dengan volume tertentu, tingginya sama dengan diameter, jadi h dua kali r. Tanpa tutup, tingginya sama dengan jari-jari. Hasilnya tidak bergantung pada volume, itulah sebabnya perbandingannya sama untuk setiap ukuran. ### Mengapa laba memuncak ketika pendapatan marjinal sama dengan biaya marjinal? Laba adalah pendapatan dikurangi biaya, sehingga turunannya adalah pendapatan marjinal dikurangi biaya marjinal. Di maksimum turunan itu nol, sehingga kedua marjinal sama. Sebelum titik itu satu barang lagi menambah pendapatan lebih besar daripada biaya, dan setelahnya lebih kecil. ### Apa itu ukuran lot Wilson atau jumlah pesanan ekonomis? Itu adalah ukuran pesanan yang meminimumkan biaya rata-rata memesan dan menyimpan persediaan. Nilainya sama dengan akar dari dua kali biaya pesan kali permintaan, dibagi biaya simpan per barang. Pada ukuran itu biaya memesan dan menyimpan sama besar. ### Bagaimana prinsip Fermat memberi hukum Snell? Tulis waktu sinar dari A ke B melalui suatu titik pada batas, dan setel turunannya terhadap titik itu sama dengan nol. Hasilnya menyatakan bahwa sinus sudut dibagi kecepatan sama di kedua sisi, yaitu hukum Snell. --- # Indeterminate Forms and L’Hôpital’s Rule Source: https://nunada.my.id/articles/indeterminate-forms-and-lhopitals-rule/ Updated: 2026-10-22 ## Quick answer **L'Hôpital's Rule says that if $\frac{f(x)}{g(x)}$ has the indeterminate form $\frac00$ or $\frac\infty\infty$ at $a$, then $\lim\frac{f(x)}{g(x)}=\lim\frac{f'(x)}{g'(x)}$, provided the second limit exists or is infinite.** Differentiate the numerator and the denominator separately, not the quotient, and repeat while the form stays indeterminate. Products, differences and powers are first rewritten as quotients, the powers through a logarithm. ### Key takeaways - An indeterminate form such as $\frac00$ describes a limit of a quotient whose numerator and denominator both go to $0$; it is not a number, and the limit can be anything: $\frac{x^3}x\to0$, $\frac x{x^3}\to\infty$, $\frac xx\to1$, $\frac{2x}x\to2$. - L'Hôpital's Rule: if $f$ and $g$ are differentiable near $a$, $g'\ne0$ there, and $\frac{f}{g}$ is $\frac00$ (or $\frac\infty\infty$) at $a$, then $\lim\frac fg=\lim\frac{f'}{g'}$ when the right side exists; it holds for one-sided limits and for $a=\pm\infty$. - Take $\frac{f'}{g'}$, not the derivative of $\frac fg$, and stop as soon as the quotient is no longer indeterminate: in $\lim_{x\to0}\frac{1-\cos x}{x+x^2}$ one round gives $\frac{\sin x}{1+2x}\to0$, and a second round would wrongly give $\frac12$. - The forms $0\cdot\infty$ and $\infty-\infty$ are turned into a quotient by algebra, and the powers $1^\infty$, $0^0$, $\infty^0$ by taking $\ln$: if $\ln y\to L$ then $y\to e^L$. - The rule can fail: the quotient may be determinate (no rule needed), it can cycle ($\frac{\sqrt{9x+1}}{\sqrt x+1}$), or $\frac{f'}{g'}$ may have no limit although $\frac fg$ does ($\frac{x+\sin x}x$). - The proof rests on Cauchy's Mean Value Theorem, $\frac{f(b)-f(a)}{g(b)-g(a)}=\frac{f'(c)}{g'(c)}$ for some $c$ in $(a,b)$, which is the Mean Value Theorem for two functions. ## What is an indeterminate form? **An indeterminate form is a way of summarizing the behavior of a limit when the behavior of the parts does not decide it.** Take the four limits $$\lim_{x\to0}\frac{x^3}{x}=0\qquad\lim_{x\to0}\frac{x}{x^3}=\infty\qquad\lim_{x\to0}\frac{x}{x}=1\qquad\lim_{x\to0}\frac{2x}{x}=2.$$ In each, the numerator and the denominator both approach $0$, yet the results are $0$, $\infty$, $1$ and $2$. We say a limit $$\lim_{x\to a}\frac{f(x)}{g(x)}\quad\text{with}\quad\lim_{x\to a}f(x)=0\ \text{and}\ \lim_{x\to a}g(x)=0$$ has the indeterminate form $\frac00$. The symbol "$\frac00$" looks like a number but is not one: it is not an instruction to divide $0$ by $0$, only a label for the limit of a ratio of two functions that each go to zero. Knowing that both go to zero is not enough to find the limit of the ratio; one has to look more closely, by algebra or by the rule of this article. If both the numerator and the denominator go to $+\infty$ or $-\infty$, the form is $\frac\infty\infty$. The other forms are $\infty\cdot0$, $\infty-\infty$, $1^\infty$, $0^0$ and $\infty^0$. Each is a label for a kind of limit whose value can come out in several ways: $x\ln x$ and $x\cdot\frac1{x}$ are both of the form $0\cdot\infty$ at $0^+$ and $\infty\cdot0$ at $\infty$, and they give $0$ and $1$. Some forms are not indeterminate. A numerator that goes to $1$ over a denominator that goes to $0$ is $\frac10$, which is infinite (or does not exist if the sign differs on the two sides); $\frac0\infty$ is $0$; $\infty+\infty$ is $\infty$; $0^\infty$ is $0$. Only the forms above leave the limit open. John (Johann) Bernoulli discovered a rule for using derivatives to calculate limits of fractions whose numerators and denominators both approach zero or $\pm\infty$. It is known as l'Hôpital's Rule after Guillaume de l'Hôpital, who wrote the first introductory differential calculus text, where the rule first appeared in print. ## What does L’Hôpital’s Rule say? **L'Hôpital's Rule: suppose $\lim_{x\to a}f(x)=\lim_{x\to a}g(x)=0$, that $f$ and $g$ are differentiable on an open interval $I$ containing $a$, and that $g'(x)\ne0$ on $I$ if $x\ne a$. Then** $$\lim_{x\to a}\frac{f(x)}{g(x)}=\lim_{x\to a}\frac{f'(x)}{g'(x)},$$ **assuming that the limit on the right side exists.** The theorem also applies if $x\to\pm\infty$ or when $f(x)$ and $g(x)$ go to $\pm\infty$ (the form $\frac\infty\infty$), and to one-sided limits; the number $a$ may be finite or infinite. The reason is that near $a$ a function is close to its tangent line, so the ratio of two functions that vanish at $a$ is the ratio of their slopes. Section 5 proves it. **Caution.** To apply the rule to $\frac fg$, divide the derivative of $f$ by the derivative of $g$. Do not take the derivative of the quotient: the quotient to use is $\frac{f'}{g'}$ and not $\left(\frac fg\right)'$. For $\frac{x^2-1}{x-1}$ at $1$ the right number is $\frac{2x}1\to2$, while the derivative of the quotient $x+1$ is $1$. **Using the rule.** To find $\lim\frac{f(x)}{g(x)}$, differentiate $f$ and $g$, and keep differentiating as long as the quotient still has the form $\frac00$ (or $\frac\infty\infty$). As soon as one of the two derivatives no longer goes to zero, stop. The rule does not apply when the numerator or the denominator has a finite limit that is not zero (or, in the first round, when the form is not indeterminate at all). **Example 1.** All of these are of the form $\frac00$, and some need the rule more than once. (a) $\lim_{x\to0}\frac{3x-\sin x}{x}=\lim_{x\to0}(3-\cos x)=2$. (b) $\lim_{x\to0}\frac{\sqrt{1+x}-1}{x}=\lim_{x\to0}\frac{\frac1{2\sqrt{1+x}}}{1}=\frac12$. (c) $\lim_{x\to0}\frac{\sqrt{1+x}-1-\frac x2}{x^2}=\lim_{x\to0}\frac{\frac1{2\sqrt{1+x}}-\frac12}{2x}$, which is $\frac00$ again, so $=\lim_{x\to0}\frac{-\frac14(1+x)^{-3/2}}{2}=-\frac18$. (d) $\lim_{x\to0}\frac{x-\sin x}{x^3}=\lim_{x\to0}\frac{1-\cos x}{3x^2}$ $=\lim_{x\to0}\frac{\sin x}{6x}=\lim_{x\to0}\frac{\cos x}{6}=\frac16$. **Example 2: a careful use.** $\lim_{x\to0}\frac{1-\cos x}{x+x^2}=\lim_{x\to0}\frac{\sin x}{1+2x}=\frac01=0$. It is tempting to apply the rule again to get $\lim\frac{\cos x}{2}=\frac12$, but that is wrong: $\frac{\sin x}{1+2x}$ is $\frac01$, not indeterminate, and its value is $0$. **Example 3: one-sided limits.** (a) $\lim_{x\to0^+}\frac{\sin x}{x^2}=\lim_{x\to0^+}\frac{\cos x}{2x}=+\infty$, since $\cos x\to1$ and $2x\to0^+$. (b) $\lim_{x\to0^-}\frac{\sin x}{x^2}=\lim_{x\to0^-}\frac{\cos x}{2x}=-\infty$, since $2x<0$. The one-sided limits differ, so the two-sided limit does not exist. Type a numerator, a denominator and a point below, or choose an example. The stepper applies the rule one round at a time, names the form at each step and stops when the quotient is no longer indeterminate. ## How does the rule handle ∞/∞, and which grows faster? **L'Hôpital's Rule applies to $\frac\infty\infty$ exactly as to $\frac00$: if $f(x)\to\pm\infty$ and $g(x)\to\pm\infty$ as $x\to a$, then $\lim\frac{f(x)}{g(x)}=\lim\frac{f'(x)}{g'(x)}$, provided the limit on the right exists or is $\pm\infty$.** Here $a$ may be finite or infinite, and $x\to a$ may be replaced by $x\to a^+$ or $x\to a^-$. The proof of this case is harder and is not given here; it is a 19th-century result. **Example 4.** Find the limits of these $\frac\infty\infty$ forms. (a) $\lim_{x\to\pi/2^-}\frac{\sec x}{1+\tan x}$. Both parts go to $+\infty$ from the left, so $=\lim\frac{\sec x\tan x}{\sec^2x}=\lim\sin x=1$ (a simplification, $\frac{\tan x}{\sec x}=\sin x$, is easier here than a second round). (b) $\lim_{x\to\infty}\frac{\ln x}{2\sqrt x}=\lim_{x\to\infty}\frac{1/x}{1/\sqrt x}$ $=\lim_{x\to\infty}\frac1{\sqrt x}=0$. (c) $\lim_{x\to\infty}\frac{e^x}{x^2}=\lim\frac{e^x}{2x}=\lim\frac{e^x}{2}=\infty$. The last two are the comparison of growth rates: a logarithm grows more slowly than any positive power of $x$, and an exponential grows faster than any power, so $\frac{\ln x}{x^p}\to0$ and $\frac{e^x}{x^p}\to\infty$ for every $p>0$. Many limits in later chapters are settled by this ordering: $\ln x\ll x^p\ll e^x$ as $x\to\infty$. **Leading terms.** For a ratio of polynomials the rule gives the familiar answer: $\lim_{x\to\infty}\frac{5x^2-3x}{7x^2+1}=\lim\frac{10x-3}{14x}=\lim\frac{10}{14}=\frac57$, the ratio of the leading coefficients. ## How do you handle 0·∞ and ∞−∞? **The forms $\infty\cdot0$ and $\infty-\infty$ are not quotients, so first algebra turns them into $\frac00$ or $\frac\infty\infty$, and then the rule applies.** Neither $\infty\cdot0$ nor $\infty-\infty$ is a number; they only describe what the parts do. **Example 5: a product.** (a) $\lim_{x\to\infty}x\sin\frac1x$ is of the form $\infty\cdot0$. Write it as $\lim_{x\to\infty}\frac{\sin(1/x)}{1/x}$, a $\frac00$ form, and apply the rule: $=\lim_{x\to\infty}\frac{\cos(1/x)\cdot(-1/x^2)}{-1/x^2}$ $=\lim_{x\to\infty}\cos\frac1x=1$. (b) $\lim_{x\to0^+}x\ln x$ is of the form $0\cdot\infty$. Write it as $\lim_{x\to0^+}\frac{\ln x}{1/x}$, an $\frac\infty\infty$ form, and apply the rule: $=\lim_{x\to0^+}\frac{1/x}{-1/x^2}=\lim_{x\to0^+}(-x)=0$. The choice of which factor goes in the denominator matters: $x\ln x=\frac{x}{1/\ln x}$ would lead to a worse quotient. Put in the denominator the factor whose reciprocal is simpler to differentiate. **Example 6: a difference.** Find $\lim_{x\to0}\left(\frac1x-\frac1{\sin x}\right)$. As $x\to0^+$, $\frac1x\to\infty$ and $\frac1{\sin x}\to\infty$, so the form is $\infty-\infty$; as $x\to0^-$ it is $-\infty-(-\infty)$. Neither shows the limit. Combine the fractions over a common denominator, $$\frac1x-\frac1{\sin x}=\frac{\sin x-x}{x\sin x},$$ which is of the form $\frac00$, and apply the rule twice: $$\lim_{x\to0}\frac{\sin x-x}{x\sin x}=\lim_{x\to0}\frac{\cos x-1}{\sin x+x\cos x}=\lim_{x\to0}\frac{-\sin x}{2\cos x-x\sin x}=\frac02=0.$$ Another difference: $\lim_{x\to1^+}\left(\frac1{\ln x}-\frac1{x-1}\right)=\lim\frac{x-1-\ln x}{(x-1)\ln x}=\frac12$, again a combined fraction of the form $\frac00$ and two rounds. ## How do you handle 1^∞, 0^0 and ∞^0? **Limits that lead to $1^\infty$, $0^0$ and $\infty^0$ are handled by first taking the logarithm of the function, the idea of [logarithmic differentiation](https://nunada.my.id/articles/derivatives-of-inverse-functions-and-logarithms/#logarithmic-differentiation): find the limit $L$ of $\ln f(x)$ with the rule, then exponentiate.** If $\lim_{x\to a}\ln f(x)=L$, then $$\lim_{x\to a}f(x)=\lim_{x\to a}e^{\ln f(x)}=e^L,$$ by the continuity of the exponential function. The formula is valid for one-sided limits and for $a=\pm\infty$. If $f(x)=u(x)^{v(x)}$ then $\ln f=v\ln u$, a product, which the previous section turns into the quotient $\frac{\ln u}{1/v}$. **Example 7.** Show that $\lim_{x\to0^+}(1+x)^{1/x}=e$. The limit has the form $1^\infty$. Let $f(x)=(1+x)^{1/x}$, so $\ln f(x)=\frac{\ln(1+x)}{x}$, a $\frac00$ form. By the rule $$\lim_{x\to0^+}\ln f(x)=\lim_{x\to0^+}\frac{\ln(1+x)}{x}=\lim_{x\to0^+}\frac{1/(1+x)}{1}=1.$$ Therefore $\lim_{x\to0^+}(1+x)^{1/x}=e^1=e$. This is the number $e$ from the definition of the exponential, and it is the same as $\lim_{x\to\infty}\left(1+\frac1x\right)^x=e$. **Example 8.** Find $\lim_{x\to\infty}x^{1/x}$. The form is $\infty^0$. With $f(x)=x^{1/x}$, $\ln f(x)=\frac{\ln x}{x}$, an $\frac\infty\infty$ form, and $\lim_{x\to\infty}\frac{\ln x}{x}=\lim\frac{1/x}{1}=0$. So $\lim_{x\to\infty}x^{1/x}=e^0=1$. **Other examples.** $\lim_{x\to0^+}x^x$ has the form $0^0$: $\ln x^x=x\ln x\to0$ by Example 5(b), so $x^x\to e^0=1$. And $\lim_{x\to1^+}x^{1/(x-1)}$ is $1^\infty$: $\frac{\ln x}{x-1}\to1$, so the limit is $e$. In general $\lim_{x\to\infty}\left(1+\frac px\right)^x=e^p$. The stepper below takes the form, shows the rewriting and runs the rule for every kind of indeterminate form: $0\cdot\infty$, $\infty-\infty$ and the powers. ## When does L’Hôpital’s Rule not help? **The rule is a tool with conditions, and three things can go wrong: the quotient is not indeterminate, the rule cycles, or the quotient of derivatives has no limit.** **1. Not an indeterminate form.** If the numerator has a finite limit that is not zero, or the quotient is already determinate, the rule must not be used. $\lim_{x\to2}\frac{x^2+1}{x+1}=\frac53$ by substitution; differentiating would give $\frac{2x}1\to4$, which is wrong. The same happens in the middle of a calculation, as in Example 2, once the quotient has stopped being $\frac00$. **2. The rule cycles.** For $\lim_{x\to\infty}\frac{\sqrt{9x+1}}{\sqrt x+1}$ the quotient of derivatives is $\frac{9\sqrt x}{\sqrt{9x+1}}$, again of the form $\frac\infty\infty$, and the next round brings back a quotient of the same kind: you just keep cycling. Algebra settles it: divide numerator and denominator by $\sqrt x$ to get $\frac{\sqrt{9+1/x}}{1+1/\sqrt x}\to3$. Similarly $\frac{\sqrt{x^2+1}}{x}$ cycles between a quotient and its reciprocal, and the answer is $1$. **3. The derivatives have no limit.** The theorem says the limit of $\frac fg$ equals the limit of $\frac{f'}{g'}$ if the latter exists. For $\lim_{x\to\infty}\frac{x+\sin x}{x}$ the quotient of derivatives is $1+\cos x$, which has no limit, so the rule says nothing, and yet the original limit exists: $\frac{x+\sin x}{x}=1+\frac{\sin x}{x}\to1$. In the same way $\lim_{x\to0^+}\frac{x^2\sin(1/x)}{\sin x}$ has derivatives with $\cos(1/x)$, which oscillates, while $x\sin\frac1x\cdot\frac{x}{\sin x}\to0$. **One-sided limits that differ.** Example 3: $\frac{\sin x}{x^2}$ goes to $+\infty$ from the right and $-\infty$ from the left; the two-sided limit does not exist, and the rule gives the one-sided values correctly. In all these cases a limit read directly, or a little algebra such as dividing by the dominant term, does what the rule cannot. Try them below: the stepper reports the status, and for a cycle or a missing limit it also reads the original quotient directly. ## Why is L’Hôpital’s Rule true? **The rule comes from Cauchy's Mean Value Theorem, an extension of the [Mean Value Theorem](https://nunada.my.id/articles/the-mean-value-theorem/#mean-value-theorem) to two functions.** A picture first. Take $f$ and $g$ with continuous derivatives, $f(a)=g(a)=0$ and $g'(a)\ne0$. Near $a$ they are close to their [linearizations](https://nunada.my.id/articles/linearization-and-differentials/#linearization), $f(x)=f'(a)(x-a)+\varepsilon_1(x-a)$ and $g(x)=g'(a)(x-a)+\varepsilon_2(x-a)$, with $\varepsilon_1,\varepsilon_2\to0$ as $x\to a$. Then $$\frac{f(x)}{g(x)}=\frac{f'(a)+\varepsilon_1}{g'(a)+\varepsilon_2}\to\frac{f'(a)}{g'(a)}=\lim_{x\to a}\frac{f'(x)}{g'(x)}.$$ The ratio of two functions that vanish at $a$ is the ratio of their slopes there. The proof below needs neither $g'(a)\ne0$ nor continuous derivatives. **Cauchy's Mean Value Theorem.** Suppose $f$ and $g$ are continuous on $[a,b]$ and differentiable on $(a,b)$, and $g'(x)\ne0$ throughout $(a,b)$. Then there is a number $c$ in $(a,b)$ with $$\frac{f'(c)}{g'(c)}=\frac{f(b)-f(a)}{g(b)-g(a)}.$$ When $g(x)=x$ this is the Mean Value Theorem. Proof. First, $g(a)\ne g(b)$: otherwise the Mean Value Theorem would give $g'(c)=\frac{g(b)-g(a)}{b-a}=0$ for some $c$, which is excluded. Then apply the Mean Value Theorem to $$F(x)=f(x)-f(a)-\frac{f(b)-f(a)}{g(b)-g(a)}\,\big(g(x)-g(a)\big).$$ $F$ is continuous on $[a,b]$ and differentiable on $(a,b)$, and $F(a)=F(b)=0$. By [Rolle's Theorem](https://nunada.my.id/articles/the-mean-value-theorem/#rolle) there is $c$ with $F'(c)=0$, that is $$f'(c)-\frac{f(b)-f(a)}{g(b)-g(a)}\,g'(c)=0,$$ which rearranges to the claim. ∎ Geometrically, the curve $(g(t),f(t))$ has a tangent parallel to the secant through its ends, and the slope of that tangent is $\frac{f'}{g'}$. Draw a curve below and see the tangents. Proof of l'Hôpital's Rule (the case $x\to a^+$, form $\frac00$). Since $f(x)\to0$ and $g(x)\to0$ and both are differentiable at $a$, they are continuous there and $f(a)=g(a)=0$. For $x$ to the right of $a$ apply Cauchy's theorem on $[a,x]$: there is $c$ between $a$ and $x$ with $$\frac{f'(c)}{g'(c)}=\frac{f(x)-f(a)}{g(x)-g(a)}=\frac{f(x)}{g(x)}.$$ As $x\to a^+$, $c$ is squeezed between $a$ and $x$, so $c\to a^+$, and therefore $$\lim_{x\to a^+}\frac{f(x)}{g(x)}=\lim_{c\to a^+}\frac{f'(c)}{g'(c)}=\lim_{x\to a^+}\frac{f'(x)}{g'(x)}.$$ The case $x\to a^-$ is the same on $[x,a]$, and the two together give the two-sided rule. ∎ ## How do you compute these limits in code? **In code, SymPy's `sp.limit(expr, x, a, '+')` finds limits exactly, and a few lines of `sp.diff` reproduce the rule round by round.** Without a CAS, a table of the quotient at shrinking distances shows the limit, and the table of $\frac{f'}{g'}$ next to it converges to the same number, which is the content of the rule. Numerical evaluation near a point has a trap that the rule does not: for $(1+h)^{1/h}$ the computer rounds $1+h$ to $1$ once $h$ is below about $10^{-16}$ and returns $1$ instead of $e$, so a table must stop at moderate $h$. ```python import sympy as sp x = sp.symbols('x') def lhopital(f, g, a, direction='+-', rounds=6): """Apply l'Hopital's Rule while the quotient is 0/0 or oo/oo; return the quotient at each round and the limit.""" steps = [] for _ in range(rounds): lf, lg = sp.limit(f, x, a, direction), sp.limit(g, x, a, direction) indeterminate = (lf == 0 and lg == 0) or (lf in (sp.oo, -sp.oo) and lg in (sp.oo, -sp.oo)) steps.append((sp.simplify(f / g), 'rule' if indeterminate else 'stop')) if not indeterminate: break f, g = sp.diff(f, x), sp.diff(g, x) return steps, sp.limit(f / g, x, a, direction) examples = ( (3 * x - sp.sin(x), x, 0), # Example 1a (x - sp.sin(x), x**3, 0), # Example 1d: three rounds (1 - sp.cos(x), x + x**2, 0), # Example 2: one round, then stop (sp.exp(x), x**2, sp.oo), # Example 4c (sp.sin(x) - x, x * sp.sin(x), 0), # Example 6: 1/x - 1/sin x as one fraction ) for f, g, a in examples: print(f, '/', g, 'at', a, '->', lhopital(f, g, a)) print(sp.limit((1 + x) ** (1 / x), x, 0, '+'), sp.limit(x ** (1 / x), x, sp.oo), sp.limit(x ** x, x, 0, '+')) # 3*x - sin(x) / x at 0 -> ([(3 - sin(x)/x, 'rule'), (3 - cos(x), 'stop')], 2) # x - sin(x) / x**3 at 0 -> ([((x - sin(x))/x**3, 'rule'), ((1 - cos(x))/(3*x**2), 'rule'), (sin(x)/(6*x), 'rule'), (cos(x)/6, 'stop')], 1/6) # 1 - cos(x) / x**2 + x at 0 -> ([((1 - cos(x))/(x*(x + 1)), 'rule'), (sin(x)/(2*x + 1), 'stop')], 0) # exp(x) / x**2 at oo -> ([(exp(x)/x**2, 'rule'), (exp(x)/(2*x), 'rule'), (exp(x)/2, 'stop')], oo) # -x + sin(x) / x*sin(x) at 0 -> ([((-x/sin(x) + 1)/x, 'rule'), ((cos(x) - 1)/(x*cos(x) + sin(x)), 'rule'), (sin(x)/(x*sin(x) - 2*cos(x)), 'stop')], 0) # E 1 1 ``` ```javascript // the quotient f/g at shrinking distances from a: f/g and f'/g' (and the rounds after it) tend to the same number const near = (f, g, a, hs = [0.1, 0.01, 0.001]) => hs.map((h) => +(f(a + h) / g(a + h)).toFixed(5)) const f = (x) => x - Math.sin(x) const g = (x) => x ** 3 // Example 1d, whose limit is 1/6 near(f, g, 0) // [0.16658, 0.16667, 0.16667] f/g near((x) => 1 - Math.cos(x), (x) => 3 * x * x, 0) // [0.16653, 0.16667, 0.16667] f'/g' near((x) => Math.sin(x), (x) => 6 * x, 0) // [0.16639, 0.16666, 0.16667] f''/g'' near((x) => Math.cos(x), () => 6, 0) // [0.16583, 0.16666, 0.16667] f'''/g''': no longer 0/0 // a power limit, and the trap of rounding: (1 + h)^(1/h) tends to e, until 1 + h is rounded to 1 ;[1e-2, 1e-4, 1e-6].map((h) => (1 + h) ** (1 / h)) // [2.7048138294215285, 2.7181459268249255, 2.7182804690957534] ;(1 + 1e-17) ** (1 / 1e-17) // 1: 1 + 1e-17 is 1 in floating point ;[1e-2, 1e-4, 1e-8].map((h) => h * Math.log(h)) // [-0.046, -0.00092, -1.84e-7]: x ln x -> 0 ``` ```cpp #include #include #include using namespace std; int main() { double hs[3]; hs[0] = 0.1; hs[1] = 0.01; hs[2] = 0.001; for (int i = 0; i < 3; i++) { // Example 1d: (x - sin x) / x^3, limit 1/6 double h = hs[i]; double q0 = (h - sin(h)) / (h * h * h); // f / g double q1 = (1 - cos(h)) / (3 * h * h); // f' / g' double q2 = sin(h) / (6 * h); // f'' / g'' double q3 = cos(h) / 6; // f''' / g''', no longer 0/0 printf("h=%.3f %.5f %.5f %.5f %.5f\n", h, q0, q1, q2, q3); } printf("%.5f\n", 1.0 / 6); printf("%.5f %.5f\n", pow(1.01, 100.0), pow(1.0001, 10000.0)); // (1 + h)^(1/h) tends to e = 2.71828 return 0; } /* output: h=0.100 0.16658 0.16653 0.16639 0.16583 h=0.010 0.16667 0.16667 0.16666 0.16666 h=0.001 0.16667 0.16667 0.16667 0.16667 0.16667 2.70481 2.71815 */ ``` ## Who discovered L’Hôpital’s Rule? **The rule carries the name of the man who published it, not of the man who found it.** - **Johann Bernoulli, 1691–92.** The Swiss mathematician Johann Bernoulli, a young pupil of the new calculus of Leibniz, taught it in Paris to the French nobleman Guillaume de l'Hôpital, and in the lessons he gave the way of finding the value of a fraction whose numerator and denominator both vanish. - **l'Hôpital, 1696.** In his Analyse des infiniment petits pour l'intelligence des lignes courbes, the first textbook of the differential calculus, l'Hôpital printed the rule, saying that he owed much to Bernoulli and Leibniz. Under an agreement l'Hôpital paid Bernoulli for his discoveries and was free to use them. - **A manuscript, 1921.** Bernoulli's own lecture notes on the differential calculus were found in the 1920s, and they show that the rule, and much else in the textbook, is Bernoulli's. The name stayed. - **Cauchy, 1823.** Augustin-Louis Cauchy gave the general statement and the proof through the mean value theorem for two functions, which carries his name. The original rule dealt with the quotient of two expressions that vanish at a point; repeated use, one-sided limits and the form $\frac\infty\infty$ were settled in the 19th century. - **Today.** The rule is the first tool for indeterminate limits and the way that limits such as $\frac{\sin x}x$ and $\frac{\ln x}{x}$ are taught; computer algebra systems compute them with series, which is faster. ## What mistakes do people make with L’Hôpital’s Rule? **The most common mistakes with indeterminate forms and l'Hôpital's Rule are the nine below, each with the correct statement.** | Mistake | Correct | |---|---| | ❌ Take the derivative of the quotient $\left(\frac fg\right)'$ | Divide the derivatives: $\frac{f'}{g'}$. For $\frac{x^2-1}{x-1}$ at $1$ the limit is $\frac{2x}{1}\to2$, while $\left(x+1\right)'=1$. | | ❌ Use the rule on any limit | Only on $\frac00$ and $\frac\infty\infty$: $\lim_{x\to2}\frac{x^2+1}{x+1}=\frac53$, and $\frac{2x}1\to4$ is wrong. | | ❌ Keep differentiating after the form is gone | $\frac{1-\cos x}{x+x^2}\to\frac{\sin x}{1+2x}\to0$; one more round gives the wrong $\frac12$. | | ❌ $\frac00$ is $1$, or $0$ | $\frac xx\to1$, $\frac{x^3}{x}\to0$, $\frac{x}{x^3}\to\infty$, $\frac{2x}{x}\to2$: the label decides nothing. | | ❌ If $\frac{f'}{g'}$ has no limit, neither has $\frac fg$ | $\frac{x+\sin x}x\to1$ although $1+\cos x$ has no limit. | | ❌ $0\cdot\infty=0$ | $x\ln x\to0$, but $x\cdot\frac1x=1$ and $x\cdot\frac1{x^2}\to\infty$: rewrite as a quotient. | | ❌ $1^\infty=1$ | $(1+x)^{1/x}\to e$: take the logarithm and use $e^L$. | | ❌ $\infty-\infty=0$ | $x^2-x\to\infty$ and $x-x=0$: combine into one fraction first. | | ❌ The one-sided result is the two-sided one | $\frac{\sin x}{x^2}\to+\infty$ from the right and $-\infty$ from the left: no two-sided limit. | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: L’Hôpital’s Rule at a glance - **Indeterminate forms:** $\frac00$, $\frac\infty\infty$, $0\cdot\infty$, $\infty-\infty$, $1^\infty$, $0^0$, $\infty^0$ describe limits that the parts do not decide. - **The rule:** $\frac00$ or $\frac\infty\infty$ at $a$ gives $\lim\frac fg=\lim\frac{f'}{g'}$ if the right side exists or is $\pm\infty$; also for one-sided limits and $a=\pm\infty$. - **How:** differentiate $f$ and $g$ separately, repeat while the form stays indeterminate, stop at the first quotient that is not. - **Other forms:** products and differences become a quotient by algebra; powers by $\ln$, then $e^L$. - **Growth:** $\ln x\ll x^p\ll e^x$ as $x\to\infty$. - **When it fails:** a determinate quotient, a cycle ($\sqrt{9x+1}/(\sqrt x+1)$), or $\frac{f'}{g'}$ without a limit ($(x+\sin x)/x$). - **Proof:** Cauchy's Mean Value Theorem, $\frac{f'(c)}{g'(c)}=\frac{f(b)-f(a)}{g(b)-g(a)}$, then squeeze $c$ between $a$ and $x$. - **Next:** applied optimization, the closed interval method put to work on real problems. - **Code:** `sp.limit(expr, x, a, '+')`, `sp.diff` for the rounds, and tables at moderate distances. ## Glossary: key terms - **Indeterminate form**: A label for a limit, such as zero over zero, whose value is not decided by the limits of its parts and can come out as any number or infinity. - **L’Hôpital’s Rule**: The rule that the limit of a quotient of the form zero over zero or infinity over infinity equals the limit of the quotient of the derivatives, if that limit exists. - **Cauchy’s Mean Value Theorem**: The Mean Value Theorem for two functions: for some point c, the ratio of the derivatives equals the ratio of the changes of the functions over the interval. - **Indeterminate power**: A limit of the form one to the infinity, zero to the zero or infinity to the zero, found by taking the logarithm of the function and exponentiating the limit. - **One-sided limit**: The limit as x approaches a from only the right or only the left; the two-sided limit exists only if both are equal. - **Growth rate**: How fast a function grows as x goes to infinity; a logarithm grows slower than any power, and an exponential faster than any power. ## Frequently asked questions ### What is L’Hôpital’s Rule? It is a rule for limits of quotients. If the numerator and the denominator both go to zero, or both go to infinity, the limit of the quotient equals the limit of the quotient of their derivatives, provided that second limit exists or is infinite. ### What is an indeterminate form? It is a label such as zero over zero or infinity over infinity for a limit whose value the limits of the parts do not decide. Different limits with the same label give different results, so the label itself is not a number. ### Do you use the quotient rule in L’Hôpital’s Rule? No. You differentiate the numerator and the denominator separately and then divide, which gives f prime over g prime. Taking the derivative of the whole quotient is a common mistake and gives a different, wrong number. ### When should you stop applying L’Hôpital’s Rule? Stop as soon as the quotient is no longer of the form zero over zero or infinity over infinity. Then the limit can be read directly. Applying the rule once more to a quotient that is not indeterminate gives a wrong answer. ### How do you handle the form zero times infinity? Rewrite the product as a quotient by moving one factor to the denominator as its reciprocal, for example x times the logarithm of x as the logarithm of x over one over x. That is infinity over infinity, and the rule applies. ### How do you find a limit of the form one to the infinity? Take the natural logarithm of the function, which turns the power into a product and then into a quotient. Find the limit L with the rule, and the original limit is e to the power L. For example, one plus x to the 1 over x tends to e. ### When does L’Hôpital’s Rule fail? When the quotient is not indeterminate, when repeated use cycles through the same kind of quotient, or when the quotient of derivatives has no limit although the original does, as for x plus sine x over x at infinity. ### How is L’Hôpital’s Rule proved? With Cauchy’s Mean Value Theorem, which says that for two functions there is a point where the ratio of the derivatives equals the ratio of the changes. Applied between a and x, that point is squeezed toward a as x approaches a. ### Who discovered L’Hôpital’s Rule? Johann Bernoulli found it and taught it to Guillaume de l’Hôpital, who printed it in 1696 in the first textbook of the differential calculus. It is named after the author of the book, and Bernoulli’s own notes confirm it was his. --- # Bentuk Tak Tentu dan Aturan L’Hôpital Source: https://nunada.my.id/artikel/bentuk-tak-tentu-dan-aturan-lhopital/ Updated: 2026-10-22 ## Jawaban singkat **Aturan L'Hôpital menyatakan bahwa jika $\frac{f(x)}{g(x)}$ berbentuk tak tentu $\frac00$ atau $\frac\infty\infty$ di $a$, maka $\lim\frac{f(x)}{g(x)}=\lim\frac{f'(x)}{g'(x)}$, asalkan limit kedua ada atau tak hingga.** Turunkan pembilang dan penyebut secara terpisah, bukan hasil baginya, dan ulangi selama bentuknya tetap tak tentu. Hasil kali, selisih, dan pangkat lebih dahulu ditulis ulang sebagai hasil bagi, pangkat lewat logaritma. ### Poin penting - Bentuk tak tentu seperti $\frac00$ menggambarkan limit hasil bagi yang pembilang dan penyebutnya sama-sama menuju $0$; ia bukan bilangan, dan limitnya bisa apa saja: $\frac{x^3}x\to0$, $\frac x{x^3}\to\infty$, $\frac xx\to1$, $\frac{2x}x\to2$. - Aturan L'Hôpital: jika $f$ dan $g$ terdiferensialkan di dekat $a$, $g'\ne0$ di sana, dan $\frac{f}{g}$ berbentuk $\frac00$ (atau $\frac\infty\infty$) di $a$, maka $\lim\frac fg=\lim\frac{f'}{g'}$ bila ruas kanan ada; berlaku untuk limit satu sisi dan untuk $a=\pm\infty$. - Pakai $\frac{f'}{g'}$, bukan turunan $\frac fg$, dan berhenti begitu hasil bagi tidak lagi tak tentu: pada $\lim_{x\to0}\frac{1-\cos x}{x+x^2}$ satu putaran memberi $\frac{\sin x}{1+2x}\to0$, dan putaran kedua akan keliru memberi $\frac12$. - Bentuk $0\cdot\infty$ dan $\infty-\infty$ diubah menjadi hasil bagi dengan aljabar, dan pangkat $1^\infty$, $0^0$, $\infty^0$ dengan mengambil $\ln$: jika $\ln y\to L$ maka $y\to e^L$. - Aturan ini bisa gagal: hasil bagi bisa sudah tentu (tidak perlu aturan), bisa berputar ($\frac{\sqrt{9x+1}}{\sqrt x+1}$), atau $\frac{f'}{g'}$ bisa tidak punya limit padahal $\frac fg$ punya ($\frac{x+\sin x}x$). - Buktinya bertumpu pada Teorema Nilai Rata-rata Cauchy, $\frac{f(b)-f(a)}{g(b)-g(a)}=\frac{f'(c)}{g'(c)}$ untuk suatu $c$ di $(a,b)$, yaitu Teorema Nilai Rata-rata untuk dua fungsi. ## Apa itu bentuk tak tentu? **Bentuk tak tentu adalah cara meringkas perilaku suatu limit ketika perilaku bagian-bagiannya tidak menentukannya.** Ambil empat limit $$\lim_{x\to0}\frac{x^3}{x}=0\qquad\lim_{x\to0}\frac{x}{x^3}=\infty\qquad\lim_{x\to0}\frac{x}{x}=1\qquad\lim_{x\to0}\frac{2x}{x}=2.$$ Pada masing-masing, pembilang dan penyebut sama-sama mendekati $0$, namun hasilnya $0$, $\infty$, $1$, dan $2$. Kita katakan limit $$\lim_{x\to a}\frac{f(x)}{g(x)}\quad\text{dengan}\quad\lim_{x\to a}f(x)=0\ \text{dan}\ \lim_{x\to a}g(x)=0$$ berbentuk tak tentu $\frac00$. Lambang "$\frac00$" tampak seperti bilangan tetapi bukan: ia bukan perintah membagi $0$ dengan $0$, hanya label untuk limit hasil bagi dua fungsi yang masing-masing menuju nol. Mengetahui bahwa keduanya menuju nol belum cukup untuk mencari limit hasil baginya; kita harus melihat lebih dekat, dengan aljabar atau dengan aturan di artikel ini. Jika pembilang dan penyebut sama-sama menuju $+\infty$ atau $-\infty$, bentuknya $\frac\infty\infty$. Bentuk lainnya $\infty\cdot0$, $\infty-\infty$, $1^\infty$, $0^0$, dan $\infty^0$. Masing-masing adalah label untuk jenis limit yang nilainya dapat muncul dengan beberapa cara: $x\ln x$ dan $x\cdot\frac1{x}$ keduanya berbentuk $0\cdot\infty$ di $0^+$ dan $\infty\cdot0$ di $\infty$, dan memberi $0$ dan $1$. Beberapa bentuk bukan tak tentu. Pembilang yang menuju $1$ di atas penyebut yang menuju $0$ adalah $\frac10$, yang tak hingga (atau tidak ada jika tandanya berbeda di kedua sisi); $\frac0\infty$ adalah $0$; $\infty+\infty$ adalah $\infty$; $0^\infty$ adalah $0$. Hanya bentuk di atas yang membiarkan limitnya terbuka. John (Johann) Bernoulli menemukan aturan memakai turunan untuk menghitung limit pecahan yang pembilang dan penyebutnya sama-sama mendekati nol atau $\pm\infty$. Aturan itu dikenal sebagai Aturan l'Hôpital menurut Guillaume de l'Hôpital, yang menulis buku teks kalkulus diferensial pengantar pertama, tempat aturan itu pertama kali dicetak. ## Apa isi Aturan L’Hôpital? **Aturan L'Hôpital: misalkan $\lim_{x\to a}f(x)=\lim_{x\to a}g(x)=0$, $f$ dan $g$ terdiferensialkan pada selang terbuka $I$ yang memuat $a$, dan $g'(x)\ne0$ pada $I$ jika $x\ne a$. Maka** $$\lim_{x\to a}\frac{f(x)}{g(x)}=\lim_{x\to a}\frac{f'(x)}{g'(x)},$$ **dengan anggapan limit di ruas kanan ada.** Teorema ini juga berlaku jika $x\to\pm\infty$ atau ketika $f(x)$ dan $g(x)$ menuju $\pm\infty$ (bentuk $\frac\infty\infty$), dan untuk limit satu sisi; bilangan $a$ boleh terhingga atau tak hingga. Alasannya, di dekat $a$ fungsi mendekati garis singgungnya, sehingga hasil bagi dua fungsi yang lenyap di $a$ adalah hasil bagi gradiennya. Bagian 5 membuktikannya. **Peringatan.** Untuk menerapkan aturan pada $\frac fg$, bagi turunan $f$ dengan turunan $g$. Jangan menurunkan hasil baginya: hasil bagi yang dipakai adalah $\frac{f'}{g'}$ dan bukan $\left(\frac fg\right)'$. Untuk $\frac{x^2-1}{x-1}$ di $1$ bilangan yang benar adalah $\frac{2x}1\to2$, sedangkan turunan hasil bagi $x+1$ adalah $1$. **Memakai aturan.** Untuk mencari $\lim\frac{f(x)}{g(x)}$, turunkan $f$ dan $g$, dan teruslah menurunkan selama hasil bagi masih berbentuk $\frac00$ (atau $\frac\infty\infty$). Begitu salah satu dari kedua turunan tidak lagi menuju nol, berhenti. Aturan tidak berlaku ketika pembilang atau penyebut memiliki limit terhingga yang bukan nol (atau, pada putaran pertama, ketika bentuknya sama sekali bukan tak tentu). **Contoh 1.** Semuanya berbentuk $\frac00$, dan beberapa memerlukan aturan lebih dari sekali. (a) $\lim_{x\to0}\frac{3x-\sin x}{x}=\lim_{x\to0}(3-\cos x)=2$. (b) $\lim_{x\to0}\frac{\sqrt{1+x}-1}{x}=\lim_{x\to0}\frac{\frac1{2\sqrt{1+x}}}{1}=\frac12$. (c) $\lim_{x\to0}\frac{\sqrt{1+x}-1-\frac x2}{x^2}=\lim_{x\to0}\frac{\frac1{2\sqrt{1+x}}-\frac12}{2x}$, yang berbentuk $\frac00$ lagi, sehingga $=\lim_{x\to0}\frac{-\frac14(1+x)^{-3/2}}{2}=-\frac18$. (d) $\lim_{x\to0}\frac{x-\sin x}{x^3}=\lim_{x\to0}\frac{1-\cos x}{3x^2}$ $=\lim_{x\to0}\frac{\sin x}{6x}=\lim_{x\to0}\frac{\cos x}{6}=\frac16$. **Contoh 2: pemakaian yang cermat.** $\lim_{x\to0}\frac{1-\cos x}{x+x^2}=\lim_{x\to0}\frac{\sin x}{1+2x}=\frac01=0$. Menggoda untuk menerapkan aturan lagi dan mendapat $\lim\frac{\cos x}{2}=\frac12$, tetapi itu salah: $\frac{\sin x}{1+2x}$ berbentuk $\frac01$, bukan tak tentu, dan nilainya $0$. **Contoh 3: limit satu sisi.** (a) $\lim_{x\to0^+}\frac{\sin x}{x^2}=\lim_{x\to0^+}\frac{\cos x}{2x}=+\infty$, karena $\cos x\to1$ dan $2x\to0^+$. (b) $\lim_{x\to0^-}\frac{\sin x}{x^2}=\lim_{x\to0^-}\frac{\cos x}{2x}=-\infty$, karena $2x<0$. Limit satu sisinya berbeda, sehingga limit dua sisinya tidak ada. Ketik pembilang, penyebut, dan titik di bawah, atau pilih contoh. Alat ini menerapkan aturan satu putaran demi satu putaran, menyebut bentuk di tiap langkah, dan berhenti ketika hasil bagi tidak lagi tak tentu. ## Bagaimana aturan menangani ∞/∞, dan mana yang tumbuh lebih cepat? **Aturan L'Hôpital berlaku untuk $\frac\infty\infty$ persis seperti untuk $\frac00$: jika $f(x)\to\pm\infty$ dan $g(x)\to\pm\infty$ ketika $x\to a$, maka $\lim\frac{f(x)}{g(x)}=\lim\frac{f'(x)}{g'(x)}$, asalkan limit di ruas kanan ada atau $\pm\infty$.** Di sini $a$ boleh terhingga atau tak hingga, dan $x\to a$ boleh diganti $x\to a^+$ atau $x\to a^-$. Bukti kasus ini lebih sulit dan tidak diberikan di sini; ia hasil abad ke-19. **Contoh 4.** Tentukan limit bentuk $\frac\infty\infty$ berikut. (a) $\lim_{x\to\pi/2^-}\frac{\sec x}{1+\tan x}$. Kedua bagian menuju $+\infty$ dari kiri, sehingga $=\lim\frac{\sec x\tan x}{\sec^2x}=\lim\sin x=1$ (penyederhanaan, $\frac{\tan x}{\sec x}=\sin x$, lebih mudah di sini daripada putaran kedua). (b) $\lim_{x\to\infty}\frac{\ln x}{2\sqrt x}=\lim_{x\to\infty}\frac{1/x}{1/\sqrt x}$ $=\lim_{x\to\infty}\frac1{\sqrt x}=0$. (c) $\lim_{x\to\infty}\frac{e^x}{x^2}=\lim\frac{e^x}{2x}=\lim\frac{e^x}{2}=\infty$. Dua yang terakhir adalah perbandingan laju tumbuh: logaritma tumbuh lebih lambat daripada pangkat positif $x$ mana pun, dan eksponensial tumbuh lebih cepat daripada pangkat mana pun, sehingga $\frac{\ln x}{x^p}\to0$ dan $\frac{e^x}{x^p}\to\infty$ untuk setiap $p>0$. Banyak limit di bab berikutnya diselesaikan dengan urutan ini: $\ln x\ll x^p\ll e^x$ ketika $x\to\infty$. **Suku utama.** Untuk hasil bagi polinom aturan ini memberi jawaban yang kita kenal: $\lim_{x\to\infty}\frac{5x^2-3x}{7x^2+1}=\lim\frac{10x-3}{14x}=\lim\frac{10}{14}=\frac57$, perbandingan koefisien utama. ## Bagaimana menangani 0·∞ dan ∞−∞? **Bentuk $\infty\cdot0$ dan $\infty-\infty$ bukan hasil bagi, sehingga aljabar lebih dahulu mengubahnya menjadi $\frac00$ atau $\frac\infty\infty$, lalu aturan berlaku.** Baik $\infty\cdot0$ maupun $\infty-\infty$ bukan bilangan; keduanya hanya menggambarkan apa yang dilakukan bagiannya. **Contoh 5: hasil kali.** (a) $\lim_{x\to\infty}x\sin\frac1x$ berbentuk $\infty\cdot0$. Tulis sebagai $\lim_{x\to\infty}\frac{\sin(1/x)}{1/x}$, bentuk $\frac00$, dan terapkan aturan: $=\lim_{x\to\infty}\frac{\cos(1/x)\cdot(-1/x^2)}{-1/x^2}$ $=\lim_{x\to\infty}\cos\frac1x=1$. (b) $\lim_{x\to0^+}x\ln x$ berbentuk $0\cdot\infty$. Tulis sebagai $\lim_{x\to0^+}\frac{\ln x}{1/x}$, bentuk $\frac\infty\infty$, dan terapkan aturan: $=\lim_{x\to0^+}\frac{1/x}{-1/x^2}=\lim_{x\to0^+}(-x)=0$. Pilihan faktor mana yang masuk penyebut penting: $x\ln x=\frac{x}{1/\ln x}$ akan menuju hasil bagi yang lebih buruk. Taruh di penyebut faktor yang kebalikannya lebih mudah diturunkan. **Contoh 6: selisih.** Tentukan $\lim_{x\to0}\left(\frac1x-\frac1{\sin x}\right)$. Ketika $x\to0^+$, $\frac1x\to\infty$ dan $\frac1{\sin x}\to\infty$, sehingga bentuknya $\infty-\infty$; ketika $x\to0^-$ bentuknya $-\infty-(-\infty)$. Keduanya tidak menunjukkan limitnya. Gabungkan pecahan dengan penyebut sekutu, $$\frac1x-\frac1{\sin x}=\frac{\sin x-x}{x\sin x},$$ yang berbentuk $\frac00$, dan terapkan aturan dua kali: $$\lim_{x\to0}\frac{\sin x-x}{x\sin x}=\lim_{x\to0}\frac{\cos x-1}{\sin x+x\cos x}=\lim_{x\to0}\frac{-\sin x}{2\cos x-x\sin x}=\frac02=0.$$ Selisih lain: $\lim_{x\to1^+}\left(\frac1{\ln x}-\frac1{x-1}\right)=\lim\frac{x-1-\ln x}{(x-1)\ln x}=\frac12$, lagi-lagi pecahan gabungan berbentuk $\frac00$ dan dua putaran. ## Bagaimana menangani 1^∞, 0^0, dan ∞^0? **Limit yang menuju $1^\infty$, $0^0$, dan $\infty^0$ ditangani dengan mengambil logaritma fungsi lebih dahulu, gagasan [diferensiasi logaritmik](https://nunada.my.id/artikel/turunan-fungsi-invers-dan-logaritma/#logarithmic-differentiation): cari limit $L$ dari $\ln f(x)$ dengan aturan, lalu eksponensialkan.** Jika $\lim_{x\to a}\ln f(x)=L$, maka $$\lim_{x\to a}f(x)=\lim_{x\to a}e^{\ln f(x)}=e^L,$$ karena kekontinuan fungsi eksponensial. Rumus ini berlaku untuk limit satu sisi dan untuk $a=\pm\infty$. Jika $f(x)=u(x)^{v(x)}$ maka $\ln f=v\ln u$, suatu hasil kali, yang oleh bagian sebelumnya diubah menjadi hasil bagi $\frac{\ln u}{1/v}$. **Contoh 7.** Tunjukkan bahwa $\lim_{x\to0^+}(1+x)^{1/x}=e$. Limit ini berbentuk $1^\infty$. Misalkan $f(x)=(1+x)^{1/x}$, sehingga $\ln f(x)=\frac{\ln(1+x)}{x}$, bentuk $\frac00$. Menurut aturan $$\lim_{x\to0^+}\ln f(x)=\lim_{x\to0^+}\frac{\ln(1+x)}{x}=\lim_{x\to0^+}\frac{1/(1+x)}{1}=1.$$ Jadi $\lim_{x\to0^+}(1+x)^{1/x}=e^1=e$. Ini adalah bilangan $e$ dari definisi eksponensial, dan sama dengan $\lim_{x\to\infty}\left(1+\frac1x\right)^x=e$. **Contoh 8.** Tentukan $\lim_{x\to\infty}x^{1/x}$. Bentuknya $\infty^0$. Dengan $f(x)=x^{1/x}$, $\ln f(x)=\frac{\ln x}{x}$, bentuk $\frac\infty\infty$, dan $\lim_{x\to\infty}\frac{\ln x}{x}=\lim\frac{1/x}{1}=0$. Jadi $\lim_{x\to\infty}x^{1/x}=e^0=1$. **Contoh lain.** $\lim_{x\to0^+}x^x$ berbentuk $0^0$: $\ln x^x=x\ln x\to0$ menurut Contoh 5(b), sehingga $x^x\to e^0=1$. Dan $\lim_{x\to1^+}x^{1/(x-1)}$ adalah $1^\infty$: $\frac{\ln x}{x-1}\to1$, sehingga limitnya $e$. Secara umum $\lim_{x\to\infty}\left(1+\frac px\right)^x=e^p$. Alat di bawah mengambil bentuknya, menunjukkan penulisan ulang, dan menjalankan aturan untuk setiap jenis bentuk tak tentu: $0\cdot\infty$, $\infty-\infty$, dan pangkat. ## Kapan Aturan L’Hôpital tidak membantu? **Aturan ini adalah alat dengan syarat, dan tiga hal bisa salah: hasil bagi bukan bentuk tak tentu, aturan berputar, atau hasil bagi turunan tidak punya limit.** **1. Bukan bentuk tak tentu.** Jika pembilang memiliki limit terhingga yang bukan nol, atau hasil bagi sudah tentu, aturan tidak boleh dipakai. $\lim_{x\to2}\frac{x^2+1}{x+1}=\frac53$ dengan substitusi; menurunkan akan memberi $\frac{2x}1\to4$, yang salah. Hal yang sama terjadi di tengah perhitungan, seperti pada Contoh 2, begitu hasil bagi tidak lagi $\frac00$. **2. Aturan berputar.** Untuk $\lim_{x\to\infty}\frac{\sqrt{9x+1}}{\sqrt x+1}$ hasil bagi turunannya $\frac{9\sqrt x}{\sqrt{9x+1}}$, lagi-lagi berbentuk $\frac\infty\infty$, dan putaran berikutnya membawa kembali hasil bagi sejenis: kamu hanya berputar-putar. Aljabar menyelesaikannya: bagi pembilang dan penyebut dengan $\sqrt x$ untuk mendapat $\frac{\sqrt{9+1/x}}{1+1/\sqrt x}\to3$. Demikian pula $\frac{\sqrt{x^2+1}}{x}$ berputar antara hasil bagi dan kebalikannya, dan jawabannya $1$. **3. Turunannya tidak punya limit.** Teorema menyatakan limit $\frac fg$ sama dengan limit $\frac{f'}{g'}$ jika yang terakhir ada. Untuk $\lim_{x\to\infty}\frac{x+\sin x}{x}$ hasil bagi turunannya $1+\cos x$, yang tidak punya limit, sehingga aturan tidak menyatakan apa pun, namun limit semula ada: $\frac{x+\sin x}{x}=1+\frac{\sin x}{x}\to1$. Dengan cara yang sama $\lim_{x\to0^+}\frac{x^2\sin(1/x)}{\sin x}$ turunannya memuat $\cos(1/x)$, yang berosilasi, sedangkan $x\sin\frac1x\cdot\frac{x}{\sin x}\to0$. **Limit satu sisi yang berbeda.** Contoh 3: $\frac{\sin x}{x^2}$ menuju $+\infty$ dari kanan dan $-\infty$ dari kiri; limit dua sisinya tidak ada, dan aturan memberi nilai satu sisi dengan benar. Pada semua kasus ini limit yang dibaca langsung, atau sedikit aljabar seperti membagi dengan suku dominan, melakukan apa yang tidak dapat dilakukan aturan. Cobalah di bawah: alat melaporkan statusnya, dan untuk putaran atau limit yang tidak ada ia juga membaca hasil bagi semula secara langsung. ## Mengapa Aturan L’Hôpital benar? **Aturan ini berasal dari Teorema Nilai Rata-rata Cauchy, perluasan [Teorema Nilai Rata-rata](https://nunada.my.id/artikel/teorema-nilai-rata-rata/#mean-value-theorem) untuk dua fungsi.** Gambaran dulu. Ambil $f$ dan $g$ dengan turunan kontinu, $f(a)=g(a)=0$, dan $g'(a)\ne0$. Di dekat $a$ keduanya dekat dengan [linearisasinya](https://nunada.my.id/artikel/linearisasi-dan-diferensial/#linearization), $f(x)=f'(a)(x-a)+\varepsilon_1(x-a)$ dan $g(x)=g'(a)(x-a)+\varepsilon_2(x-a)$, dengan $\varepsilon_1,\varepsilon_2\to0$ ketika $x\to a$. Maka $$\frac{f(x)}{g(x)}=\frac{f'(a)+\varepsilon_1}{g'(a)+\varepsilon_2}\to\frac{f'(a)}{g'(a)}=\lim_{x\to a}\frac{f'(x)}{g'(x)}.$$ Hasil bagi dua fungsi yang lenyap di $a$ adalah hasil bagi gradiennya di sana. Bukti di bawah tidak memerlukan $g'(a)\ne0$ maupun turunan kontinu. **Teorema Nilai Rata-rata Cauchy.** Misalkan $f$ dan $g$ kontinu pada $[a,b]$ dan terdiferensialkan pada $(a,b)$, dan $g'(x)\ne0$ di seluruh $(a,b)$. Maka ada bilangan $c$ di $(a,b)$ dengan $$\frac{f'(c)}{g'(c)}=\frac{f(b)-f(a)}{g(b)-g(a)}.$$ Ketika $g(x)=x$ ini adalah Teorema Nilai Rata-rata. Bukti. Pertama, $g(a)\ne g(b)$: jika tidak, Teorema Nilai Rata-rata akan memberi $g'(c)=\frac{g(b)-g(a)}{b-a}=0$ untuk suatu $c$, yang dikecualikan. Lalu terapkan Teorema Nilai Rata-rata pada $$F(x)=f(x)-f(a)-\frac{f(b)-f(a)}{g(b)-g(a)}\,\big(g(x)-g(a)\big).$$ $F$ kontinu pada $[a,b]$ dan terdiferensialkan pada $(a,b)$, dan $F(a)=F(b)=0$. Menurut [Teorema Rolle](https://nunada.my.id/artikel/teorema-nilai-rata-rata/#rolle) ada $c$ dengan $F'(c)=0$, yaitu $$f'(c)-\frac{f(b)-f(a)}{g(b)-g(a)}\,g'(c)=0,$$ yang disusun ulang menjadi pernyataan itu. ∎ Secara geometri, kurva $(g(t),f(t))$ memiliki garis singgung yang sejajar dengan tali busur melalui ujungnya, dan gradien garis singgung itu adalah $\frac{f'}{g'}$. Gambarlah kurva di bawah dan lihat garis singgungnya. Bukti Aturan l'Hôpital (kasus $x\to a^+$, bentuk $\frac00$). Karena $f(x)\to0$ dan $g(x)\to0$ dan keduanya terdiferensialkan di $a$, keduanya kontinu di sana dan $f(a)=g(a)=0$. Untuk $x$ di kanan $a$ terapkan teorema Cauchy pada $[a,x]$: ada $c$ di antara $a$ dan $x$ dengan $$\frac{f'(c)}{g'(c)}=\frac{f(x)-f(a)}{g(x)-g(a)}=\frac{f(x)}{g(x)}.$$ Ketika $x\to a^+$, $c$ terjepit di antara $a$ dan $x$, sehingga $c\to a^+$, dan karena itu $$\lim_{x\to a^+}\frac{f(x)}{g(x)}=\lim_{c\to a^+}\frac{f'(c)}{g'(c)}=\lim_{x\to a^+}\frac{f'(x)}{g'(x)}.$$ Kasus $x\to a^-$ sama pada $[x,a]$, dan keduanya bersama memberi aturan dua sisi. ∎ ## Bagaimana menghitung limit ini dalam kode? **Dalam kode, `sp.limit(expr, x, a, '+')` dari SymPy mencari limit secara eksak, dan beberapa baris `sp.diff` mereproduksi aturan putaran demi putaran.** Tanpa CAS, tabel hasil bagi pada jarak yang mengecil menunjukkan limitnya, dan tabel $\frac{f'}{g'}$ di sebelahnya menuju bilangan yang sama, yang merupakan isi aturan. Evaluasi numerik di dekat suatu titik punya jebakan yang tidak dimiliki aturan: untuk $(1+h)^{1/h}$ komputer membulatkan $1+h$ menjadi $1$ begitu $h$ di bawah sekitar $10^{-16}$ dan mengembalikan $1$, bukan $e$, sehingga tabel harus berhenti pada $h$ sedang. ```python import sympy as sp x = sp.symbols('x') def lhopital(f, g, a, direction='+-', rounds=6): """Apply l'Hopital's Rule while the quotient is 0/0 or oo/oo; return the quotient at each round and the limit.""" steps = [] for _ in range(rounds): lf, lg = sp.limit(f, x, a, direction), sp.limit(g, x, a, direction) indeterminate = (lf == 0 and lg == 0) or (lf in (sp.oo, -sp.oo) and lg in (sp.oo, -sp.oo)) steps.append((sp.simplify(f / g), 'rule' if indeterminate else 'stop')) if not indeterminate: break f, g = sp.diff(f, x), sp.diff(g, x) return steps, sp.limit(f / g, x, a, direction) examples = ( (3 * x - sp.sin(x), x, 0), # Example 1a (x - sp.sin(x), x**3, 0), # Example 1d: three rounds (1 - sp.cos(x), x + x**2, 0), # Example 2: one round, then stop (sp.exp(x), x**2, sp.oo), # Example 4c (sp.sin(x) - x, x * sp.sin(x), 0), # Example 6: 1/x - 1/sin x as one fraction ) for f, g, a in examples: print(f, '/', g, 'at', a, '->', lhopital(f, g, a)) print(sp.limit((1 + x) ** (1 / x), x, 0, '+'), sp.limit(x ** (1 / x), x, sp.oo), sp.limit(x ** x, x, 0, '+')) # 3*x - sin(x) / x at 0 -> ([(3 - sin(x)/x, 'rule'), (3 - cos(x), 'stop')], 2) # x - sin(x) / x**3 at 0 -> ([((x - sin(x))/x**3, 'rule'), ((1 - cos(x))/(3*x**2), 'rule'), (sin(x)/(6*x), 'rule'), (cos(x)/6, 'stop')], 1/6) # 1 - cos(x) / x**2 + x at 0 -> ([((1 - cos(x))/(x*(x + 1)), 'rule'), (sin(x)/(2*x + 1), 'stop')], 0) # exp(x) / x**2 at oo -> ([(exp(x)/x**2, 'rule'), (exp(x)/(2*x), 'rule'), (exp(x)/2, 'stop')], oo) # -x + sin(x) / x*sin(x) at 0 -> ([((-x/sin(x) + 1)/x, 'rule'), ((cos(x) - 1)/(x*cos(x) + sin(x)), 'rule'), (sin(x)/(x*sin(x) - 2*cos(x)), 'stop')], 0) # E 1 1 ``` ```javascript // the quotient f/g at shrinking distances from a: f/g and f'/g' (and the rounds after it) tend to the same number const near = (f, g, a, hs = [0.1, 0.01, 0.001]) => hs.map((h) => +(f(a + h) / g(a + h)).toFixed(5)) const f = (x) => x - Math.sin(x) const g = (x) => x ** 3 // Example 1d, whose limit is 1/6 near(f, g, 0) // [0.16658, 0.16667, 0.16667] f/g near((x) => 1 - Math.cos(x), (x) => 3 * x * x, 0) // [0.16653, 0.16667, 0.16667] f'/g' near((x) => Math.sin(x), (x) => 6 * x, 0) // [0.16639, 0.16666, 0.16667] f''/g'' near((x) => Math.cos(x), () => 6, 0) // [0.16583, 0.16666, 0.16667] f'''/g''': no longer 0/0 // a power limit, and the trap of rounding: (1 + h)^(1/h) tends to e, until 1 + h is rounded to 1 ;[1e-2, 1e-4, 1e-6].map((h) => (1 + h) ** (1 / h)) // [2.7048138294215285, 2.7181459268249255, 2.7182804690957534] ;(1 + 1e-17) ** (1 / 1e-17) // 1: 1 + 1e-17 is 1 in floating point ;[1e-2, 1e-4, 1e-8].map((h) => h * Math.log(h)) // [-0.046, -0.00092, -1.84e-7]: x ln x -> 0 ``` ```cpp #include #include #include using namespace std; int main() { double hs[3]; hs[0] = 0.1; hs[1] = 0.01; hs[2] = 0.001; for (int i = 0; i < 3; i++) { // Example 1d: (x - sin x) / x^3, limit 1/6 double h = hs[i]; double q0 = (h - sin(h)) / (h * h * h); // f / g double q1 = (1 - cos(h)) / (3 * h * h); // f' / g' double q2 = sin(h) / (6 * h); // f'' / g'' double q3 = cos(h) / 6; // f''' / g''', no longer 0/0 printf("h=%.3f %.5f %.5f %.5f %.5f\n", h, q0, q1, q2, q3); } printf("%.5f\n", 1.0 / 6); printf("%.5f %.5f\n", pow(1.01, 100.0), pow(1.0001, 10000.0)); // (1 + h)^(1/h) tends to e = 2.71828 return 0; } /* output: h=0.100 0.16658 0.16653 0.16639 0.16583 h=0.010 0.16667 0.16667 0.16666 0.16666 h=0.001 0.16667 0.16667 0.16667 0.16667 0.16667 2.70481 2.71815 */ ``` ## Siapa yang menemukan Aturan L’Hôpital? **Aturan ini memakai nama orang yang menerbitkannya, bukan orang yang menemukannya.** - **Johann Bernoulli, 1691–92.** Matematikawan Swiss Johann Bernoulli, murid muda kalkulus baru Leibniz, mengajarkannya di Paris kepada bangsawan Prancis Guillaume de l'Hôpital, dan dalam pelajarannya ia memberi cara mencari nilai pecahan yang pembilang dan penyebutnya sama-sama lenyap. - **l'Hôpital, 1696.** Dalam Analyse des infiniment petits pour l'intelligence des lignes courbes, buku teks pertama kalkulus diferensial, l'Hôpital mencetak aturan itu, dengan menyatakan bahwa ia berutang banyak kepada Bernoulli dan Leibniz. Berdasarkan perjanjian l'Hôpital membayar Bernoulli untuk penemuannya dan bebas memakainya. - **Sebuah naskah, 1921.** Catatan kuliah Bernoulli sendiri tentang kalkulus diferensial ditemukan pada tahun 1920-an, dan menunjukkan bahwa aturan itu, dan banyak hal lain dalam buku teks tersebut, milik Bernoulli. Namanya tetap. - **Cauchy, 1823.** Augustin-Louis Cauchy memberi pernyataan umum dan bukti lewat teorema nilai rata-rata untuk dua fungsi, yang memakai namanya. Aturan asli menangani hasil bagi dua ungkapan yang lenyap di suatu titik; pemakaian berulang, limit satu sisi, dan bentuk $\frac\infty\infty$ diselesaikan pada abad ke-19. - **Sekarang.** Aturan ini adalah alat pertama untuk limit tak tentu dan cara limit seperti $\frac{\sin x}x$ dan $\frac{\ln x}{x}$ diajarkan; sistem aljabar komputer menghitungnya dengan deret, yang lebih cepat. ## Kesalahan apa yang sering terjadi pada Aturan L’Hôpital? **Kesalahan paling umum pada bentuk tak tentu dan Aturan L'Hôpital adalah sembilan hal berikut, masing-masing dengan pernyataan yang benar.** | Kesalahan | Yang benar | |---|---| | ❌ Menurunkan hasil bagi $\left(\frac fg\right)'$ | Bagi turunannya: $\frac{f'}{g'}$. Untuk $\frac{x^2-1}{x-1}$ di $1$ limitnya $\frac{2x}{1}\to2$, sedangkan $\left(x+1\right)'=1$. | | ❌ Memakai aturan pada sembarang limit | Hanya pada $\frac00$ dan $\frac\infty\infty$: $\lim_{x\to2}\frac{x^2+1}{x+1}=\frac53$, dan $\frac{2x}1\to4$ salah. | | ❌ Terus menurunkan setelah bentuknya hilang | $\frac{1-\cos x}{x+x^2}\to\frac{\sin x}{1+2x}\to0$; satu putaran lagi memberi $\frac12$ yang salah. | | ❌ $\frac00$ adalah $1$, atau $0$ | $\frac xx\to1$, $\frac{x^3}{x}\to0$, $\frac{x}{x^3}\to\infty$, $\frac{2x}{x}\to2$: label itu tidak menentukan apa pun. | | ❌ Jika $\frac{f'}{g'}$ tidak punya limit, $\frac fg$ juga tidak | $\frac{x+\sin x}x\to1$ walaupun $1+\cos x$ tidak punya limit. | | ❌ $0\cdot\infty=0$ | $x\ln x\to0$, tetapi $x\cdot\frac1x=1$ dan $x\cdot\frac1{x^2}\to\infty$: tulis ulang sebagai hasil bagi. | | ❌ $1^\infty=1$ | $(1+x)^{1/x}\to e$: ambil logaritma dan pakai $e^L$. | | ❌ $\infty-\infty=0$ | $x^2-x\to\infty$ dan $x-x=0$: gabungkan menjadi satu pecahan lebih dahulu. | | ❌ Hasil satu sisi adalah hasil dua sisi | $\frac{\sin x}{x^2}\to+\infty$ dari kanan dan $-\infty$ dari kiri: tidak ada limit dua sisi. | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: Aturan L’Hôpital sekilas - **Bentuk tak tentu:** $\frac00$, $\frac\infty\infty$, $0\cdot\infty$, $\infty-\infty$, $1^\infty$, $0^0$, $\infty^0$ menggambarkan limit yang tidak ditentukan oleh bagian-bagiannya. - **Aturan:** $\frac00$ atau $\frac\infty\infty$ di $a$ memberi $\lim\frac fg=\lim\frac{f'}{g'}$ jika ruas kanan ada atau $\pm\infty$; juga untuk limit satu sisi dan $a=\pm\infty$. - **Cara:** turunkan $f$ dan $g$ secara terpisah, ulangi selama bentuknya tetap tak tentu, berhenti pada hasil bagi pertama yang bukan. - **Bentuk lain:** hasil kali dan selisih menjadi hasil bagi dengan aljabar; pangkat dengan $\ln$, lalu $e^L$. - **Pertumbuhan:** $\ln x\ll x^p\ll e^x$ ketika $x\to\infty$. - **Ketika gagal:** hasil bagi yang sudah tentu, putaran ($\sqrt{9x+1}/(\sqrt x+1)$), atau $\frac{f'}{g'}$ tanpa limit ($(x+\sin x)/x$). - **Bukti:** Teorema Nilai Rata-rata Cauchy, $\frac{f'(c)}{g'(c)}=\frac{f(b)-f(a)}{g(b)-g(a)}$, lalu jepit $c$ di antara $a$ dan $x$. - **Berikutnya:** optimisasi terapan, metode selang tertutup yang dipakai pada masalah nyata. - **Kode:** `sp.limit(expr, x, a, '+')`, `sp.diff` untuk putarannya, dan tabel pada jarak sedang. ## Glosarium: istilah penting - **Bentuk tak tentu**: Label untuk limit, seperti nol per nol, yang nilainya tidak ditentukan oleh limit bagian-bagiannya dan dapat bernilai bilangan apa pun atau tak hingga. - **Aturan L’Hôpital**: Aturan bahwa limit hasil bagi berbentuk nol per nol atau tak hingga per tak hingga sama dengan limit hasil bagi turunannya, jika limit itu ada. - **Teorema Nilai Rata-rata Cauchy**: Teorema Nilai Rata-rata untuk dua fungsi: untuk suatu titik c, hasil bagi turunan sama dengan hasil bagi perubahan fungsi pada selang. - **Pangkat tak tentu**: Limit berbentuk satu pangkat tak hingga, nol pangkat nol, atau tak hingga pangkat nol, yang dicari dengan mengambil logaritma fungsi dan mengeksponensialkan limitnya. - **Limit satu sisi**: Limit ketika x mendekati a hanya dari kanan atau hanya dari kiri; limit dua sisi ada hanya jika keduanya sama. - **Laju tumbuh**: Seberapa cepat fungsi tumbuh ketika x menuju tak hingga; logaritma tumbuh lebih lambat daripada pangkat mana pun, dan eksponensial lebih cepat daripada pangkat mana pun. ## Pertanyaan yang sering diajukan ### Apa itu Aturan L’Hôpital? Itu adalah aturan untuk limit hasil bagi. Jika pembilang dan penyebut sama-sama menuju nol, atau sama-sama menuju tak hingga, limit hasil baginya sama dengan limit hasil bagi turunannya, asalkan limit kedua itu ada atau tak hingga. ### Apa itu bentuk tak tentu? Itu adalah label seperti nol per nol atau tak hingga per tak hingga untuk limit yang nilainya tidak ditentukan oleh limit bagian-bagiannya. Limit berbeda dengan label yang sama memberi hasil berbeda, sehingga labelnya sendiri bukan bilangan. ### Apakah memakai aturan hasil bagi pada Aturan L’Hôpital? Tidak. Kamu menurunkan pembilang dan penyebut secara terpisah lalu membaginya, yang memberi f aksen per g aksen. Menurunkan seluruh hasil bagi adalah kesalahan umum dan memberi bilangan lain yang salah. ### Kapan berhenti menerapkan Aturan L’Hôpital? Berhentilah begitu hasil bagi tidak lagi berbentuk nol per nol atau tak hingga per tak hingga. Maka limit dapat dibaca langsung. Menerapkan aturan sekali lagi pada hasil bagi yang bukan tak tentu memberi jawaban yang salah. ### Bagaimana menangani bentuk nol kali tak hingga? Tulis ulang hasil kali sebagai hasil bagi dengan memindahkan satu faktor ke penyebut sebagai kebalikannya, misalnya x kali logaritma x sebagai logaritma x per satu per x. Itu tak hingga per tak hingga, dan aturan berlaku. ### Bagaimana mencari limit berbentuk satu pangkat tak hingga? Ambil logaritma natural fungsi, yang mengubah pangkat menjadi hasil kali lalu hasil bagi. Cari limit L dengan aturan, dan limit semula adalah e pangkat L. Misalnya, satu tambah x pangkat 1 per x menuju e. ### Kapan Aturan L’Hôpital gagal? Ketika hasil bagi bukan tak tentu, ketika pemakaian berulang berputar melalui hasil bagi sejenis, atau ketika hasil bagi turunan tidak punya limit padahal yang semula punya, seperti x tambah sinus x per x di tak hingga. ### Bagaimana Aturan L’Hôpital dibuktikan? Dengan Teorema Nilai Rata-rata Cauchy, yang menyatakan bahwa untuk dua fungsi ada titik tempat hasil bagi turunan sama dengan hasil bagi perubahan. Diterapkan antara a dan x, titik itu terjepit menuju a ketika x mendekati a. ### Siapa yang menemukan Aturan L’Hôpital? Johann Bernoulli menemukannya dan mengajarkannya kepada Guillaume de l’Hôpital, yang mencetaknya pada 1696 dalam buku teks pertama kalkulus diferensial. Aturan ini dinamai menurut penulis buku itu, dan catatan Bernoulli sendiri menegaskan bahwa itu miliknya. --- # Concavity and Curve Sketching Source: https://nunada.my.id/articles/concavity-and-curve-sketching/ Updated: 2026-10-22 ## Quick answer **The graph of $f$ is concave up where $f'$ is increasing, which is where $f''>0$, and concave down where $f'$ is decreasing, where $f''<0$; a point where the concavity changes and the graph has a tangent line is a point of inflection.** The Second Derivative Test uses the same sign at a critical point, $f'=0$: $f''>0$ is a local minimum and $f''<0$ a local maximum. Together with $f'$ and the asymptotes, $f''$ gives the shape of a graph. ### Key takeaways - The graph of a differentiable $f$ is concave up on an open interval if $f'$ is increasing there and concave down if $f'$ is decreasing; if $f''>0$ throughout the graph is concave up, and if $f''<0$ concave down. - A point of inflection is a point of the graph with a tangent line where the concavity changes; there $f''=0$ or $f''$ does not exist, but the converse is false: $f''(0)=0$ for $x^4$ and there is no inflection. - Inflection points can sit where $f''$ does not exist: $x^{5/3}$ at a horizontal tangent and $\sqrt[3]{x}$ at a vertical tangent, while $x^{2/3}$ has a cusp, no tangent line and no inflection. - Second Derivative Test: if $f'(c)=0$ and $f''(c)<0$ there is a local maximum, if $f''(c)>0$ a local minimum, and if $f''(c)=0$ the test fails, as $x^4$, $-x^4$ and $x^3$ show. - For a particle $a=s''$: speeding up when velocity and acceleration have the same sign and slowing down when they differ; the inflection points of the position are where the acceleration changes sign. - Curve sketching follows seven steps: domain and symmetry, $f'$ and $f''$, critical points, rising and falling, inflection and concavity, asymptotes, key points. ## What is concavity? **The graph of a differentiable function $y=f(x)$ is concave up on an open interval $I$ if $f'$ is increasing on $I$, and concave down on $I$ if $f'$ is decreasing on $I$.** A function whose graph is concave up is also often called convex. The picture is of how the curve turns. Along $y=x^3$ coming into the origin from the left, the curve bends to the right and falls below its tangent lines, and the slopes of those tangent lines decrease: concave down. Leaving the origin to the right, the curve bends to the left and rises above its tangent lines, and the slopes increase: concave up. Since $f'$ is a function in its own right, the [monotonic functions](https://nunada.my.id/articles/monotonic-functions-and-the-first-derivative-test/#derivative-sign) of the previous article apply to it: $f'$ increases where its own derivative $f''$ is positive, and decreases where $f''$ is negative. **Second Derivative Test for concavity.** Let $y=f(x)$ be twice-differentiable on an interval $I$. 1. If $f''>0$ on $I$, the graph of $f$ over $I$ is concave up. 2. If $f''<0$ on $I$, the graph of $f$ over $I$ is concave down. We write $f''$ or $y''$ for the second derivative. Concavity is not rising or falling: a concave-up graph can rise, fall or do both, as $x^2$ does, while what it cannot do is wave. **Example 1.** (a) The curve $y=x^3$ has $y''=6x$, negative for $x<0$ and positive for $x>0$, so it is concave down on $(-\infty,0)$ and concave up on $(0,\infty)$. (b) The curve $y=x^2$ has $y''=2>0$ everywhere, so it is concave up on the whole line. **Example 2.** Determine the concavity of $y=3+\sin x$ on $0\le x\le2\pi$. Here $y'=\cos x$ and $y''=-\sin x$, which is negative on $(0,\pi)$ and positive on $(\pi,2\pi)$. The graph is concave down on $(0,\pi)$ and concave up on $(\pi,2\pi)$. Type a function and a window below, or choose an example. The graph is dark where it is concave up and orange where it is concave down, and the graph of $f''$ shows why. ## What is a point of inflection? **A point $(c,f(c))$ where the graph of a function has a tangent line and where the concavity changes is a point of inflection.** At such a point the graph crosses its own tangent line. In Example 2 the curve $y=3+\sin x$ changes concavity at $(\pi,3)$, where the tangent has slope $y'(\pi)=\cos\pi=-1$. Since the tangent line exists, either $f'(c)$ exists (is finite), or the graph has a vertical tangent there. At a vertical tangent neither $f'$ nor $f''$ exists. So at a point of inflection one of two things happens: **$f''(c)=0$ or $f''(c)$ fails to exist.** When $f''$ is continuous the first follows from the Intermediate Value Theorem, because $f''$ changes sign. The condition is necessary and not sufficient: $f''=0$ or not existing only marks a candidate, and the sign has to change. **Example 3.** Find the concavity and inflection points of $f(x)=x^3-3x^2+2$. Here $f'(x)=3x^2-6x$ and $f''(x)=6x-6$, which is negative for $x<1$, zero at $x=1$ and positive for $x>1$. The graph is concave down on $(-\infty,1)$, concave up on $(1,\infty)$ and has the inflection point $(1,0)$. **Example 4: $f''$ does not exist.** The graph of $f(x)=x^{5/3}$ has a horizontal tangent at the origin, since $f'(x)=\frac53x^{2/3}=0$ at $x=0$. The second derivative $f''(x)=\frac{10}9x^{-1/3}$ does not exist at $0$, but it is negative for $x<0$ and positive for $x>0$, so it changes sign: an inflection point at the origin. **Example 5: $f''=0$ and no inflection.** The curve $y=x^4$ has $y''=12x^2$, which is $0$ at $x=0$ but does not change sign: the curve is concave up everywhere. **Example 6: a vertical tangent.** The graph of $y=x^{1/3}$ has an inflection point at the origin because $y''=-\frac29x^{-5/3}$ is positive for $x<0$ and negative for $x>0$. But $y'=\frac13x^{-2/3}$ and $y''$ both fail to exist at $0$, and there is a vertical tangent. **A caution.** When the second derivative does not exist at $c$, an inflection point may or may not occur. $x^{2/3}$ has no second derivative at $0$ and no inflection: its second derivative $-\frac29x^{-4/3}$ is negative on both sides, and the graph has a cusp, with no tangent line at all. Another case: $f(x)=x|x|$ has $f'(x)=2|x|$, which exists at $0$, although $f''=2\,\text{sign}\,x$ does not, and it is an inflection point. At such places the graph can have vertical tangents, corners, cusps or breaks, so read the sign of $f''$ on both sides and ask whether there is a tangent line. Choose each case below to see the signs, the tangent and the verdict. ## What does the second derivative say about motion? **For a particle with position $s(t)$ the acceleration is $a=s''$, and the inflection points of the position graph are where the acceleration changes sign.** Together with the [motion along a line](https://nunada.my.id/articles/the-derivative-as-a-rate-of-change/#motion-along-a-line) of the rates article, the velocity $v=s'$ says which way the particle moves, and the sign of $a$ against the sign of $v$ says whether it speeds up or slows down: it speeds up when $v$ and $a$ have the same sign, and slows down when they have opposite signs. **Example 7.** A particle moves along a horizontal coordinate line (positive to the right) with position $s(t)=2t^3-14t^2+22t-5$ for $t\ge0$. The velocity is $$v(t)=s'(t)=6t^2-28t+22$$ $$v(t)=2(t-1)(3t-11)$$ and the acceleration is $$a(t)=s''(t)=12t-28=4(3t-7).$$ The velocity is zero at $t=1$ and $t=\frac{11}3$, and the acceleration at $t=\frac73$. Putting the signs together: | Time | $v$ | $a$ | Motion | |---|---|---|---| | $0\le t<1$ | $+$ | $-$ | right, slowing down | | $1\frac{11}3$ | $+$ | $+$ | right, speeding up | The particle starts moving right while the leftward acceleration slows it, turns round at $t=1$ and speeds up to the left. At $t=\frac73$ the acceleration changes direction, which is the inflection point of the position graph, but the particle keeps moving left, now slowing down. At $t=\frac{11}3$ it turns round again and, moving the same way as the acceleration, speeds up to the right. ## What is the Second Derivative Test for local extrema? **Instead of looking for a sign change of $f'$ at a critical point, we can sometimes read the concavity there: a graph that is concave down at a point where the tangent is horizontal is at the top of a hill, and one that is concave up is at the bottom of a valley.** **Second Derivative Test for local extrema.** Suppose $f''$ is continuous on an open interval that contains $x=c$. 1. If $f'(c)=0$ and $f''(c)<0$, then $f$ has a local maximum at $x=c$. 2. If $f'(c)=0$ and $f''(c)>0$, then $f$ has a local minimum at $x=c$. 3. If $f'(c)=0$ and $f''(c)=0$, then the test fails: $f$ may have a local maximum, a local minimum, or neither. Proof of part 1. If $f''(c)<0$ then $f''<0$ on some open interval $I$ around $c$, because $f''$ is continuous. So $f'$ is decreasing on $I$. Since $f'(c)=0$, the sign of $f'$ changes from positive to negative at $c$, and $f$ has a local maximum at $c$ by the [First Derivative Test](https://nunada.my.id/articles/monotonic-functions-and-the-first-derivative-test/#first-derivative-test). Part 2 is similar. ∎ Part 3. Take $y=x^4$, $y=-x^4$ and $y=x^3$. For each of them the first and second derivatives are zero at $x=0$. Yet $x^4$ has a local minimum there, $-x^4$ has a local maximum, and $x^3$ is increasing on every open interval around $0$ and has neither. The test cannot tell them apart. The test needs $f''$ only at $c$ itself, which makes it easy to apply: one number answers the question. The price is that it is inconclusive when $f''(c)=0$ or when $f''$ does not exist at $c$ (as for $x^{2/3}$ at its cusp); then the First Derivative Test is used. Choose a case below and read the two tests side by side. ## How do you sketch the graph of a function? **To sketch $y=f(x)$, collect what $f$, $f'$ and $f''$ say and combine it: where the graph rises and falls, how it bends, where it turns, and what it approaches.** **Procedure for graphing $y=f(x)$.** 1. Identify the domain of $f$ and any symmetries the curve may have. 2. Find the derivatives $y'$ and $y''$. 3. Find the critical points of $f$, if any, and identify the behavior of $f$ at each one. 4. Find where the curve is increasing and where it is decreasing. 5. Find the points of inflection, if any, and determine the concavity of the curve. 6. Identify any asymptotes that may exist. 7. Plot key points, such as the intercepts and the points found in steps 3 to 5, and sketch the curve together with any asymptotes. **Asymptotes.** The line $x=a$ is a vertical asymptote if $f(x)\to\pm\infty$ as $x\to a$ from one side or both, which for a rational function happens where the denominator is zero and the numerator is not. The line $y=L$ is a horizontal asymptote if $f(x)\to L$ as $x\to\infty$ or $x\to-\infty$. An oblique asymptote $y=mx+b$ appears when $f(x)-(mx+b)\to0$; for a rational function it is what long division leaves when the numerator is one degree higher than the denominator. A graph may cross a horizontal or oblique asymptote at finite values of $x$; what it does is approach it at the ends. **Example 8.** Sketch $f(x)=x^4-4x^3+10$. It is continuous with domain the whole line. The derivative $f'(x)=4x^3-12x^2=4x^2(x-3)$ is zero at $x=0$ and $x=3$, with signs $-,-,+$: so $f$ decreases on $(-\infty,3]$ and increases on $[3,\infty)$, there is no extreme value at $0$ and a local minimum $f(3)=-17$ at $3$. The second derivative $f''(x)=12x^2-24x=12x(x-2)$ is zero at $0$ and $2$, with signs $+,-,+$: the graph is concave up on $(-\infty,0)$, concave down on $(0,2)$ and concave up on $(2,\infty)$, with inflection points $(0,10)$ and $(2,-6)$. The curve cuts the $y$-axis at $10$. Notice that $x=0$ is a critical point and an inflection point, where the curve flattens out while still falling. Now try the procedure on any function below, or on the textbook's five graphed examples. The tool follows the seven steps and draws the result: dark where $f$ rises, orange where it falls, orange dots at local extremes, black dots at inflection points and dashed lines for asymptotes. ## What do the sketches of rational, exponential and trigonometric functions look like? **Four more graphs show the steps with asymptotes, a break, symmetry and a trigonometric term.** **Example 9: $f(x)=\frac{(x+1)^2}{1+x^2}$.** The domain is the whole line, with no symmetry. Since $f(x)=1+\frac{2x}{1+x^2}$, $$f'(x)=\frac{2(1-x^2)}{(1+x^2)^2}\qquad f''(x)=\frac{4x(x^2-3)}{(1+x^2)^3}.$$ The critical points are $x=\pm1$. Since $f''(-1)=1>0$ there is a local minimum $f(-1)=0$, and since $f''(1)=-1<0$ a local maximum $f(1)=2$. The sign of $f'$ is $-,+,-$, so $f$ decreases, increases, then decreases again. The denominator of $f''$ is always positive, and the numerator is zero at $-\sqrt3$, $0$ and $\sqrt3$ with signs $-,+,-,+$: each is an inflection point, $\left(-\sqrt3,1-\frac{\sqrt3}2\right)$, $(0,1)$ and $\left(\sqrt3,1+\frac{\sqrt3}2\right)$, with the graph concave down, up, down, up. Dividing by $x^2$ shows $f(x)\to1$ as $x\to\pm\infty$: the line $y=1$ is a horizontal asymptote, and there is no vertical one. The graph meets its asymptote at $x=0$ and approaches it from below on the left, concave down, and from above on the right, concave up. **Example 10: $f(x)=\frac{x^2+4}{2x}=\frac x2+\frac2x$.** The domain is $x\neq0$, there are no intercepts, and $f(-x)=-f(x)$: an odd function, symmetric about the origin. The derivatives are $$f'(x)=\frac12-\frac2{x^2}=\frac{x^2-4}{2x^2}\qquad f''(x)=\frac4{x^3}.$$ The critical points $x=\pm2$ give a local maximum $f(-2)=-2$ and a local minimum $f(2)=2$, from the sign of $f''$. The function increases on $(-\infty,-2)$, decreases on $(-2,0)$ and $(0,2)$, and increases on $(2,\infty)$. The second derivative is negative for $x<0$ and positive for $x>0$ and never zero, so there is no inflection point. Because $\frac2x\to\pm\infty$ as $x\to0^\pm$, the $y$-axis is a vertical asymptote, and because $f(x)-\frac x2=\frac2x\to0$ at both ends, $y=\frac x2$ is an oblique asymptote. **Example 11: $f(x)=e^{2/x}$.** The domain is $x\neq0$ and there is no symmetry. The derivatives are $$f'(x)=-\frac{2e^{2/x}}{x^2}\qquad f''(x)=\frac{4(x+1)e^{2/x}}{x^4}.$$ Since $f'<0$ everywhere on its domain, the graph decreases on $(-\infty,0)$ and on $(0,\infty)$. The second derivative has the sign of $x+1$, so it changes sign at $x=-1$: the point $\left(-1,e^{-2}\right)$ is an inflection point, with concave down to the left of it and concave up after. As $x\to0^+$, $\frac2x\to\infty$ and $f\to\infty$: the $y$-axis is a vertical asymptote. From the left $f\to0$. As $x\to\pm\infty$, $\frac2x\to0$ and $f\to1$, so $y=1$ is a horizontal asymptote. $f$ is never $0$, and it has no absolute extremes. **Example 12: $f(x)=\cos x-\frac{\sqrt2}2x$ on $0\le x\le2\pi$.** Here $f'(x)=-\sin x-\frac{\sqrt2}2$ is zero where $\sin x=-\frac{\sqrt2}2$, at $x=\frac{5\pi}4$ and $x=\frac{7\pi}4$. Since $f''(x)=-\cos x$, $f''\left(\frac{5\pi}4\right)=\frac{\sqrt2}2>0$ gives a local minimum $f\left(\frac{5\pi}4\right)\approx-3.48$, and $f''\left(\frac{7\pi}4\right)=-\frac{\sqrt2}2<0$ a local maximum $f\left(\frac{7\pi}4\right)\approx-3.18$. The second derivative is zero at $\frac\pi2$ and $\frac{3\pi}2$ and changes sign there: inflection points $\left(\frac\pi2,-1.11\right)$ and $\left(\frac{3\pi}2,-3.33\right)$. At the ends $f(0)=1$ and $f(2\pi)\approx-3.44$, so on this closed interval the absolute maximum is $f(0)=1$ and the absolute minimum is $f\left(\frac{5\pi}4\right)\approx-3.48$. ## How do f, f′ and f″ fit together, and what can they decide? **The first derivative says where the graph rises and falls and where it turns; the second says how it bends; and together with the asymptotes and a few points they fix the picture.** The signs combine like this: | What is known | What the graph does | |---|---| | $f'>0$ | rises from left to right | | $f'<0$ | falls from left to right | | $f''>0$ | concave up throughout, no waves | | $f''<0$ | concave down throughout, no waves | | $f''$ changes sign at a point with a tangent | point of inflection | | $f'$ changes sign | local maximum or local minimum | | $f'=0$ and $f''<0$ | local maximum | | $f'=0$ and $f''>0$ | local minimum | The same facts answer questions about the constants in a formula. **Quadratics and cubics.** For a parabola $y=ax^2+bx+c$ with $a\neq0$, $y'=2ax+b$ is zero at $x=-\frac b{2a}$, the vertex, and $y''=2a$ never changes sign: concave up if $a>0$, down if $a<0$, and a quadratic curve never has an inflection point. For a cubic $y=ax^3+bx^2+cx+d$, $y''=6ax+2b$ is zero at exactly one point, $x=-\frac b{3a}$, and changes sign there: every cubic has exactly one inflection point. If it has to be at $x=1$ for $y=x^3+bx^2+cx+d$, then $6+2b=0$ and $b=-3$. **Finding constants.** For which $a$, $b$, $c$ does $y=ax^3+bx^2+cx$ have a local maximum at $x=3$, a local minimum at $x=-1$ and an inflection point at $(1,11)$? The inflection at $x=1$ needs $y''(1)=6a+2b=0$, so $b=-3a$. Then $y'=3ax^2+2bx+c$ with $y'(3)=27a+6b+c=0$ gives $c=-9a$, and $y'(-1)=3a-2b+c=0$ holds automatically. The point $(1,11)$ needs $a+b+c=-11a=11$, so $a=-1$, $b=3$, $c=9$, and $y=-x^3+3x^2+9x$. Check: $y''=-6x+6$ is $-12<0$ at $3$ (a maximum $y(3)=27$) and $12>0$ at $-1$ (a minimum $y(-1)=-5$). **Given only $f''$.** If $y''=(x+1)(x-2)$, the sign of $y''$ is $+,-,+$ with changes at $x=-1$ and $x=2$: those are the inflection points, with no need to know $f$. ## How do you find concavity and inflection points in code? **In code, concavity is the same sign test as before, one derivative higher: find the points where $f''$ is zero or does not exist, read the sign of $f''$ at one point between each pair, and call a candidate an inflection point when the sign changes.** SymPy does it exactly with `sp.solve_univariate_inequality(d2f > 0, x, relational=False)` and the same with `< 0`; the Second Derivative Test is one substitution, `d2f.subs(x, c)`. Without a CAS, take midpoints, which is what the JavaScript and C++ programs do. For a numerical $f$ the second derivative is itself approximated by $\frac{f(c+h)-2f(c)+f(c-h)}{h^2}$, which needs a moderate $h$ because the numerator is a difference of nearly equal numbers. ```python import sympy as sp x = sp.symbols('x', real=True) def concavity_report(f): """Where the graph of f is concave up and down, its inflection points, and the Second Derivative Test.""" df, d2f = sp.diff(f, x), sp.diff(f, x, 2) up = sp.solve_univariate_inequality(d2f > 0, x, relational=False) down = sp.solve_univariate_inequality(d2f < 0, x, relational=False) eps = sp.Rational(1, 10**6) inflections = [(c, f.subs(x, c)) for c in sorted(sp.solveset(sp.Eq(d2f, 0), x, sp.S.Reals), key=float) if (up.contains(c - eps) and down.contains(c + eps)) or (down.contains(c - eps) and up.contains(c + eps))] second = {} for c in sorted(sp.solveset(sp.Eq(df, 0), x, sp.S.Reals), key=float): k = d2f.subs(x, c) second[c] = 'min' if k > 0 else 'max' if k < 0 else 'fails' return up, down, inflections, second for f in (x**4 - 4 * x**3 + 10, (x + 1)**2 / (1 + x**2), x**3): print(f, '->', concavity_report(f)) # x**4 - 4*x**3 + 10 -> (Union(Interval.open(-oo, 0), Interval.open(2, oo)), Interval.open(0, 2), [(0, 10), (2, -6)], {0: 'fails', 3: 'min'}) # (x + 1)**2/(x**2 + 1) -> (Union(Interval.open(-sqrt(3), 0), Interval.open(sqrt(3), oo)), Union(Interval.open(-oo, -sqrt(3)), Interval.open(0, sqrt(3))), [(-sqrt(3), (1 - sqrt(3))**2/4), (0, 1), (sqrt(3), (1 + sqrt(3))**2/4)], {-1: 'min', 1: 'max'}) # x**3 -> (Interval.open(0, oo), Interval.open(-oo, 0), [(0, 0)], {0: 'fails'}) ``` ```javascript // concavity between the candidates, and the verdict at each candidate: an inflection point when the bending changes const bendChart = (d2, candidates, lo, hi) => { const edges = [lo, ...candidates, hi] const pieces = edges.slice(1).map((to, i) => [edges[i], to, d2((edges[i] + to) / 2) > 0 ? 'up' : 'down']) const inflections = candidates.filter((c, i) => pieces[i][2] !== pieces[i + 1][2]) return { pieces, inflections } } // the Second Derivative Test at c, given f' and f'' as functions const secondTest = (df, d2, c) => { if (Math.abs(df(c)) > 1e-9) return 'not critical' const k = d2(c) return Math.abs(k) < 1e-9 ? 'fails' : k > 0 ? 'min' : 'max' } const d2 = (x) => 12 * x * x - 24 * x // f(x) = x^4 - 4x^3 + 10 bendChart(d2, [0, 2], -2, 5) // pieces [[-2,0,'up'], [0,2,'down'], [2,5,'up']] inflections [0, 2] const df = (x) => 4 * x ** 3 - 12 * x ** 2 secondTest(df, d2, 0) // 'fails': f'(0) = f''(0) = 0 (the First Derivative Test: no extreme value) secondTest(df, d2, 3) // 'min': f''(3) = 36 > 0 bendChart((x) => 12 * x * x, [0], -2, 2) // x^4: pieces [[-2,0,'up'], [0,2,'up']] inflections []: f'' = 0 at 0 but no inflection ``` ```cpp #include #include #include using namespace std; double d2(double x) { return 12 * x * x - 24 * x; } // f(x) = x^4 - 4x^3 + 10, f'' = 12x(x - 2) double d1(double x) { return 4 * x * x * x - 12 * x * x; } int main() { double edge[4]; edge[0] = -2; edge[1] = 0; edge[2] = 2; edge[3] = 5; // the ends and the places where f'' is zero int sign[3]; for (int i = 0; i < 3; i++) { double mid = (edge[i] + edge[i + 1]) / 2; // one test point in each interval sign[i] = d2(mid) > 0 ? 1 : -1; if (sign[i] > 0) printf("from %.1f to %.1f; f'' at %.2f is %.2f; concave up\n", edge[i], edge[i + 1], mid, d2(mid)); else printf("from %.1f to %.1f; f'' at %.2f is %.2f; concave down\n", edge[i], edge[i + 1], mid, d2(mid)); } for (int i = 0; i < 2; i++) // an inflection point where the bending changes if (sign[i] != sign[i + 1]) printf("x=%.1f inflection point\n", edge[i + 1]); else printf("x=%.1f no inflection point\n", edge[i + 1]); double crit[2]; crit[0] = 0; crit[1] = 3; // the zeros of f' for (int i = 0; i < 2; i++) { // the Second Derivative Test double k = d2(crit[i]); if (fabs(k) < 1e-9) printf("x=%.1f; f''=%.2f; the test fails\n", crit[i], k); else if (k > 0) printf("x=%.1f; f''=%.2f; local minimum\n", crit[i], k); else printf("x=%.1f; f''=%.2f; local maximum\n", crit[i], k); } return 0; } /* output: from -2.0 to 0.0; f'' at -1.00 is 36.00; concave up from 0.0 to 2.0; f'' at 1.00 is -12.00; concave down from 2.0 to 5.0; f'' at 3.50 is 63.00; concave up x=0.0 inflection point x=2.0 inflection point x=0.0; f''=0.00; the test fails x=3.0; f''=36.00; local minimum */ ``` ## Where do inflection points and curve sketching come from? **Studying the shape of a curve with derivatives began with the first rules of calculus and became a routine procedure by the 18th century.** - **Leibniz, 1684.** In his first paper on the differential calculus, Gottfried Wilhelm Leibniz used the second differential to tell a maximum from a minimum, and noted that the second differential vanishes at an inflection point. - **l'Hôpital, 1696.** Guillaume de l'Hôpital's textbook Analyse des infiniment petits, the first on the differential calculus, applies the method to find points of inflection and cusps of curves given by equations. - **Maclaurin, 1742.** Colin Maclaurin's Treatise of Fluxions organised the tests for maxima, minima and inflection from the signs of the first and second fluxions, in the form still taught. - **Euler, 1748.** Leonhard Euler's Introductio in analysin infinitorum studies curves by their asymptotes and branches, the part of the procedure that comes from algebra rather than from derivatives. - **Today.** Graphing software draws the curve point by point; the sketching steps are still how one checks that a plot shows every extreme, every inflection and every asymptote. ## What mistakes do people make with concavity? **The most common mistakes with concavity and curve sketching are the nine below, each with the correct statement.** | Mistake | Correct | |---|---| | ❌ If $f''(c)=0$, there is an inflection point | $y=x^4$ has $y''(0)=0$ and is concave up on both sides: the sign must change. | | ❌ At an inflection point $f''=0$ | $f''$ may not exist: $x^{5/3}$ and $\sqrt[3]{x}$ have inflection points at $0$ where $f''$ is undefined. | | ❌ Concave up means increasing | $x^2$ is concave up and decreasing for $x<0$: concavity is about $f'$ rising, not about $f$. | | ❌ $f''>0$ means $f>0$ | $f(x)=x^2-4$ has $f''=2>0$ and $f(0)=-4$. | | ❌ If $f''(c)=0$ the Second Derivative Test says no extreme value | It says nothing: $x^4$ has a minimum, $-x^4$ a maximum and $x^3$ neither, all with $f''(0)=0$. | | ❌ The test works where $f''$ does not exist | $x^{2/3}$ has a minimum at its cusp, but the test cannot be applied: use the First Derivative Test. | | ❌ $\frac1x$ changes concavity at $0$, so $(0,0)$ is an inflection point | $0$ is not in the domain: there is no point of the graph there. | | ❌ Find inflection points from $f'=0$ | $f'=0$ gives the critical points; inflection points come from $f''$. | | ❌ A graph can never cross its asymptote | $f(x)=\frac{(x+1)^2}{1+x^2}$ meets its asymptote $y=1$ at $x=0$ and still approaches it at both ends. | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: concavity and curve sketching at a glance - **Concavity:** concave up where $f'$ increases ($f''>0$), concave down where $f'$ decreases ($f''<0$). - **Point of inflection:** a point with a tangent line where the concavity changes; $f''=0$ or does not exist there, but a zero of $f''$ alone is not enough. - **Cases:** $x^3$ yes, $x^4$ no, $x^{5/3}$ and $\sqrt[3]{x}$ yes (with $f''$ undefined), $x^{2/3}$ no (a cusp). - **Motion:** $a=s''$; speeding up when $v$ and $a$ agree in sign, slowing down when they differ. - **Second Derivative Test:** $f'(c)=0$ and $f''(c)<0$ is a maximum, $f''(c)>0$ a minimum, $f''(c)=0$ fails; then use the First Derivative Test. - **Curve sketching:** domain and symmetry, $f'$ and $f''$, critical points, rising and falling, inflection and concavity, asymptotes, key points. - **Asymptotes:** vertical where $f\to\pm\infty$, horizontal and oblique from the ends; a graph can cross one. - **Cubics:** exactly one inflection point, at $x=-\frac b{3a}$; parabolas have none. - **Code:** `sp.solve_univariate_inequality(d2f > 0, x, relational=False)` and `d2f.subs(x, c)`. ## Glossary: key terms - **Concave up**: A graph is concave up on an interval where its slope is increasing, which is where the second derivative is positive; it bends like a cup and lies above its tangent lines. - **Concave down**: A graph is concave down on an interval where its slope is decreasing, which is where the second derivative is negative; it bends like a cap and lies below its tangent lines. - **Point of inflection**: A point of a graph that has a tangent line and where the concavity changes from up to down or from down to up. - **Second Derivative Test**: The test that classifies a critical point by the sign of the second derivative there: negative is a local maximum, positive a local minimum, zero is inconclusive. - **Asymptote**: A line that the graph of a function approaches without bound: vertical where the function blows up, horizontal or oblique at the ends of the x-axis. - **Curve sketching**: Drawing the graph of a function from its domain, symmetry, first and second derivatives, critical points, inflection points, asymptotes and a few key points. ## Frequently asked questions ### What does concave up mean? A graph is concave up on an interval when its slope is increasing there, so it bends like a cup and lies above its tangent lines. For a twice-differentiable function this is the same as the second derivative being positive on the interval. ### What is a point of inflection? It is a point of a graph that has a tangent line and where the concavity changes, so the graph crosses its own tangent. There the second derivative is zero or does not exist, but those two facts alone do not guarantee it. ### Does a zero second derivative always mean an inflection point? No. The second derivative must also change sign. The function x to the fourth has a second derivative equal to 0 at x equal to 0, but it is concave up on both sides, so there is no inflection point there. ### Can an inflection point occur where the second derivative does not exist? Yes, if the graph has a tangent line there and the concavity changes. The functions x to the five thirds and the cube root of x have inflection points at 0 even though the second derivative is undefined there; a cusp has none. ### What is the Second Derivative Test? If the first derivative is zero at a point, the sign of the second derivative there classifies it: negative is a local maximum and positive is a local minimum. If the second derivative is zero, the test says nothing and the First Derivative Test is used. ### What are the steps to sketch a curve? Find the domain and symmetry, the first and second derivatives, the critical points and their type, where the function rises and falls, the inflection points and concavity, and the asymptotes. Then plot the intercepts and special points and draw the curve. ### How does the second derivative describe motion? The second derivative of position is acceleration. A particle speeds up when its velocity and acceleration have the same sign and slows down when they have opposite signs. Inflection points of the position graph mark where the acceleration changes sign. ### Can a graph cross its asymptote? A horizontal or oblique asymptote describes what the graph does at the far ends, so it can cross the line at finite values of x. The function with numerator x plus 1 squared over 1 plus x squared meets its asymptote y equals 1 at x equals 0. --- # Kecekungan dan Penggambaran Kurva Source: https://nunada.my.id/artikel/kecekungan-dan-penggambaran-kurva/ Updated: 2026-10-22 ## Jawaban singkat **Grafik $f$ cekung ke atas di tempat $f'$ naik, yaitu tempat $f''>0$, dan cekung ke bawah di tempat $f'$ turun, tempat $f''<0$; titik tempat kecekungan berubah dan grafik memiliki garis singgung adalah titik belok.** Uji Turunan Kedua memakai tanda yang sama di titik kritis, $f'=0$: $f''>0$ adalah minimum lokal dan $f''<0$ maksimum lokal. Bersama $f'$ dan asimtot, $f''$ memberi bentuk grafik. ### Poin penting - Grafik $f$ yang terdiferensialkan cekung ke atas pada selang terbuka jika $f'$ naik di sana dan cekung ke bawah jika $f'$ turun; jika $f''>0$ di seluruh selang grafik cekung ke atas, dan jika $f''<0$ cekung ke bawah. - Titik belok adalah titik pada grafik yang memiliki garis singgung dan tempat kecekungan berubah; di sana $f''=0$ atau $f''$ tidak ada, tetapi kebalikannya salah: $f''(0)=0$ untuk $x^4$ dan tidak ada titik belok. - Titik belok dapat berada di tempat $f''$ tidak ada: $x^{5/3}$ pada garis singgung mendatar dan $\sqrt[3]{x}$ pada garis singgung tegak, sedangkan $x^{2/3}$ memiliki titik puncak, tanpa garis singgung dan tanpa titik belok. - Uji Turunan Kedua: jika $f'(c)=0$ dan $f''(c)<0$ ada maksimum lokal, jika $f''(c)>0$ minimum lokal, dan jika $f''(c)=0$ ujinya gagal, seperti ditunjukkan $x^4$, $-x^4$, dan $x^3$. - Untuk partikel $a=s''$: bertambah cepat ketika kecepatan dan percepatan bertanda sama dan melambat ketika berbeda; titik belok posisi adalah tempat percepatan berganti tanda. - Penggambaran kurva mengikuti tujuh langkah: domain dan simetri, $f'$ dan $f''$, titik kritis, naik dan turun, titik belok dan kecekungan, asimtot, titik penting. ## Apa itu kecekungan? **Grafik fungsi terdiferensialkan $y=f(x)$ cekung ke atas pada selang terbuka $I$ jika $f'$ naik pada $I$, dan cekung ke bawah pada $I$ jika $f'$ turun pada $I$.** Fungsi yang grafiknya cekung ke atas juga sering disebut konveks. Gambarannya adalah bagaimana kurva berbelok. Sepanjang $y=x^3$ yang mendekati titik asal dari kiri, kurva berbelok ke kanan dan jatuh di bawah garis singgungnya, dan gradien garis singgung itu mengecil: cekung ke bawah. Menjauhi titik asal ke kanan, kurva berbelok ke kiri dan naik di atas garis singgungnya, dan gradiennya membesar: cekung ke atas. Karena $f'$ adalah fungsi tersendiri, [fungsi monoton](https://nunada.my.id/artikel/fungsi-monoton-dan-uji-turunan-pertama/#derivative-sign) dari artikel sebelumnya berlaku padanya: $f'$ naik di tempat turunannya sendiri $f''$ positif, dan turun di tempat $f''$ negatif. **Uji Turunan Kedua untuk kecekungan.** Misalkan $y=f(x)$ terdiferensialkan dua kali pada selang $I$. 1. Jika $f''>0$ pada $I$, grafik $f$ pada $I$ cekung ke atas. 2. Jika $f''<0$ pada $I$, grafik $f$ pada $I$ cekung ke bawah. Kita menulis $f''$ atau $y''$ untuk turunan kedua. Kecekungan bukan naik atau turun: grafik cekung ke atas dapat naik, turun, atau keduanya, seperti $x^2$, sedangkan yang tidak dapat dilakukannya adalah bergelombang. **Contoh 1.** (a) Kurva $y=x^3$ memiliki $y''=6x$, negatif untuk $x<0$ dan positif untuk $x>0$, sehingga cekung ke bawah pada $(-\infty,0)$ dan cekung ke atas pada $(0,\infty)$. (b) Kurva $y=x^2$ memiliki $y''=2>0$ di mana-mana, sehingga cekung ke atas pada seluruh garis. **Contoh 2.** Tentukan kecekungan $y=3+\sin x$ pada $0\le x\le2\pi$. Di sini $y'=\cos x$ dan $y''=-\sin x$, yang negatif pada $(0,\pi)$ dan positif pada $(\pi,2\pi)$. Grafiknya cekung ke bawah pada $(0,\pi)$ dan cekung ke atas pada $(\pi,2\pi)$. Ketik fungsi dan jendela di bawah, atau pilih contoh. Grafiknya gelap saat cekung ke atas dan oranye saat cekung ke bawah, dan grafik $f''$ menunjukkan sebabnya. ## Apa itu titik belok? **Titik $(c,f(c))$ tempat grafik fungsi memiliki garis singgung dan tempat kecekungan berubah adalah titik belok.** Di titik seperti itu grafik memotong garis singgungnya sendiri. Pada Contoh 2 kurva $y=3+\sin x$ mengubah kecekungan di $(\pi,3)$, tempat garis singgung bergradien $y'(\pi)=\cos\pi=-1$. Karena garis singgung ada, maka $f'(c)$ ada (terhingga), atau grafik memiliki garis singgung tegak di sana. Pada garis singgung tegak $f'$ maupun $f''$ tidak ada. Jadi di titik belok salah satu dari dua hal terjadi: **$f''(c)=0$ atau $f''(c)$ tidak ada.** Ketika $f''$ kontinu, yang pertama mengikuti dari Teorema Nilai Antara, karena $f''$ berganti tanda. Syarat ini perlu dan tidak cukup: $f''=0$ atau tidak ada hanya menandai kandidat, dan tandanya harus berganti. **Contoh 3.** Tentukan kecekungan dan titik belok $f(x)=x^3-3x^2+2$. Di sini $f'(x)=3x^2-6x$ dan $f''(x)=6x-6$, yang negatif untuk $x<1$, nol di $x=1$, dan positif untuk $x>1$. Grafiknya cekung ke bawah pada $(-\infty,1)$, cekung ke atas pada $(1,\infty)$, dan memiliki titik belok $(1,0)$. **Contoh 4: $f''$ tidak ada.** Grafik $f(x)=x^{5/3}$ memiliki garis singgung mendatar di titik asal, karena $f'(x)=\frac53x^{2/3}=0$ di $x=0$. Turunan kedua $f''(x)=\frac{10}9x^{-1/3}$ tidak ada di $0$, tetapi negatif untuk $x<0$ dan positif untuk $x>0$, sehingga berganti tanda: titik belok di titik asal. **Contoh 5: $f''=0$ dan bukan titik belok.** Kurva $y=x^4$ memiliki $y''=12x^2$, yang $0$ di $x=0$ tetapi tidak berganti tanda: kurva cekung ke atas di mana-mana. **Contoh 6: garis singgung tegak.** Grafik $y=x^{1/3}$ memiliki titik belok di titik asal karena $y''=-\frac29x^{-5/3}$ positif untuk $x<0$ dan negatif untuk $x>0$. Tetapi $y'=\frac13x^{-2/3}$ dan $y''$ keduanya tidak ada di $0$, dan ada garis singgung tegak. **Peringatan.** Ketika turunan kedua tidak ada di $c$, titik belok mungkin ada dan mungkin tidak. $x^{2/3}$ tidak memiliki turunan kedua di $0$ dan bukan titik belok: turunan keduanya $-\frac29x^{-4/3}$ negatif di kedua sisi, dan grafiknya memiliki titik puncak, tanpa garis singgung sama sekali. Kasus lain: $f(x)=x|x|$ memiliki $f'(x)=2|x|$, yang ada di $0$, walaupun $f''=2\,\text{sign}\,x$ tidak, dan itu titik belok. Di tempat seperti itu grafik dapat memiliki garis singgung tegak, sudut, titik puncak, atau putus, jadi baca tanda $f''$ di kedua sisi dan tanyakan apakah ada garis singgung. Pilih masing-masing kasus di bawah untuk melihat tanda, garis singgung, dan putusannya. ## Apa kata turunan kedua tentang gerak? **Untuk partikel dengan posisi $s(t)$ percepatannya $a=s''$, dan titik belok grafik posisi adalah tempat percepatan berganti tanda.** Bersama [gerak sepanjang garis](https://nunada.my.id/artikel/turunan-sebagai-laju-perubahan/#motion-along-a-line) di artikel laju perubahan, kecepatan $v=s'$ menyatakan ke arah mana partikel bergerak, dan tanda $a$ terhadap tanda $v$ menyatakan apakah ia bertambah cepat atau melambat: bertambah cepat ketika $v$ dan $a$ bertanda sama, dan melambat ketika bertanda berlawanan. **Contoh 7.** Sebuah partikel bergerak sepanjang garis koordinat mendatar (positif ke kanan) dengan posisi $s(t)=2t^3-14t^2+22t-5$ untuk $t\ge0$. Kecepatannya $$v(t)=s'(t)=6t^2-28t+22$$ $$v(t)=2(t-1)(3t-11)$$ dan percepatannya $$a(t)=s''(t)=12t-28=4(3t-7).$$ Kecepatan nol di $t=1$ dan $t=\frac{11}3$, dan percepatan di $t=\frac73$. Menggabungkan tanda-tandanya: | Waktu | $v$ | $a$ | Gerak | |---|---|---|---| | $0\le t<1$ | $+$ | $-$ | ke kanan, melambat | | $1\frac{11}3$ | $+$ | $+$ | ke kanan, bertambah cepat | Partikel mulai bergerak ke kanan sementara percepatan ke kiri memperlambatnya, berbalik di $t=1$ dan bertambah cepat ke kiri. Di $t=\frac73$ percepatan berubah arah, yaitu titik belok grafik posisi, tetapi partikel tetap bergerak ke kiri, kini melambat. Di $t=\frac{11}3$ ia berbalik lagi dan, bergerak searah percepatan, bertambah cepat ke kanan. ## Apa itu Uji Turunan Kedua untuk ekstrem lokal? **Alih-alih mencari pergantian tanda $f'$ di titik kritis, kadang kita dapat membaca kecekungan di sana: grafik yang cekung ke bawah di titik tempat garis singgung mendatar berada di puncak bukit, dan yang cekung ke atas berada di dasar lembah.** **Uji Turunan Kedua untuk ekstrem lokal.** Misalkan $f''$ kontinu pada selang terbuka yang memuat $x=c$. 1. Jika $f'(c)=0$ dan $f''(c)<0$, maka $f$ memiliki maksimum lokal di $x=c$. 2. Jika $f'(c)=0$ dan $f''(c)>0$, maka $f$ memiliki minimum lokal di $x=c$. 3. Jika $f'(c)=0$ dan $f''(c)=0$, maka ujinya gagal: $f$ mungkin memiliki maksimum lokal, minimum lokal, atau tidak keduanya. Bukti bagian 1. Jika $f''(c)<0$ maka $f''<0$ pada suatu selang terbuka $I$ di sekitar $c$, karena $f''$ kontinu. Jadi $f'$ turun pada $I$. Karena $f'(c)=0$, tanda $f'$ berubah dari positif ke negatif di $c$, dan $f$ memiliki maksimum lokal di $c$ menurut [Uji Turunan Pertama](https://nunada.my.id/artikel/fungsi-monoton-dan-uji-turunan-pertama/#first-derivative-test). Bagian 2 serupa. ∎ Bagian 3. Ambil $y=x^4$, $y=-x^4$, dan $y=x^3$. Pada masing-masingnya turunan pertama dan kedua nol di $x=0$. Namun $x^4$ memiliki minimum lokal di sana, $-x^4$ memiliki maksimum lokal, dan $x^3$ naik pada setiap selang terbuka di sekitar $0$ dan tidak memiliki keduanya. Uji ini tidak dapat membedakannya. Uji ini memerlukan $f''$ hanya di $c$ sendiri, yang membuatnya mudah diterapkan: satu bilangan menjawab pertanyaan. Harganya adalah ujinya tidak meyakinkan ketika $f''(c)=0$ atau ketika $f''$ tidak ada di $c$ (seperti $x^{2/3}$ di titik puncaknya); maka dipakai Uji Turunan Pertama. Pilih satu kasus di bawah dan baca kedua uji berdampingan. ## Bagaimana menggambar grafik suatu fungsi? **Untuk menggambar $y=f(x)$, kumpulkan apa yang dikatakan $f$, $f'$, dan $f''$ dan gabungkan: di mana grafik naik dan turun, bagaimana ia melengkung, di mana ia berbalik, dan apa yang didekatinya.** **Prosedur menggambar $y=f(x)$.** 1. Tentukan domain $f$ dan simetri yang mungkin dimiliki kurva. 2. Cari turunan $y'$ dan $y''$. 3. Cari titik kritis $f$, jika ada, dan tentukan perilaku $f$ di masing-masingnya. 4. Cari di mana kurva naik dan di mana turun. 5. Cari titik belok, jika ada, dan tentukan kecekungan kurva. 6. Tentukan asimtot yang mungkin ada. 7. Gambar titik penting, seperti perpotongan dan titik-titik dari langkah 3 sampai 5, dan sketsakan kurva bersama asimtotnya. **Asimtot.** Garis $x=a$ adalah asimtot tegak jika $f(x)\to\pm\infty$ ketika $x\to a$ dari satu sisi atau kedua sisi, yang untuk fungsi rasional terjadi di tempat penyebut nol dan pembilang tidak. Garis $y=L$ adalah asimtot mendatar jika $f(x)\to L$ ketika $x\to\infty$ atau $x\to-\infty$. Asimtot miring $y=mx+b$ muncul ketika $f(x)-(mx+b)\to0$; untuk fungsi rasional itu adalah sisa pembagian panjang ketika pembilang berderajat satu lebih tinggi daripada penyebut. Grafik boleh memotong asimtot mendatar atau miring di nilai $x$ terhingga; yang dilakukannya adalah mendekatinya di ujung. **Contoh 8.** Gambarlah $f(x)=x^4-4x^3+10$. Fungsi ini kontinu dengan domain seluruh garis. Turunan $f'(x)=4x^3-12x^2=4x^2(x-3)$ nol di $x=0$ dan $x=3$, dengan tanda $-,-,+$: jadi $f$ turun pada $(-\infty,3]$ dan naik pada $[3,\infty)$, tidak ada nilai ekstrem di $0$ dan ada minimum lokal $f(3)=-17$ di $3$. Turunan kedua $f''(x)=12x^2-24x=12x(x-2)$ nol di $0$ dan $2$, dengan tanda $+,-,+$: grafik cekung ke atas pada $(-\infty,0)$, cekung ke bawah pada $(0,2)$, dan cekung ke atas pada $(2,\infty)$, dengan titik belok $(0,10)$ dan $(2,-6)$. Kurva memotong sumbu $y$ di $10$. Perhatikan bahwa $x=0$ adalah titik kritis dan titik belok, tempat kurva mendatar sambil tetap turun. Sekarang coba prosedur ini pada fungsi apa pun di bawah, atau pada lima contoh grafik di buku. Alatnya mengikuti tujuh langkah dan menggambar hasilnya: gelap saat $f$ naik, oranye saat turun, titik oranye di ekstrem lokal, titik hitam di titik belok, dan garis putus-putus untuk asimtot. ## Seperti apa sketsa fungsi rasional, eksponensial, dan trigonometri? **Empat grafik lagi menunjukkan langkah-langkahnya dengan asimtot, putus, simetri, dan suku trigonometri.** **Contoh 9: $f(x)=\frac{(x+1)^2}{1+x^2}$.** Domainnya seluruh garis, tanpa simetri. Karena $f(x)=1+\frac{2x}{1+x^2}$, $$f'(x)=\frac{2(1-x^2)}{(1+x^2)^2}\qquad f''(x)=\frac{4x(x^2-3)}{(1+x^2)^3}.$$ Titik kritisnya $x=\pm1$. Karena $f''(-1)=1>0$ ada minimum lokal $f(-1)=0$, dan karena $f''(1)=-1<0$ ada maksimum lokal $f(1)=2$. Tanda $f'$ adalah $-,+,-$, sehingga $f$ turun, naik, lalu turun lagi. Penyebut $f''$ selalu positif, dan pembilangnya nol di $-\sqrt3$, $0$, dan $\sqrt3$ dengan tanda $-,+,-,+$: masing-masing titik belok, $\left(-\sqrt3,1-\frac{\sqrt3}2\right)$, $(0,1)$, dan $\left(\sqrt3,1+\frac{\sqrt3}2\right)$, dengan grafik cekung ke bawah, atas, bawah, atas. Membagi dengan $x^2$ menunjukkan $f(x)\to1$ ketika $x\to\pm\infty$: garis $y=1$ adalah asimtot mendatar, dan tidak ada asimtot tegak. Grafik menemui asimtotnya di $x=0$ dan mendekatinya dari bawah di kiri, cekung ke bawah, dan dari atas di kanan, cekung ke atas. **Contoh 10: $f(x)=\frac{x^2+4}{2x}=\frac x2+\frac2x$.** Domainnya $x\neq0$, tidak ada perpotongan, dan $f(-x)=-f(x)$: fungsi ganjil, simetris terhadap titik asal. Turunannya $$f'(x)=\frac12-\frac2{x^2}=\frac{x^2-4}{2x^2}\qquad f''(x)=\frac4{x^3}.$$ Titik kritis $x=\pm2$ memberi maksimum lokal $f(-2)=-2$ dan minimum lokal $f(2)=2$, dari tanda $f''$. Fungsi naik pada $(-\infty,-2)$, turun pada $(-2,0)$ dan $(0,2)$, dan naik pada $(2,\infty)$. Turunan kedua negatif untuk $x<0$ dan positif untuk $x>0$ dan tidak pernah nol, sehingga tidak ada titik belok. Karena $\frac2x\to\pm\infty$ ketika $x\to0^\pm$, sumbu $y$ adalah asimtot tegak, dan karena $f(x)-\frac x2=\frac2x\to0$ di kedua ujung, $y=\frac x2$ adalah asimtot miring. **Contoh 11: $f(x)=e^{2/x}$.** Domainnya $x\neq0$ dan tidak ada simetri. Turunannya $$f'(x)=-\frac{2e^{2/x}}{x^2}\qquad f''(x)=\frac{4(x+1)e^{2/x}}{x^4}.$$ Karena $f'<0$ di seluruh domain, grafik turun pada $(-\infty,0)$ dan pada $(0,\infty)$. Turunan kedua bertanda sama dengan $x+1$, sehingga berganti tanda di $x=-1$: titik $\left(-1,e^{-2}\right)$ adalah titik belok, cekung ke bawah di kirinya dan cekung ke atas setelahnya. Ketika $x\to0^+$, $\frac2x\to\infty$ dan $f\to\infty$: sumbu $y$ adalah asimtot tegak. Dari kiri $f\to0$. Ketika $x\to\pm\infty$, $\frac2x\to0$ dan $f\to1$, sehingga $y=1$ adalah asimtot mendatar. $f$ tidak pernah $0$, dan tidak memiliki ekstrem mutlak. **Contoh 12: $f(x)=\cos x-\frac{\sqrt2}2x$ pada $0\le x\le2\pi$.** Di sini $f'(x)=-\sin x-\frac{\sqrt2}2$ nol di tempat $\sin x=-\frac{\sqrt2}2$, yaitu $x=\frac{5\pi}4$ dan $x=\frac{7\pi}4$. Karena $f''(x)=-\cos x$, $f''\left(\frac{5\pi}4\right)=\frac{\sqrt2}2>0$ memberi minimum lokal $f\left(\frac{5\pi}4\right)\approx-3{,}48$, dan $f''\left(\frac{7\pi}4\right)=-\frac{\sqrt2}2<0$ maksimum lokal $f\left(\frac{7\pi}4\right)\approx-3{,}18$. Turunan kedua nol di $\frac\pi2$ dan $\frac{3\pi}2$ dan berganti tanda di sana: titik belok $\left(\frac\pi2,-1{,}11\right)$ dan $\left(\frac{3\pi}2,-3{,}33\right)$. Di ujung $f(0)=1$ dan $f(2\pi)\approx-3{,}44$, sehingga pada selang tertutup ini maksimum mutlaknya $f(0)=1$ dan minimum mutlaknya $f\left(\frac{5\pi}4\right)\approx-3{,}48$. ## Bagaimana f, f′, dan f″ saling melengkapi, dan apa yang dapat diputuskannya? **Turunan pertama menyatakan di mana grafik naik dan turun dan di mana ia berbalik; turunan kedua menyatakan bagaimana ia melengkung; dan bersama asimtot dan beberapa titik keduanya menetapkan gambarnya.** Tandanya bergabung seperti ini: | Yang diketahui | Yang dilakukan grafik | |---|---| | $f'>0$ | naik dari kiri ke kanan | | $f'<0$ | turun dari kiri ke kanan | | $f''>0$ | cekung ke atas di seluruhnya, tanpa gelombang | | $f''<0$ | cekung ke bawah di seluruhnya, tanpa gelombang | | $f''$ berganti tanda di titik yang memiliki garis singgung | titik belok | | $f'$ berganti tanda | maksimum lokal atau minimum lokal | | $f'=0$ dan $f''<0$ | maksimum lokal | | $f'=0$ dan $f''>0$ | minimum lokal | Fakta yang sama menjawab pertanyaan tentang konstanta dalam rumus. **Kuadrat dan kubik.** Untuk parabola $y=ax^2+bx+c$ dengan $a\neq0$, $y'=2ax+b$ nol di $x=-\frac b{2a}$, puncaknya, dan $y''=2a$ tidak pernah berganti tanda: cekung ke atas jika $a>0$, ke bawah jika $a<0$, dan kurva kuadrat tidak pernah memiliki titik belok. Untuk kubik $y=ax^3+bx^2+cx+d$, $y''=6ax+2b$ nol di tepat satu titik, $x=-\frac b{3a}$, dan berganti tanda di sana: setiap kubik memiliki tepat satu titik belok. Jika titik itu harus di $x=1$ untuk $y=x^3+bx^2+cx+d$, maka $6+2b=0$ dan $b=-3$. **Mencari konstanta.** Untuk $a$, $b$, $c$ berapa $y=ax^3+bx^2+cx$ memiliki maksimum lokal di $x=3$, minimum lokal di $x=-1$, dan titik belok di $(1,11)$? Titik belok di $x=1$ memerlukan $y''(1)=6a+2b=0$, sehingga $b=-3a$. Maka $y'=3ax^2+2bx+c$ dengan $y'(3)=27a+6b+c=0$ memberi $c=-9a$, dan $y'(-1)=3a-2b+c=0$ berlaku dengan sendirinya. Titik $(1,11)$ memerlukan $a+b+c=-11a=11$, sehingga $a=-1$, $b=3$, $c=9$, dan $y=-x^3+3x^2+9x$. Periksa: $y''=-6x+6$ adalah $-12<0$ di $3$ (maksimum $y(3)=27$) dan $12>0$ di $-1$ (minimum $y(-1)=-5$). **Hanya diberi $f''$.** Jika $y''=(x+1)(x-2)$, tanda $y''$ adalah $+,-,+$ dengan perubahan di $x=-1$ dan $x=2$: itulah titik belok, tanpa perlu mengetahui $f$. ## Bagaimana mencari kecekungan dan titik belok dalam kode? **Dalam kode, kecekungan adalah uji tanda yang sama seperti sebelumnya, satu turunan lebih tinggi: cari titik tempat $f''$ nol atau tidak ada, baca tanda $f''$ di satu titik di antara tiap pasangan, dan sebut kandidat titik belok ketika tandanya berganti.** SymPy melakukannya secara eksak dengan `sp.solve_univariate_inequality(d2f > 0, x, relational=False)` dan yang sama dengan `< 0`; Uji Turunan Kedua adalah satu substitusi, `d2f.subs(x, c)`. Tanpa CAS, ambil titik tengah, yang dilakukan program JavaScript dan C++. Untuk $f$ numerik turunan kedua sendiri didekati oleh $\frac{f(c+h)-2f(c)+f(c-h)}{h^2}$, yang memerlukan $h$ sedang karena pembilangnya selisih bilangan yang hampir sama. ```python import sympy as sp x = sp.symbols('x', real=True) def concavity_report(f): """Where the graph of f is concave up and down, its inflection points, and the Second Derivative Test.""" df, d2f = sp.diff(f, x), sp.diff(f, x, 2) up = sp.solve_univariate_inequality(d2f > 0, x, relational=False) down = sp.solve_univariate_inequality(d2f < 0, x, relational=False) eps = sp.Rational(1, 10**6) inflections = [(c, f.subs(x, c)) for c in sorted(sp.solveset(sp.Eq(d2f, 0), x, sp.S.Reals), key=float) if (up.contains(c - eps) and down.contains(c + eps)) or (down.contains(c - eps) and up.contains(c + eps))] second = {} for c in sorted(sp.solveset(sp.Eq(df, 0), x, sp.S.Reals), key=float): k = d2f.subs(x, c) second[c] = 'min' if k > 0 else 'max' if k < 0 else 'fails' return up, down, inflections, second for f in (x**4 - 4 * x**3 + 10, (x + 1)**2 / (1 + x**2), x**3): print(f, '->', concavity_report(f)) # x**4 - 4*x**3 + 10 -> (Union(Interval.open(-oo, 0), Interval.open(2, oo)), Interval.open(0, 2), [(0, 10), (2, -6)], {0: 'fails', 3: 'min'}) # (x + 1)**2/(x**2 + 1) -> (Union(Interval.open(-sqrt(3), 0), Interval.open(sqrt(3), oo)), Union(Interval.open(-oo, -sqrt(3)), Interval.open(0, sqrt(3))), [(-sqrt(3), (1 - sqrt(3))**2/4), (0, 1), (sqrt(3), (1 + sqrt(3))**2/4)], {-1: 'min', 1: 'max'}) # x**3 -> (Interval.open(0, oo), Interval.open(-oo, 0), [(0, 0)], {0: 'fails'}) ``` ```javascript // concavity between the candidates, and the verdict at each candidate: an inflection point when the bending changes const bendChart = (d2, candidates, lo, hi) => { const edges = [lo, ...candidates, hi] const pieces = edges.slice(1).map((to, i) => [edges[i], to, d2((edges[i] + to) / 2) > 0 ? 'up' : 'down']) const inflections = candidates.filter((c, i) => pieces[i][2] !== pieces[i + 1][2]) return { pieces, inflections } } // the Second Derivative Test at c, given f' and f'' as functions const secondTest = (df, d2, c) => { if (Math.abs(df(c)) > 1e-9) return 'not critical' const k = d2(c) return Math.abs(k) < 1e-9 ? 'fails' : k > 0 ? 'min' : 'max' } const d2 = (x) => 12 * x * x - 24 * x // f(x) = x^4 - 4x^3 + 10 bendChart(d2, [0, 2], -2, 5) // pieces [[-2,0,'up'], [0,2,'down'], [2,5,'up']] inflections [0, 2] const df = (x) => 4 * x ** 3 - 12 * x ** 2 secondTest(df, d2, 0) // 'fails': f'(0) = f''(0) = 0 (the First Derivative Test: no extreme value) secondTest(df, d2, 3) // 'min': f''(3) = 36 > 0 bendChart((x) => 12 * x * x, [0], -2, 2) // x^4: pieces [[-2,0,'up'], [0,2,'up']] inflections []: f'' = 0 at 0 but no inflection ``` ```cpp #include #include #include using namespace std; double d2(double x) { return 12 * x * x - 24 * x; } // f(x) = x^4 - 4x^3 + 10, f'' = 12x(x - 2) double d1(double x) { return 4 * x * x * x - 12 * x * x; } int main() { double edge[4]; edge[0] = -2; edge[1] = 0; edge[2] = 2; edge[3] = 5; // the ends and the places where f'' is zero int sign[3]; for (int i = 0; i < 3; i++) { double mid = (edge[i] + edge[i + 1]) / 2; // one test point in each interval sign[i] = d2(mid) > 0 ? 1 : -1; if (sign[i] > 0) printf("from %.1f to %.1f; f'' at %.2f is %.2f; concave up\n", edge[i], edge[i + 1], mid, d2(mid)); else printf("from %.1f to %.1f; f'' at %.2f is %.2f; concave down\n", edge[i], edge[i + 1], mid, d2(mid)); } for (int i = 0; i < 2; i++) // an inflection point where the bending changes if (sign[i] != sign[i + 1]) printf("x=%.1f inflection point\n", edge[i + 1]); else printf("x=%.1f no inflection point\n", edge[i + 1]); double crit[2]; crit[0] = 0; crit[1] = 3; // the zeros of f' for (int i = 0; i < 2; i++) { // the Second Derivative Test double k = d2(crit[i]); if (fabs(k) < 1e-9) printf("x=%.1f; f''=%.2f; the test fails\n", crit[i], k); else if (k > 0) printf("x=%.1f; f''=%.2f; local minimum\n", crit[i], k); else printf("x=%.1f; f''=%.2f; local maximum\n", crit[i], k); } return 0; } /* output: from -2.0 to 0.0; f'' at -1.00 is 36.00; concave up from 0.0 to 2.0; f'' at 1.00 is -12.00; concave down from 2.0 to 5.0; f'' at 3.50 is 63.00; concave up x=0.0 inflection point x=2.0 inflection point x=0.0; f''=0.00; the test fails x=3.0; f''=36.00; local minimum */ ``` ## Dari mana asal titik belok dan penggambaran kurva? **Mempelajari bentuk kurva dengan turunan dimulai bersama aturan pertama kalkulus dan menjadi prosedur rutin pada abad ke-18.** - **Leibniz, 1684.** Dalam makalah pertamanya tentang kalkulus diferensial, Gottfried Wilhelm Leibniz memakai diferensial kedua untuk membedakan maksimum dari minimum, dan mencatat bahwa diferensial kedua lenyap di titik belok. - **l'Hôpital, 1696.** Buku teks Guillaume de l'Hôpital Analyse des infiniment petits, yang pertama tentang kalkulus diferensial, menerapkan metode itu untuk mencari titik belok dan titik puncak kurva yang diberikan oleh persamaan. - **Maclaurin, 1742.** Treatise of Fluxions karya Colin Maclaurin menata uji maksimum, minimum, dan titik belok dari tanda fluksi pertama dan kedua, dalam bentuk yang masih diajarkan. - **Euler, 1748.** Introductio in analysin infinitorum karya Leonhard Euler mempelajari kurva lewat asimtot dan cabangnya, bagian prosedur yang berasal dari aljabar dan bukan dari turunan. - **Sekarang.** Perangkat lunak grafik menggambar kurva titik demi titik; langkah-langkah sketsa masih menjadi cara memeriksa bahwa suatu plot menunjukkan setiap ekstrem, setiap titik belok, dan setiap asimtot. ## Kesalahan apa yang sering terjadi pada kecekungan? **Kesalahan paling umum pada kecekungan dan penggambaran kurva adalah sembilan hal berikut, masing-masing dengan pernyataan yang benar.** | Kesalahan | Yang benar | |---|---| | ❌ Jika $f''(c)=0$, ada titik belok | $y=x^4$ memiliki $y''(0)=0$ dan cekung ke atas di kedua sisi: tandanya harus berganti. | | ❌ Di titik belok $f''=0$ | $f''$ mungkin tidak ada: $x^{5/3}$ dan $\sqrt[3]{x}$ memiliki titik belok di $0$ tempat $f''$ tak terdefinisi. | | ❌ Cekung ke atas berarti naik | $x^2$ cekung ke atas dan turun untuk $x<0$: kecekungan menyangkut $f'$ yang naik, bukan $f$. | | ❌ $f''>0$ berarti $f>0$ | $f(x)=x^2-4$ memiliki $f''=2>0$ dan $f(0)=-4$. | | ❌ Jika $f''(c)=0$ Uji Turunan Kedua menyatakan tidak ada nilai ekstrem | Ia tidak menyatakan apa pun: $x^4$ memiliki minimum, $-x^4$ maksimum, dan $x^3$ tidak keduanya, semuanya dengan $f''(0)=0$. | | ❌ Uji ini bekerja di tempat $f''$ tidak ada | $x^{2/3}$ memiliki minimum di titik puncaknya, tetapi uji tidak dapat diterapkan: pakai Uji Turunan Pertama. | | ❌ $\frac1x$ mengubah kecekungan di $0$, jadi $(0,0)$ titik belok | $0$ tidak berada di domain: tidak ada titik grafik di sana. | | ❌ Mencari titik belok dari $f'=0$ | $f'=0$ memberi titik kritis; titik belok berasal dari $f''$. | | ❌ Grafik tidak pernah memotong asimtotnya | $f(x)=\frac{(x+1)^2}{1+x^2}$ menemui asimtotnya $y=1$ di $x=0$ dan tetap mendekatinya di kedua ujung. | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: kecekungan dan penggambaran kurva sekilas - **Kecekungan:** cekung ke atas di tempat $f'$ naik ($f''>0$), cekung ke bawah di tempat $f'$ turun ($f''<0$). - **Titik belok:** titik yang memiliki garis singgung dan tempat kecekungan berubah; $f''=0$ atau tidak ada di sana, tetapi nol $f''$ saja belum cukup. - **Kasus:** $x^3$ ya, $x^4$ tidak, $x^{5/3}$ dan $\sqrt[3]{x}$ ya (dengan $f''$ tak terdefinisi), $x^{2/3}$ tidak (titik puncak). - **Gerak:** $a=s''$; bertambah cepat ketika $v$ dan $a$ bertanda sama, melambat ketika berbeda. - **Uji Turunan Kedua:** $f'(c)=0$ dan $f''(c)<0$ maksimum, $f''(c)>0$ minimum, $f''(c)=0$ gagal; lalu pakai Uji Turunan Pertama. - **Penggambaran kurva:** domain dan simetri, $f'$ dan $f''$, titik kritis, naik dan turun, titik belok dan kecekungan, asimtot, titik penting. - **Asimtot:** tegak di tempat $f\to\pm\infty$, mendatar dan miring dari ujung; grafik dapat memotong salah satunya. - **Kubik:** tepat satu titik belok, di $x=-\frac b{3a}$; parabola tidak punya. - **Kode:** `sp.solve_univariate_inequality(d2f > 0, x, relational=False)` dan `d2f.subs(x, c)`. ## Glosarium: istilah penting - **Cekung ke atas**: Grafik cekung ke atas pada selang tempat gradiennya naik, yaitu tempat turunan kedua positif; ia melengkung seperti cangkir dan berada di atas garis singgungnya. - **Cekung ke bawah**: Grafik cekung ke bawah pada selang tempat gradiennya turun, yaitu tempat turunan kedua negatif; ia melengkung seperti topi dan berada di bawah garis singgungnya. - **Titik belok**: Titik pada grafik yang memiliki garis singgung dan tempat kecekungan berubah dari atas ke bawah atau dari bawah ke atas. - **Uji Turunan Kedua**: Uji yang menggolongkan titik kritis menurut tanda turunan kedua di sana: negatif maksimum lokal, positif minimum lokal, nol tidak meyakinkan. - **Asimtot**: Garis yang didekati grafik fungsi tanpa batas: tegak di tempat fungsi membesar tanpa batas, mendatar atau miring di ujung sumbu x. - **Penggambaran kurva**: Menggambar grafik fungsi dari domain, simetri, turunan pertama dan kedua, titik kritis, titik belok, asimtot, dan beberapa titik penting. ## Pertanyaan yang sering diajukan ### Apa arti cekung ke atas? Grafik cekung ke atas pada suatu selang ketika gradiennya naik di sana, sehingga ia melengkung seperti cangkir dan berada di atas garis singgungnya. Untuk fungsi yang terdiferensialkan dua kali ini sama dengan turunan kedua positif pada selang itu. ### Apa itu titik belok? Itu adalah titik pada grafik yang memiliki garis singgung dan tempat kecekungan berubah, sehingga grafik memotong garis singgungnya sendiri. Di sana turunan kedua nol atau tidak ada, tetapi kedua fakta itu saja tidak menjaminnya. ### Apakah turunan kedua nol selalu berarti titik belok? Tidak. Turunan kedua juga harus berganti tanda. Fungsi x pangkat empat memiliki turunan kedua sama dengan 0 di x sama dengan 0, tetapi ia cekung ke atas di kedua sisi, sehingga tidak ada titik belok di sana. ### Dapatkah titik belok terjadi di tempat turunan kedua tidak ada? Ya, jika grafik memiliki garis singgung di sana dan kecekungan berubah. Fungsi x pangkat lima per tiga dan akar pangkat tiga x memiliki titik belok di 0 walaupun turunan kedua tak terdefinisi di sana; titik puncak tidak memilikinya. ### Apa itu Uji Turunan Kedua? Jika turunan pertama nol di suatu titik, tanda turunan kedua di sana menggolongkannya: negatif maksimum lokal dan positif minimum lokal. Jika turunan kedua nol, uji tidak menyatakan apa pun dan Uji Turunan Pertama dipakai. ### Apa langkah-langkah menggambar kurva? Cari domain dan simetri, turunan pertama dan kedua, titik kritis dan jenisnya, di mana fungsi naik dan turun, titik belok dan kecekungan, serta asimtot. Lalu gambar perpotongan dan titik khusus dan gambar kurvanya. ### Bagaimana turunan kedua menggambarkan gerak? Turunan kedua posisi adalah percepatan. Partikel bertambah cepat ketika kecepatan dan percepatannya bertanda sama dan melambat ketika bertanda berlawanan. Titik belok grafik posisi menandai tempat percepatan berganti tanda. ### Dapatkah grafik memotong asimtotnya? Asimtot mendatar atau miring menggambarkan apa yang dilakukan grafik di ujung yang jauh, sehingga ia dapat memotong garis itu di nilai x terhingga. Fungsi dengan pembilang x tambah 1 kuadrat per 1 tambah x kuadrat menemui asimtotnya y sama dengan 1 di x sama dengan 0. --- # Monotonic Functions and the First Derivative Test Source: https://nunada.my.id/articles/monotonic-functions-and-the-first-derivative-test/ Updated: 2026-10-21 ## Quick answer **If $f'>0$ on an interval, $f$ is increasing there, and if $f'<0$, $f$ is decreasing; so the critical points, where $f'$ is zero or does not exist, cut the domain into pieces on each of which $f$ rises or falls.** The First Derivative Test then reads the sign of $f'$ on both sides of a critical point: negative to positive is a local minimum, positive to negative a local maximum, and no change means no extreme value. ### Key takeaways - A function is increasing on an interval if $f(x_1)f(x_2)$; a function that is one or the other is monotonic, and we speak of intervals, never of a single point. - Corollary 3 of the Mean Value Theorem: if $f$ is continuous on $[a,b]$ and $f'>0$ on $(a,b)$, then $f$ is increasing on $[a,b]$; if $f'<0$, it is decreasing. The derivative may fail to exist at the ends, or be zero at isolated points, as for $x^3$. - To find where $f$ rises and falls, find the critical points, take one test point in each open interval between them, and read the sign of $f'$ there; the sign is the same everywhere in the interval. - First Derivative Test: at a critical point $c$, if $f'$ changes from negative to positive $f$ has a local minimum, from positive to negative a local maximum, and if it keeps its sign there is no extreme value. - The test needs the sign, not the size: $f'(x)=(x-1)^2(x+2)$ is zero at $1$ but positive on both sides, so $1$ is not an extreme value, while $-2$ is a local minimum. - Monotonicity proves inequalities and gives inverses: $e^x\ge1+x$ follows from $e^x-1-x$ increasing from $0$, and a strictly monotonic function is one-to-one, so it has an inverse. ## What are increasing and decreasing functions? **A function $f$ is increasing on an interval $I$ if $f(x_1)f(x_2)$ whenever $x_10$ at each point of $(a,b)$, then $f$ is increasing on $[a,b]$; if $f'(x)<0$ at each point, then $f$ is decreasing on $[a,b]$.** Proof. Let $x_1f(x_1)$, and if $f'$ is negative then $f(x_2)0$ on $(0,b)$, so it is increasing on $[0,b]$ for every $b>0$ even though $f'(0)$ does not exist. Nor is a zero of $f'$ at a single point a problem: $x^3$ has $f'=3x^2=0$ at $0$ and is increasing on the whole line. **The method.** To find the intervals where $f$ rises and falls: 1. find the critical points of $f$, the places where $f'$ is zero or does not exist; 2. these cut the domain into open intervals; on each one $f'$ is continuous and never zero, so by the Intermediate Value Theorem it has one sign throughout; 3. read that sign by evaluating $f'$ at one convenient point of each interval, and apply the corollary. **Example 1.** Find the critical points of $f(x)=x^3-12x-5$ and the intervals where it rises and falls. The derivative is $$f'(x)=3x^2-12=3(x+2)(x-2),$$ which is zero at $x=-2$ and $x=2$. The intervals $(-\infty,-2)$, $(-2,2)$ and $(2,\infty)$ are tested at $-3$, $0$ and $3$: | Interval | $x<-2$ | $-22$ | |---|---|---|---| | $f'$ at a test point | $f'(-3)=15$ | $f'(0)=-12$ | $f'(3)=15$ | | Sign of $f'$ | $+$ | $-$ | $+$ | | Behavior of $f$ | increasing | decreasing | increasing | Since the corollary also allows $\le$, $f$ is increasing on $(-\infty,-2]$, decreasing on $[-2,2]$ and increasing on $[2,\infty)$. Type any function below, or choose an example: the graph is dark where it rises and orange where it falls, and the graph of $f'$ shows why, above the axis or below. ## What is the First Derivative Test for local extrema? **At a point where $f$ has a local minimum, $f'<0$ immediately to the left and $f'>0$ immediately to the right, so $f$ falls and then rises; at a local maximum it is the other way round. At a local extreme point the sign of $f'$ changes.** Together with the [critical points](https://nunada.my.id/articles/extreme-values-on-closed-intervals/#critical-points) of the previous article, which say where an extreme value can be, this gives a test for what happens there. **First Derivative Test for local extrema.** Suppose that $c$ is a critical point of a continuous function $f$, and that $f$ is differentiable at every point of some interval containing $c$ except possibly at $c$ itself. Moving across the interval from left to right: 1. if $f'$ changes from negative to positive at $c$, then $f$ has a local minimum at $c$; 2. if $f'$ changes from positive to negative at $c$, then $f$ has a local maximum at $c$; 3. if $f'$ does not change sign at $c$ ($f'$ is positive on both sides, or negative on both sides), then $f$ has no local extreme value at $c$. Proof of part 1. The sign of $f'$ changes from negative to positive at $c$, so there are numbers $a0$ on $(c,b)$. If $x$ is in $(a,c)$, then $f(c)0$ makes $f$ increasing on $[c,b]$. So $f(x)\ge f(c)$ for every $x$ in $(a,b)$, which is the definition of a local minimum at $c$. ∎ Parts 2 and 3 are proved in the same way. **At an end of the domain** there is only one side. If $f$ rises from the left end $a$ (that is, $f'>0$ just to the right of $a$), then $f(a)$ is a local minimum; if it falls, a local maximum. At a right end, the reverse. The test uses the sign, not the size: a critical point where $f'=0$ is not an extreme value if the sign stays the same, and a point where $f'$ does not exist can be one, as the corner of $|x|$ and the cusp of $x^{2/3}$ show. Choose each of the eight cases below and read the sign on the left and on the right. ## How do you work through a complete example? **A complete analysis finds the critical points, the sign of $f'$ between them, the intervals of increase and decrease, the local extreme values and which of them are absolute.** **Example 2.** $f(x)=x^{1/3}(x-4)=x^{4/3}-4x^{1/3}$. The function is continuous everywhere, and $$f'(x)=\tfrac43x^{1/3}-\tfrac43x^{-2/3}=\frac{4(x-1)}{3x^{2/3}}$$ is zero at $x=1$ and undefined at $x=0$. Those are the only critical points. | Interval | $x<0$ | $01$ | |---|---|---|---| | Sign of $f'$ | $-$ | $-$ | $+$ | | Behavior of $f$ | decreasing | decreasing | increasing | The test says there is no extreme value at $0$ ($f'$ does not change sign: $f$ falls through the vertical tangent there, since $f'\to-\infty$) and a local minimum at $x=1$, with value $f(1)=-3$. Because $f$ decreases on $(-\infty,1)$ and increases on $(1,\infty)$, this is also the absolute minimum. **Example 3.** $f(x)=(x^2-3)e^x$. It is differentiable everywhere, so the critical points are the zeros of $$f'(x)=2xe^x+(x^2-3)e^x$$ $$f'(x)=(x^2+2x-3)e^x$$ $$f'(x)=(x+3)(x-1)e^x.$$ Since $e^x$ is never zero, they are $x=-3$ and $x=1$. The sign of $f'$ is $+$ for $x<-3$, $-$ for $-31$. So $f$ increases on $(-\infty,-3]$ and $[1,\infty)$, decreases on $[-3,1]$, has a local maximum $f(-3)=6e^{-3}\approx0.299$ and a local minimum $f(1)=-2e\approx-5.437$. The minimum is absolute, because $f(x)>0$ for $x>\sqrt3$ and $f(x)\to0$ as $x\to-\infty$; the maximum is not, because $f$ grows without bound. This is the situation the [closed interval method](https://nunada.my.id/articles/extreme-values-on-closed-intervals/#closed-interval-method) cannot handle alone: on a whole line the signs of $f'$ say which values are absolute. **Example 4.** $f(x)=x^4-8x^2+16=(x^2-4)^2$. Here $f'(x)=4x^3-16x=4x(x-2)(x+2)$, zero at $-2$, $0$ and $2$, with signs $-,+,-,+$ in the four intervals. So $f$ has local minima $f(\pm2)=0$ and a local maximum $f(0)=16$. **Example 5.** $f(x)=\sin x-\cos x$ on $[0,2\pi]$. Here $f'(x)=\cos x+\sin x$ is zero at $x=\frac{3\pi}{4}$ and $x=\frac{7\pi}{4}$, and $f'(0)=1>0$. So $f$ rises on $\left[0,\frac{3\pi}4\right]$, falls on $\left[\frac{3\pi}4,\frac{7\pi}4\right]$ and rises on $\left[\frac{7\pi}4,2\pi\right]$, with a local maximum $\sqrt2$ at $\frac{3\pi}{4}$ and a local minimum $-\sqrt2$ at $\frac{7\pi}{4}$. At the ends $f(0)=f(2\pi)=-1$, which are local extremes of the window: a local minimum at $0$ (it rises from there) and a local maximum at $2\pi$. ## How do you read a function from its derivative alone? **When only $f'$ is given, the sign chart of $f'$ is all that is needed: where $f'$ is above the axis $f$ rises, where it is below the axis $f$ falls, and the critical points where it crosses the axis are the local extremes.** The formula for $f$ does not matter, nor do the actual values of $f'$; only its signs do. A factored derivative makes the chart easy. Each factor $(x-r)^m$ changes sign at $r$ when the exponent $m$ is odd, and keeps its sign when $m$ is even. For $f'(x)=(x-1)^2(x+2)$: - at $x=-2$ the factor $x+2$ changes sign, and $(x-1)^2$ is positive: $f'$ goes from negative to positive, a local minimum; - at $x=1$ the factor $(x-1)^2$ never changes sign: $f'$ stays positive, so $f$ keeps rising and there is no extreme value, although $f'(1)=0$. For $f'(x)=(x-1)^2(x+2)^2$ the derivative is never negative, so $f$ rises on the whole line and has no extreme value at all, though it has two critical points. A point where $f'$ does not exist counts as critical only if $f$ is defined there; for $f'(x)=1-\frac{4}{x^2}$ the point $x=0$ is not in the domain of $f(x)=x+\frac4x$, so it is a break, not an extreme value, even though $f'$ has the same sign on both sides of it. Try the derivatives of the textbook's exercises below and see which critical points are extremes. The graph of $f'$ is dark where $f'>0$ (so $f$ rises) and orange where $f'<0$. ## How does monotonicity prove an inequality? **To prove $f(x)\ge g(x)$ for $x\ge a$, look at the difference $h=f-g$: if $h(a)\ge0$ and $h'\ge0$ for $x>a$, then $h$ never decreases from a value that is at least $0$, so $h\ge0$ and $f\ge g$.** The derivative turns a comparison of two functions into the sign of one derivative. **Example 6.** Show that $\ln x1$. Let $h(x)=x-\ln x$. Then $h'(x)=1-\frac1x>0$ for $x>1$, so $h$ is increasing on $[1,\infty)$ and $h(x)>h(1)=1>0$. Hence $x>\ln x+1>\ln x$. In fact $h$ has its minimum $1$ at $x=1$, so $x>\ln x$ for every $x>0$. **Example 7.** Show that $e^x\ge1+x$ for $x\ge0$. Let $h(x)=e^x-1-x$. Then $h(0)=0$ and $h'(x)=e^x-1\ge0$ for $x\ge0$, so $h$ is increasing from $0$ and $h\ge0$. Repeating the idea one step further: with $k(x)=e^x-1-x-\frac{x^2}{2}$ we have $k(0)=0$ and $k'(x)=e^x-1-x\ge0$ by what was just proved, so $e^x\ge1+x+\frac{x^2}{2}$ for $x\ge0$. Each inequality is the base for the next. The proof needs the right starting point: $e^x\ge1+x$ also holds for negative $x$, but there $h$ is decreasing (it falls to $0$ at $x=0$), so the argument above does not show it; the minimum of $h$ at $0$ does. Pick a pair below; the second graph is the difference $h$, dark where it rises and orange where it falls. The last pair is false, and the widget finds where. ## Where else does monotonicity matter: motion, quadratics and inverses? **Wherever a quantity is a function of another, the sign of the derivative says which way it moves.** **Motion along a line.** For a position $s(t)$ the velocity is $v=s'$: when $s$ is increasing the particle moves right, and when $s$ is decreasing it moves left, as in the [motion along a line](https://nunada.my.id/articles/the-derivative-as-a-rate-of-change/#motion-along-a-line) of the rates article. **Example 8.** A particle has $s(t)=2t^3-14t^2+22t-5$ for $t\ge0$. Then $$v(t)=6t^2-28t+22=2(t-1)(3t-11),$$ which is zero at $t=1$ and $t=\frac{11}{3}$. The sign of $v$ is $+$ for $0\le t<1$, $-$ for $10$, $f$ decreases to the left of that point and increases to the right, so the vertex is a minimum; if $a<0$ it is the reverse. A single formula covers every parabola. **Inverses.** A strictly monotonic function is one-to-one: $x_1\ne x_2$ forces $f(x_1)\ne f(x_2)$, because one of the two inputs is larger and the outputs are ordered the same way. So a function with $f'>0$ on an interval, or $f'<0$, has an inverse there. For $f(x)=x^3+x$ we have $f'(x)=3x^2+1>0$, so $f$ is increasing on the whole line and has an inverse, although no simple formula for it. Its derivative at the point $2$ is still available by the [rule for inverses](https://nunada.my.id/articles/derivatives-of-inverse-functions-and-logarithms/#inverse-rule): $f(1)=2$, so $\left(f^{-1}\right)'(2)=\frac1{f'(1)}=\frac14$. ## How do you find where a function rises and falls in code? **In code the method is the same three steps: find the critical points, read the sign of $f'$ at one point of each interval between them, and compare neighbouring signs.** SymPy gives the intervals exactly: `sp.solve_univariate_inequality(df > 0, x, relational=False)` returns the set where $f$ rises, and the same with `< 0` where it falls. Without a CAS, take the midpoint of each interval, which is what the JavaScript and C++ programs do; a sign read at one point is enough because $f'$ cannot change sign inside an interval that has no critical point. ```python import sympy as sp x = sp.symbols('x', real=True) def first_derivative_test(f): """Where f rises and falls, and what the First Derivative Test says at each critical point.""" df = sp.diff(f, x) rising = sp.solve_univariate_inequality(df > 0, x, relational=False) falling = sp.solve_univariate_inequality(df < 0, x, relational=False) eps = sp.Rational(1, 10**6) verdict = {} for c in sorted(sp.solveset(sp.Eq(df, 0), x, sp.S.Reals), key=float): left_down, right_up = falling.contains(c - eps), rising.contains(c + eps) left_up, right_down = rising.contains(c - eps), falling.contains(c + eps) verdict[c] = 'min' if left_down and right_up else 'max' if left_up and right_down else 'none' return rising, falling, verdict for f in (x**3 - 12 * x - 5, (x**2 - 3) * sp.exp(x), x**4 - 8 * x**2 + 16, x**3, (x - 1)**2 * (x + 2)): print(f, '->', first_derivative_test(f)) # x**3 - 12*x - 5 -> (Union(Interval.open(-oo, -2), Interval.open(2, oo)), Interval.open(-2, 2), {-2: 'max', 2: 'min'}) # (x**2 - 3)*exp(x) -> (Union(Interval.open(-oo, -3), Interval.open(1, oo)), Interval.open(-3, 1), {-3: 'max', 1: 'min'}) # x**4 - 8*x**2 + 16 -> (Union(Interval.open(-2, 0), Interval.open(2, oo)), Union(Interval.open(-oo, -2), Interval.open(0, 2)), {-2: 'min', 0: 'max', 2: 'min'}) # x**3 -> (Union(Interval.open(-oo, 0), Interval.open(0, oo)), EmptySet, {0: 'none'}) # (x - 1)**2*(x + 2) -> (Union(Interval.open(-oo, -1), Interval.open(1, oo)), Interval.open(-1, 1), {-1: 'max', 1: 'min'}) ``` ```javascript // the pieces between the critical points, the sign of f' at the middle of each, and the verdict at every critical point const signChart = (df, critical, lo, hi) => { const edges = [lo, ...critical, hi] const pieces = edges.slice(1).map((to, i) => { const mid = (edges[i] + to) / 2 return { from: edges[i], to, slope: df(mid), trend: df(mid) > 0 ? 'rising' : 'falling' } }) const verdicts = critical.map((c, i) => { const [l, r] = [pieces[i].trend, pieces[i + 1].trend] return [c, l === 'falling' && r === 'rising' ? 'min' : l === 'rising' && r === 'falling' ? 'max' : 'none'] }) return { pieces: pieces.map((p) => [p.from, p.to, p.trend]), verdicts } } signChart((x) => 3 * x * x - 12, [-2, 2], -5, 5) // pieces [[-5,-2,'rising'], [-2,2,'falling'], [2,5,'rising']] verdicts [[-2,'max'], [2,'min']] signChart((x) => 3 * x * x, [0], -2, 2) // pieces [[-2,0,'rising'], [0,2,'rising']] verdicts [[0,'none']]: f' = 0 at 0, but the sign does not change signChart((x) => 4 * x * (x - 2) * (x + 2), [-2, 0, 2], -3, 3) // pieces [[-3,-2,'falling'], [-2,0,'rising'], [0,2,'falling'], [2,3,'rising']] verdicts [[-2,'min'], [0,'max'], [2,'min']] ``` ```cpp #include #include #include using namespace std; double df(double x) { return 3 * x * x - 12; } // f(x) = x^3 - 12x - 5, Example 1 int main() { double edge[4]; edge[0] = -5; edge[1] = -2; edge[2] = 2; edge[3] = 5; // the ends and the critical points int sign[3]; for (int i = 0; i < 3; i++) { double mid = (edge[i] + edge[i + 1]) / 2; // one test point in each interval sign[i] = df(mid) > 0 ? 1 : -1; if (sign[i] > 0) printf("from %.1f to %.1f; f' at %.2f is %.2f; rising\n", edge[i], edge[i + 1], mid, df(mid)); else printf("from %.1f to %.1f; f' at %.2f is %.2f; falling\n", edge[i], edge[i + 1], mid, df(mid)); } for (int i = 0; i < 2; i++) { // the First Derivative Test at each critical point double c = edge[i + 1]; if (sign[i] < 0 && sign[i + 1] > 0) printf("x=%.1f local minimum\n", c); else if (sign[i] > 0 && sign[i + 1] < 0) printf("x=%.1f local maximum\n", c); else printf("x=%.1f no extreme value\n", c); } printf("f(-2)=%.0f f(2)=%.0f\n", pow(-2.0, 3) - 12 * (-2.0) - 5, pow(2.0, 3) - 12 * 2.0 - 5); return 0; } /* output: from -5.0 to -2.0; f' at -3.50 is 24.75; rising from -2.0 to 2.0; f' at 0.00 is -12.00; falling from 2.0 to 5.0; f' at 3.50 is 24.75; rising x=-2.0 local maximum x=2.0 local minimum f(-2)=11 f(2)=-21 */ ``` ## Where do the signs of the derivative come from? **Telling rising from falling by the sign of a rate is as old as the derivative, but proving that the sign does what it should took until the 19th century.** - **Fermat, about 1629.** Pierre de Fermat located maxima and minima by comparing $f(x)$ with $f(x+e)$. What he found is the condition $f'=0$; telling a maximum from a minimum was done by looking at the values on both sides. - **Leibniz, 1684.** Gottfried Wilhelm Leibniz published the first rules of the differential calculus in his Nova methodus pro maximis et minimis, in the title of which the search for maxima and minima comes first. - **Cauchy, 1823.** Augustin-Louis Cauchy, with the derivative defined as a limit, showed through the mean value theorem that a positive derivative on an interval forces a function to increase. Before that, "the derivative is positive, so the function rises" was taken as obvious from the picture. - **Today.** The sign chart is the first tool for graph sketching and optimisation, and a numerical method that stops when the slope changes sign is applying the same test. ## What mistakes do people make with the sign of the derivative? **The most common mistakes with monotonic functions and the First Derivative Test are the nine below, each with the correct statement.** | Mistake | Correct | |---|---| | ❌ If $f'(c)=0$, then $f$ has a maximum or a minimum at $c$ | $f(x)=x^3$ has $f'(0)=0$ and keeps rising: look at the sign on both sides. | | ❌ $f'>0$ means $f>0$ | $f'>0$ says $f$ rises, not that it is positive: $f(x)=x-5$ has $f'=1$ and is negative for $x<5$. | | ❌ Test the sign of $f'$ at the critical point | There $f'=0$ or does not exist; take one point in each open interval between critical points. | | ❌ One test point for the whole line | One test point per interval: $x^3-12x-5$ has the signs $+,-,+$, and one point would see only one of them. | | ❌ Skip the points where $f'$ does not exist | They are critical: $x^{2/3}$ has a minimum at $0$, and $\sqrt[3]{x}$ has none there. | | ❌ $f'$ going from $+$ to $-$ gives a minimum | It gives a maximum: the function rises and then falls. | | ❌ "$f$ is increasing at $x=2$" | Increasing is a property of an interval; at one point the definition compares nothing. | | ❌ $f'>0$ on $(-\infty,0)$ and on $(0,\infty)$, so $f$ increases on the whole line | The set must be one interval: $f(x)=-\frac1x$ has $f'=\frac1{x^2}>0$, but $f(-1)=1>f(1)=-1$. | | ❌ A local maximum is the largest value | $(x^2-3)e^x$ has the local maximum $0.299$ at $-3$ and then grows without bound. | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: monotonic functions and the test at a glance - **Definitions:** increasing means $f(x_1)0$ on an interval gives increasing, $f'<0$ gives decreasing; ends and isolated zeros of $f'$ are allowed. - **Method:** critical points, one test point in each open interval between them, the sign of $f'$ there. - **First Derivative Test:** $-\to+$ is a local minimum, $+\to-$ a local maximum, no change means no extreme value; at an end only one side exists. - **Signs, not sizes:** a double factor such as $(x-1)^2$ does not change the sign, and a point where $f'$ does not exist can still be an extreme value. - **Inequalities:** $f\ge g$ from $h=f-g$ with $h(a)\ge0$ and $h'\ge0$. - **Uses:** the direction of a particle, the vertex of a parabola, and inverses of strictly monotonic functions. - **Next:** the second derivative says how the graph bends, the subject of the next article. - **Code:** `sp.solve_univariate_inequality(df > 0, x, relational=False)`, or the sign of `df` at the midpoint of each interval. ## Glossary: key terms - **Increasing function**: A function whose value is larger at a larger input anywhere on an interval: f of x one is less than f of x two whenever x one is less than x two. - **Decreasing function**: A function whose value is smaller at a larger input anywhere on an interval; its graph falls from left to right. - **Monotonic function**: A function that is either increasing on an interval or decreasing on it; a strictly monotonic function is one-to-one. - **First Derivative Test**: The test that finds local extremes from the sign of the derivative on both sides of a critical point: negative then positive is a minimum, positive then negative a maximum, no change means none. - **Sign chart**: A table of the sign of the derivative on each interval between the critical points, with what the function does on each. - **One-to-one function**: A function that never takes the same value at two different inputs, so that it has an inverse. ## Frequently asked questions ### What is a monotonic function? A monotonic function is one that is either increasing on an interval or decreasing on it, so its graph never turns round there. Strictly monotonic functions never take the same value twice, so they are one-to-one and have inverses. ### How does the derivative tell where a function increases or decreases? If the derivative is positive at every point of an interval, the function is increasing there, and if it is negative, decreasing. The proof applies the Mean Value Theorem to any two points of the interval, which links the change in the function to the sign of the derivative. ### What is the First Derivative Test? It decides whether a critical point is a local extreme value by the sign of the derivative on each side. A change from negative to positive is a local minimum, positive to negative is a local maximum, and no change means no extreme value. ### How do you make a sign chart for the derivative? Find the critical points, where the derivative is zero or does not exist. They cut the domain into open intervals. Evaluate the derivative at one point in each interval and write its sign; the sign holds on the whole interval. ### Why is a point with a zero derivative not always an extreme value? Because the derivative can touch zero without changing sign. The function x cubed has a zero derivative at 0 but is positive-sloped on both sides, so it keeps rising. An extreme value needs the sign to change. ### Can a function have a local minimum where it is not differentiable? Yes. The absolute value function has a corner at 0 and its slope goes from negative to positive there, so 0 is a local minimum. The point is critical because the derivative does not exist, and the test applies. ### How do you prove an inequality with derivatives? Subtract the two sides to get a difference function. If it is at least zero at the start and its derivative is never negative after that, the difference never goes below zero, which proves the inequality. For example e to the x is at least 1 plus x for x at least 0. ### Does a monotonic function always have an inverse? A strictly monotonic function does, on its interval, because it is one-to-one. The inverse may have no simple formula: x cubed plus x is increasing everywhere, so it has an inverse, although solving for x is not easy. --- # Fungsi Monoton dan Uji Turunan Pertama Source: https://nunada.my.id/artikel/fungsi-monoton-dan-uji-turunan-pertama/ Updated: 2026-10-21 ## Jawaban singkat **Jika $f'>0$ pada suatu selang, $f$ naik di sana, dan jika $f'<0$, $f$ turun; jadi titik kritis, tempat $f'$ nol atau tidak ada, memotong domain menjadi bagian-bagian yang pada masing-masingnya $f$ naik atau turun.** Uji Turunan Pertama kemudian membaca tanda $f'$ di kedua sisi titik kritis: negatif ke positif adalah minimum lokal, positif ke negatif adalah maksimum lokal, dan tidak berganti tanda berarti bukan nilai ekstrem. ### Poin penting - Fungsi naik pada suatu selang jika $f(x_1)f(x_2)$; fungsi yang salah satunya disebut monoton, dan kita berbicara tentang selang, bukan satu titik. - Akibat 3 Teorema Nilai Rata-rata: jika $f$ kontinu pada $[a,b]$ dan $f'>0$ pada $(a,b)$, maka $f$ naik pada $[a,b]$; jika $f'<0$, ia turun. Turunan boleh tidak ada di ujung, atau nol di titik terpencil, seperti pada $x^3$. - Untuk mencari di mana $f$ naik dan turun, cari titik kritis, ambil satu titik uji di setiap selang terbuka di antaranya, dan baca tanda $f'$ di sana; tanda itu sama di seluruh selang. - Uji Turunan Pertama: di titik kritis $c$, jika $f'$ berubah dari negatif ke positif $f$ memiliki minimum lokal, dari positif ke negatif maksimum lokal, dan jika tandanya tetap tidak ada nilai ekstrem. - Uji ini memerlukan tanda, bukan besar: $f'(x)=(x-1)^2(x+2)$ nol di $1$ tetapi positif di kedua sisi, sehingga $1$ bukan nilai ekstrem, sedangkan $-2$ adalah minimum lokal. - Kemonotonan membuktikan pertidaksamaan dan memberi invers: $e^x\ge1+x$ mengikuti dari $e^x-1-x$ yang naik dari $0$, dan fungsi monoton tegas satu-satu, sehingga memiliki invers. ## Apa itu fungsi naik dan fungsi turun? **Fungsi $f$ naik pada selang $I$ jika $f(x_1)f(x_2)$ setiap kali $x_10$ di setiap titik $(a,b)$, maka $f$ naik pada $[a,b]$; jika $f'(x)<0$ di setiap titik, maka $f$ turun pada $[a,b]$.** Bukti. Misalkan $x_1f(x_1)$, dan jika $f'$ negatif maka $f(x_2)0$ pada $(0,b)$, sehingga ia naik pada $[0,b]$ untuk setiap $b>0$ walaupun $f'(0)$ tidak ada. Nol $f'$ di satu titik juga bukan masalah: $x^3$ memiliki $f'=3x^2=0$ di $0$ dan naik pada seluruh garis. **Metodenya.** Untuk mencari selang tempat $f$ naik dan turun: 1. cari titik kritis $f$, tempat $f'$ nol atau tidak ada; 2. titik-titik itu memotong domain menjadi selang terbuka; pada masing-masingnya $f'$ kontinu dan tidak pernah nol, sehingga menurut Teorema Nilai Antara ia bertanda sama di seluruhnya; 3. baca tanda itu dengan menghitung $f'$ di satu titik yang mudah pada setiap selang, lalu terapkan akibatnya. **Contoh 1.** Tentukan titik kritis $f(x)=x^3-12x-5$ dan selang tempat ia naik dan turun. Turunannya $$f'(x)=3x^2-12=3(x+2)(x-2),$$ yang nol di $x=-2$ dan $x=2$. Selang $(-\infty,-2)$, $(-2,2)$, dan $(2,\infty)$ diuji di $-3$, $0$, dan $3$: | Selang | $x<-2$ | $-22$ | |---|---|---|---| | $f'$ di titik uji | $f'(-3)=15$ | $f'(0)=-12$ | $f'(3)=15$ | | Tanda $f'$ | $+$ | $-$ | $+$ | | Perilaku $f$ | naik | turun | naik | Karena akibatnya juga membolehkan $\le$, $f$ naik pada $(-\infty,-2]$, turun pada $[-2,2]$, dan naik pada $[2,\infty)$. Ketik fungsi apa pun di bawah, atau pilih contoh: grafiknya gelap saat naik dan oranye saat turun, dan grafik $f'$ menunjukkan sebabnya, di atas sumbu atau di bawahnya. ## Apa itu Uji Turunan Pertama untuk ekstrem lokal? **Di titik tempat $f$ memiliki minimum lokal, $f'<0$ tepat di kiri dan $f'>0$ tepat di kanan, sehingga $f$ turun lalu naik; di maksimum lokal sebaliknya. Di titik ekstrem lokal tanda $f'$ berganti.** Bersama [titik kritis](https://nunada.my.id/artikel/nilai-ekstrem-pada-selang-tertutup/#critical-points) dari artikel sebelumnya, yang menyatakan di mana nilai ekstrem dapat berada, ini memberi uji untuk apa yang terjadi di sana. **Uji Turunan Pertama untuk ekstrem lokal.** Misalkan $c$ titik kritis fungsi kontinu $f$, dan $f$ terdiferensialkan di setiap titik pada suatu selang yang memuat $c$ kecuali mungkin di $c$ sendiri. Bergerak melintasi selang dari kiri ke kanan: 1. jika $f'$ berubah dari negatif ke positif di $c$, maka $f$ memiliki minimum lokal di $c$; 2. jika $f'$ berubah dari positif ke negatif di $c$, maka $f$ memiliki maksimum lokal di $c$; 3. jika $f'$ tidak berganti tanda di $c$ ($f'$ positif di kedua sisi, atau negatif di kedua sisi), maka $f$ tidak memiliki nilai ekstrem lokal di $c$. Bukti bagian 1. Tanda $f'$ berubah dari negatif ke positif di $c$, sehingga ada bilangan $a0$ pada $(c,b)$. Jika $x$ di $(a,c)$, maka $f(c)0$ membuat $f$ naik pada $[c,b]$. Jadi $f(x)\ge f(c)$ untuk setiap $x$ di $(a,b)$, yang adalah definisi minimum lokal di $c$. ∎ Bagian 2 dan 3 dibuktikan dengan cara yang sama. **Di ujung domain** hanya ada satu sisi. Jika $f$ naik dari ujung kiri $a$ (yaitu $f'>0$ tepat di kanan $a$), maka $f(a)$ adalah minimum lokal; jika turun, maksimum lokal. Di ujung kanan, sebaliknya. Uji ini memakai tanda, bukan besar: titik kritis tempat $f'=0$ bukan nilai ekstrem jika tandanya tetap, dan titik tempat $f'$ tidak ada bisa menjadi nilai ekstrem, seperti ditunjukkan sudut $|x|$ dan titik puncak $x^{2/3}$. Pilih masing-masing dari delapan kasus di bawah dan baca tanda di kiri dan di kanan. ## Bagaimana mengerjakan satu contoh lengkap? **Analisis lengkap mencari titik kritis, tanda $f'$ di antaranya, selang naik dan turun, nilai ekstrem lokal, dan mana di antaranya yang mutlak.** **Contoh 2.** $f(x)=x^{1/3}(x-4)=x^{4/3}-4x^{1/3}$. Fungsi ini kontinu di mana-mana, dan $$f'(x)=\tfrac43x^{1/3}-\tfrac43x^{-2/3}=\frac{4(x-1)}{3x^{2/3}}$$ nol di $x=1$ dan tak terdefinisi di $x=0$. Itulah satu-satunya titik kritis. | Selang | $x<0$ | $01$ | |---|---|---|---| | Tanda $f'$ | $-$ | $-$ | $+$ | | Perilaku $f$ | turun | turun | naik | Ujinya menyatakan tidak ada nilai ekstrem di $0$ ($f'$ tidak berganti tanda: $f$ turun melalui garis singgung tegak di sana, karena $f'\to-\infty$) dan minimum lokal di $x=1$, bernilai $f(1)=-3$. Karena $f$ turun pada $(-\infty,1)$ dan naik pada $(1,\infty)$, ini juga minimum mutlak. **Contoh 3.** $f(x)=(x^2-3)e^x$. Fungsi ini terdiferensialkan di mana-mana, sehingga titik kritisnya adalah nol dari $$f'(x)=2xe^x+(x^2-3)e^x$$ $$f'(x)=(x^2+2x-3)e^x$$ $$f'(x)=(x+3)(x-1)e^x.$$ Karena $e^x$ tidak pernah nol, titiknya $x=-3$ dan $x=1$. Tanda $f'$ adalah $+$ untuk $x<-3$, $-$ untuk $-31$. Jadi $f$ naik pada $(-\infty,-3]$ dan $[1,\infty)$, turun pada $[-3,1]$, memiliki maksimum lokal $f(-3)=6e^{-3}\approx0{,}299$ dan minimum lokal $f(1)=-2e\approx-5{,}437$. Minimumnya mutlak, karena $f(x)>0$ untuk $x>\sqrt3$ dan $f(x)\to0$ ketika $x\to-\infty$; maksimumnya bukan, karena $f$ membesar tanpa batas. Inilah keadaan yang tidak dapat ditangani [metode selang tertutup](https://nunada.my.id/artikel/nilai-ekstrem-pada-selang-tertutup/#closed-interval-method) sendirian: pada seluruh garis tanda $f'$ menunjukkan nilai mana yang mutlak. **Contoh 4.** $f(x)=x^4-8x^2+16=(x^2-4)^2$. Di sini $f'(x)=4x^3-16x=4x(x-2)(x+2)$, nol di $-2$, $0$, dan $2$, dengan tanda $-,+,-,+$ pada keempat selang. Jadi $f$ memiliki minimum lokal $f(\pm2)=0$ dan maksimum lokal $f(0)=16$. **Contoh 5.** $f(x)=\sin x-\cos x$ pada $[0,2\pi]$. Di sini $f'(x)=\cos x+\sin x$ nol di $x=\frac{3\pi}{4}$ dan $x=\frac{7\pi}{4}$, dan $f'(0)=1>0$. Jadi $f$ naik pada $\left[0,\frac{3\pi}4\right]$, turun pada $\left[\frac{3\pi}4,\frac{7\pi}4\right]$, dan naik pada $\left[\frac{7\pi}4,2\pi\right]$, dengan maksimum lokal $\sqrt2$ di $\frac{3\pi}{4}$ dan minimum lokal $-\sqrt2$ di $\frac{7\pi}{4}$. Di ujung $f(0)=f(2\pi)=-1$, yang merupakan ekstrem lokal jendelanya: minimum lokal di $0$ (ia naik dari sana) dan maksimum lokal di $2\pi$. ## Bagaimana membaca fungsi dari turunannya saja? **Ketika hanya $f'$ yang diberikan, bagan tanda $f'$ adalah satu-satunya yang diperlukan: di mana $f'$ di atas sumbu $f$ naik, di mana di bawah sumbu $f$ turun, dan titik kritis tempat ia memotong sumbu adalah ekstrem lokal.** Rumus $f$ tidak penting, begitu pula nilai sebenarnya $f'$; hanya tandanya yang penting. Turunan yang difaktorkan membuat bagannya mudah. Setiap faktor $(x-r)^m$ berganti tanda di $r$ ketika pangkat $m$ ganjil, dan mempertahankan tandanya ketika $m$ genap. Untuk $f'(x)=(x-1)^2(x+2)$: - di $x=-2$ faktor $x+2$ berganti tanda, dan $(x-1)^2$ positif: $f'$ berubah dari negatif ke positif, minimum lokal; - di $x=1$ faktor $(x-1)^2$ tidak pernah berganti tanda: $f'$ tetap positif, sehingga $f$ terus naik dan tidak ada nilai ekstrem, walaupun $f'(1)=0$. Untuk $f'(x)=(x-1)^2(x+2)^2$ turunan tidak pernah negatif, sehingga $f$ naik pada seluruh garis dan sama sekali tidak memiliki nilai ekstrem, walaupun memiliki dua titik kritis. Titik tempat $f'$ tidak ada dihitung kritis hanya jika $f$ terdefinisi di sana; untuk $f'(x)=1-\frac{4}{x^2}$ titik $x=0$ tidak berada di domain $f(x)=x+\frac4x$, sehingga ia adalah putus, bukan nilai ekstrem, walaupun $f'$ bertanda sama di kedua sisinya. Cobalah turunan dari latihan buku di bawah dan lihat titik kritis mana yang ekstrem. Grafik $f'$ gelap di tempat $f'>0$ (sehingga $f$ naik) dan oranye di tempat $f'<0$. ## Bagaimana kemonotonan membuktikan pertidaksamaan? **Untuk membuktikan $f(x)\ge g(x)$ untuk $x\ge a$, lihat selisih $h=f-g$: jika $h(a)\ge0$ dan $h'\ge0$ untuk $x>a$, maka $h$ tidak pernah turun dari nilai yang paling sedikit $0$, sehingga $h\ge0$ dan $f\ge g$.** Turunan mengubah perbandingan dua fungsi menjadi tanda satu turunan. **Contoh 6.** Tunjukkan bahwa $\ln x1$. Misalkan $h(x)=x-\ln x$. Maka $h'(x)=1-\frac1x>0$ untuk $x>1$, sehingga $h$ naik pada $[1,\infty)$ dan $h(x)>h(1)=1>0$. Jadi $x>\ln x+1>\ln x$. Sebenarnya $h$ memiliki minimum $1$ di $x=1$, sehingga $x>\ln x$ untuk setiap $x>0$. **Contoh 7.** Tunjukkan bahwa $e^x\ge1+x$ untuk $x\ge0$. Misalkan $h(x)=e^x-1-x$. Maka $h(0)=0$ dan $h'(x)=e^x-1\ge0$ untuk $x\ge0$, sehingga $h$ naik dari $0$ dan $h\ge0$. Mengulang gagasan itu satu langkah lagi: dengan $k(x)=e^x-1-x-\frac{x^2}{2}$ kita punya $k(0)=0$ dan $k'(x)=e^x-1-x\ge0$ menurut yang baru dibuktikan, sehingga $e^x\ge1+x+\frac{x^2}{2}$ untuk $x\ge0$. Setiap pertidaksamaan menjadi dasar bagi yang berikutnya. Bukti ini memerlukan titik awal yang tepat: $e^x\ge1+x$ juga berlaku untuk $x$ negatif, tetapi di sana $h$ turun (ia turun ke $0$ di $x=0$), sehingga argumen di atas tidak menunjukkannya; minimum $h$ di $0$ yang menunjukkannya. Pilih satu pasangan di bawah; grafik kedua adalah selisih $h$, gelap saat naik dan oranye saat turun. Pasangan terakhir salah, dan widget menemukan di mana. ## Di mana lagi kemonotonan penting: gerak, kuadrat, dan invers? **Di mana pun satu besaran adalah fungsi dari besaran lain, tanda turunan menyatakan ke arah mana ia bergerak.** **Gerak sepanjang garis.** Untuk posisi $s(t)$ kecepatannya $v=s'$: ketika $s$ naik partikel bergerak ke kanan, dan ketika $s$ turun ia bergerak ke kiri, seperti pada [gerak sepanjang garis](https://nunada.my.id/artikel/turunan-sebagai-laju-perubahan/#motion-along-a-line) di artikel laju perubahan. **Contoh 8.** Sebuah partikel memiliki $s(t)=2t^3-14t^2+22t-5$ untuk $t\ge0$. Maka $$v(t)=6t^2-28t+22=2(t-1)(3t-11),$$ yang nol di $t=1$ dan $t=\frac{11}{3}$. Tanda $v$ adalah $+$ untuk $0\le t<1$, $-$ untuk $10$, $f$ turun di kiri titik itu dan naik di kanannya, sehingga puncaknya minimum; jika $a<0$ sebaliknya. Satu rumus mencakup setiap parabola. **Invers.** Fungsi monoton tegas satu-satu: $x_1\ne x_2$ memaksa $f(x_1)\ne f(x_2)$, karena salah satu dari dua masukan lebih besar dan keluarannya berurutan sama. Jadi fungsi dengan $f'>0$ pada suatu selang, atau $f'<0$, memiliki invers di sana. Untuk $f(x)=x^3+x$ kita punya $f'(x)=3x^2+1>0$, sehingga $f$ naik pada seluruh garis dan memiliki invers, walaupun tanpa rumus sederhana untuknya. Turunannya di titik $2$ tetap tersedia lewat [aturan invers](https://nunada.my.id/artikel/turunan-fungsi-invers-dan-logaritma/#inverse-rule): $f(1)=2$, sehingga $\left(f^{-1}\right)'(2)=\frac1{f'(1)}=\frac14$. ## Bagaimana mencari di mana fungsi naik dan turun dalam kode? **Dalam kode metodenya tetap tiga langkah: cari titik kritis, baca tanda $f'$ di satu titik pada setiap selang di antaranya, dan bandingkan tanda yang bertetangga.** SymPy memberi selangnya secara eksak: `sp.solve_univariate_inequality(df > 0, x, relational=False)` mengembalikan himpunan tempat $f$ naik, dan yang sama dengan `< 0` tempat ia turun. Tanpa CAS, ambil titik tengah setiap selang, yang dilakukan program JavaScript dan C++; tanda yang dibaca di satu titik sudah cukup karena $f'$ tidak dapat berganti tanda di dalam selang yang tidak memiliki titik kritis. ```python import sympy as sp x = sp.symbols('x', real=True) def first_derivative_test(f): """Where f rises and falls, and what the First Derivative Test says at each critical point.""" df = sp.diff(f, x) rising = sp.solve_univariate_inequality(df > 0, x, relational=False) falling = sp.solve_univariate_inequality(df < 0, x, relational=False) eps = sp.Rational(1, 10**6) verdict = {} for c in sorted(sp.solveset(sp.Eq(df, 0), x, sp.S.Reals), key=float): left_down, right_up = falling.contains(c - eps), rising.contains(c + eps) left_up, right_down = rising.contains(c - eps), falling.contains(c + eps) verdict[c] = 'min' if left_down and right_up else 'max' if left_up and right_down else 'none' return rising, falling, verdict for f in (x**3 - 12 * x - 5, (x**2 - 3) * sp.exp(x), x**4 - 8 * x**2 + 16, x**3, (x - 1)**2 * (x + 2)): print(f, '->', first_derivative_test(f)) # x**3 - 12*x - 5 -> (Union(Interval.open(-oo, -2), Interval.open(2, oo)), Interval.open(-2, 2), {-2: 'max', 2: 'min'}) # (x**2 - 3)*exp(x) -> (Union(Interval.open(-oo, -3), Interval.open(1, oo)), Interval.open(-3, 1), {-3: 'max', 1: 'min'}) # x**4 - 8*x**2 + 16 -> (Union(Interval.open(-2, 0), Interval.open(2, oo)), Union(Interval.open(-oo, -2), Interval.open(0, 2)), {-2: 'min', 0: 'max', 2: 'min'}) # x**3 -> (Union(Interval.open(-oo, 0), Interval.open(0, oo)), EmptySet, {0: 'none'}) # (x - 1)**2*(x + 2) -> (Union(Interval.open(-oo, -1), Interval.open(1, oo)), Interval.open(-1, 1), {-1: 'max', 1: 'min'}) ``` ```javascript // the pieces between the critical points, the sign of f' at the middle of each, and the verdict at every critical point const signChart = (df, critical, lo, hi) => { const edges = [lo, ...critical, hi] const pieces = edges.slice(1).map((to, i) => { const mid = (edges[i] + to) / 2 return { from: edges[i], to, slope: df(mid), trend: df(mid) > 0 ? 'rising' : 'falling' } }) const verdicts = critical.map((c, i) => { const [l, r] = [pieces[i].trend, pieces[i + 1].trend] return [c, l === 'falling' && r === 'rising' ? 'min' : l === 'rising' && r === 'falling' ? 'max' : 'none'] }) return { pieces: pieces.map((p) => [p.from, p.to, p.trend]), verdicts } } signChart((x) => 3 * x * x - 12, [-2, 2], -5, 5) // pieces [[-5,-2,'rising'], [-2,2,'falling'], [2,5,'rising']] verdicts [[-2,'max'], [2,'min']] signChart((x) => 3 * x * x, [0], -2, 2) // pieces [[-2,0,'rising'], [0,2,'rising']] verdicts [[0,'none']]: f' = 0 at 0, but the sign does not change signChart((x) => 4 * x * (x - 2) * (x + 2), [-2, 0, 2], -3, 3) // pieces [[-3,-2,'falling'], [-2,0,'rising'], [0,2,'falling'], [2,3,'rising']] verdicts [[-2,'min'], [0,'max'], [2,'min']] ``` ```cpp #include #include #include using namespace std; double df(double x) { return 3 * x * x - 12; } // f(x) = x^3 - 12x - 5, Example 1 int main() { double edge[4]; edge[0] = -5; edge[1] = -2; edge[2] = 2; edge[3] = 5; // the ends and the critical points int sign[3]; for (int i = 0; i < 3; i++) { double mid = (edge[i] + edge[i + 1]) / 2; // one test point in each interval sign[i] = df(mid) > 0 ? 1 : -1; if (sign[i] > 0) printf("from %.1f to %.1f; f' at %.2f is %.2f; rising\n", edge[i], edge[i + 1], mid, df(mid)); else printf("from %.1f to %.1f; f' at %.2f is %.2f; falling\n", edge[i], edge[i + 1], mid, df(mid)); } for (int i = 0; i < 2; i++) { // the First Derivative Test at each critical point double c = edge[i + 1]; if (sign[i] < 0 && sign[i + 1] > 0) printf("x=%.1f local minimum\n", c); else if (sign[i] > 0 && sign[i + 1] < 0) printf("x=%.1f local maximum\n", c); else printf("x=%.1f no extreme value\n", c); } printf("f(-2)=%.0f f(2)=%.0f\n", pow(-2.0, 3) - 12 * (-2.0) - 5, pow(2.0, 3) - 12 * 2.0 - 5); return 0; } /* output: from -5.0 to -2.0; f' at -3.50 is 24.75; rising from -2.0 to 2.0; f' at 0.00 is -12.00; falling from 2.0 to 5.0; f' at 3.50 is 24.75; rising x=-2.0 local maximum x=2.0 local minimum f(-2)=11 f(2)=-21 */ ``` ## Dari mana asal tanda turunan? **Membedakan naik dari turun lewat tanda suatu laju sama tuanya dengan turunan, tetapi membuktikan bahwa tanda itu berlaku sebagaimana mestinya baru terjadi pada abad ke-19.** - **Fermat, sekitar 1629.** Pierre de Fermat menentukan letak maksimum dan minimum dengan membandingkan $f(x)$ dengan $f(x+e)$. Yang ia temukan adalah syarat $f'=0$; membedakan maksimum dari minimum dilakukan dengan melihat nilai di kedua sisi. - **Leibniz, 1684.** Gottfried Wilhelm Leibniz menerbitkan aturan pertama kalkulus diferensial dalam Nova methodus pro maximis et minimis, yang judulnya menempatkan pencarian maksimum dan minimum lebih dahulu. - **Cauchy, 1823.** Augustin-Louis Cauchy, dengan turunan yang didefinisikan sebagai limit, menunjukkan lewat teorema nilai rata-rata bahwa turunan positif pada suatu selang memaksa fungsi naik. Sebelumnya, "turunannya positif, jadi fungsi naik" dianggap jelas dari gambar. - **Sekarang.** Bagan tanda adalah alat pertama untuk menggambar grafik dan optimasi, dan metode numerik yang berhenti ketika gradien berganti tanda menerapkan uji yang sama. ## Kesalahan apa yang sering terjadi pada tanda turunan? **Kesalahan paling umum pada fungsi monoton dan Uji Turunan Pertama adalah sembilan hal berikut, masing-masing dengan pernyataan yang benar.** | Kesalahan | Yang benar | |---|---| | ❌ Jika $f'(c)=0$, maka $f$ memiliki maksimum atau minimum di $c$ | $f(x)=x^3$ memiliki $f'(0)=0$ dan terus naik: lihat tanda di kedua sisi. | | ❌ $f'>0$ berarti $f>0$ | $f'>0$ menyatakan $f$ naik, bukan bahwa ia positif: $f(x)=x-5$ memiliki $f'=1$ dan negatif untuk $x<5$. | | ❌ Menguji tanda $f'$ di titik kritis | Di sana $f'=0$ atau tidak ada; ambil satu titik pada setiap selang terbuka di antara titik kritis. | | ❌ Satu titik uji untuk seluruh garis | Satu titik uji per selang: $x^3-12x-5$ bertanda $+,-,+$, dan satu titik hanya melihat salah satunya. | | ❌ Melewatkan titik tempat $f'$ tidak ada | Itu titik kritis: $x^{2/3}$ memiliki minimum di $0$, dan $\sqrt[3]{x}$ tidak memilikinya di sana. | | ❌ $f'$ berubah dari $+$ ke $-$ memberi minimum | Itu memberi maksimum: fungsi naik lalu turun. | | ❌ "$f$ naik di $x=2$" | Naik adalah sifat suatu selang; di satu titik definisinya tidak membandingkan apa pun. | | ❌ $f'>0$ pada $(-\infty,0)$ dan pada $(0,\infty)$, jadi $f$ naik pada seluruh garis | Himpunannya harus satu selang: $f(x)=-\frac1x$ memiliki $f'=\frac1{x^2}>0$, tetapi $f(-1)=1>f(1)=-1$. | | ❌ Maksimum lokal adalah nilai terbesar | $(x^2-3)e^x$ memiliki maksimum lokal $0{,}299$ di $-3$ lalu membesar tanpa batas. | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: fungsi monoton dan ujinya sekilas - **Definisi:** naik berarti $f(x_1)0$ pada suatu selang memberi naik, $f'<0$ memberi turun; ujung dan nol terpencil $f'$ diperbolehkan. - **Metode:** titik kritis, satu titik uji di setiap selang terbuka di antaranya, tanda $f'$ di sana. - **Uji Turunan Pertama:** $-\to+$ minimum lokal, $+\to-$ maksimum lokal, tidak berganti berarti bukan nilai ekstrem; di ujung hanya ada satu sisi. - **Tanda, bukan besar:** faktor ganda seperti $(x-1)^2$ tidak mengubah tanda, dan titik tempat $f'$ tidak ada tetap bisa menjadi nilai ekstrem. - **Pertidaksamaan:** $f\ge g$ dari $h=f-g$ dengan $h(a)\ge0$ dan $h'\ge0$. - **Kegunaan:** arah partikel, puncak parabola, dan invers fungsi monoton tegas. - **Berikutnya:** turunan kedua menyatakan bagaimana grafik melengkung, topik artikel berikutnya. - **Kode:** `sp.solve_univariate_inequality(df > 0, x, relational=False)`, atau tanda `df` di titik tengah setiap selang. ## Glosarium: istilah penting - **Fungsi naik**: Fungsi yang nilainya lebih besar pada masukan yang lebih besar di mana pun pada suatu selang: f(x1) kurang dari f(x2) setiap kali x1 kurang dari x2. - **Fungsi turun**: Fungsi yang nilainya lebih kecil pada masukan yang lebih besar di mana pun pada suatu selang; grafiknya turun dari kiri ke kanan. - **Fungsi monoton**: Fungsi yang naik pada suatu selang atau turun pada selang itu; fungsi monoton tegas bersifat satu-satu. - **Uji Turunan Pertama**: Uji yang mencari ekstrem lokal dari tanda turunan di kedua sisi titik kritis: negatif lalu positif minimum, positif lalu negatif maksimum, tidak berubah berarti bukan ekstrem. - **Bagan tanda**: Tabel tanda turunan pada setiap selang di antara titik kritis, dengan apa yang dilakukan fungsi pada masing-masingnya. - **Fungsi satu-satu**: Fungsi yang tidak pernah bernilai sama pada dua masukan berbeda, sehingga memiliki invers. ## Pertanyaan yang sering diajukan ### Apa itu fungsi monoton? Fungsi monoton adalah fungsi yang naik pada suatu selang atau turun pada selang itu, sehingga grafiknya tidak pernah berbalik di sana. Fungsi monoton tegas tidak pernah bernilai sama dua kali, sehingga satu-satu dan memiliki invers. ### Bagaimana turunan menunjukkan di mana fungsi naik atau turun? Jika turunan positif di setiap titik pada suatu selang, fungsi naik di sana, dan jika negatif, turun. Buktinya menerapkan Teorema Nilai Rata-rata pada dua titik mana pun pada selang, yang menghubungkan perubahan fungsi dengan tanda turunan. ### Apa itu Uji Turunan Pertama? Uji ini menentukan apakah titik kritis adalah nilai ekstrem lokal berdasarkan tanda turunan di setiap sisi. Perubahan dari negatif ke positif adalah minimum lokal, positif ke negatif adalah maksimum lokal, dan tidak berubah berarti bukan nilai ekstrem. ### Bagaimana membuat bagan tanda untuk turunan? Cari titik kritis, tempat turunan nol atau tidak ada. Titik itu memotong domain menjadi selang terbuka. Hitung turunan di satu titik pada setiap selang dan tulis tandanya; tanda itu berlaku di seluruh selang. ### Mengapa titik berturunan nol tidak selalu nilai ekstrem? Karena turunan dapat menyentuh nol tanpa berganti tanda. Fungsi x pangkat tiga memiliki turunan nol di 0 tetapi bergradien positif di kedua sisi, sehingga terus naik. Nilai ekstrem memerlukan tanda yang berganti. ### Dapatkah fungsi memiliki minimum lokal di tempat ia tidak terdiferensialkan? Ya. Fungsi nilai mutlak memiliki sudut di 0 dan gradiennya berubah dari negatif ke positif di sana, sehingga 0 adalah minimum lokal. Titik itu kritis karena turunan tidak ada, dan ujinya berlaku. ### Bagaimana membuktikan pertidaksamaan dengan turunan? Kurangkan kedua ruas untuk mendapat fungsi selisih. Jika ia paling sedikit nol di awal dan turunannya tidak pernah negatif setelah itu, selisihnya tidak pernah di bawah nol, yang membuktikan pertidaksamaan. Misalnya e pangkat x paling sedikit 1 tambah x untuk x paling sedikit 0. ### Apakah fungsi monoton selalu memiliki invers? Fungsi monoton tegas memilikinya, pada selangnya, karena satu-satu. Inversnya mungkin tidak punya rumus sederhana: x pangkat tiga tambah x naik di mana-mana, sehingga memiliki invers, walaupun menyelesaikan untuk x tidak mudah. --- # The Mean Value Theorem Source: https://nunada.my.id/articles/the-mean-value-theorem/ Updated: 2026-10-21 ## Quick answer **If $f$ is continuous on $[a,b]$ and differentiable on $(a,b)$, the Mean Value Theorem says that some point $c$ in $(a,b)$ has $f'(c)=\frac{f(b)-f(a)}{b-a}$: the tangent there is parallel to the secant through the two ends.** Somewhere the instantaneous rate of change equals the average rate over the whole interval. Rolle's Theorem is the case $f(a)=f(b)$, where $f'(c)=0$. ### Key takeaways - Rolle's Theorem: if $f$ is continuous on $[a,b]$, differentiable on $(a,b)$ and $f(a)=f(b)$, then $f'(c)=0$ for some $c$ in $(a,b)$; the graph has a horizontal tangent between the two equal values. - Mean Value Theorem: under the same two hypotheses, $f'(c)=\frac{f(b)-f(a)}{b-a}$ for some $c$ in $(a,b)$; it is proved by applying Rolle's Theorem to the vertical gap between the graph and the secant. - Both hypotheses matter, and differentiability is needed only inside the interval, not at the ends: $\sqrt{1-x^2}$ on $[-1,1]$ qualifies, while $|x|$ on $[-1,1]$ has a corner and no horizontal tangent. - Average speed is an instantaneous speed somewhere: a car that goes $176$ m in $8$ s must read $22$ m/s at some instant, and a truck that covers $230$ km in $2$ hours on a $100$ km/h road was speeding. - Corollaries: if $f'=0$ on an interval then $f$ is constant there, and if $f'=g'$ then $f=g+C$; so every antiderivative of a function is one of them plus a constant, and one point fixes $C$. - Uses: an equation has at most one more real solution than its derivative has zeros, and a bound $m\le f'\le M$ gives $m(b-a)\le f(b)-f(a)\le M(b-a)$. ## What is Rolle’s Theorem? **Rolle's Theorem says that if $y=f(x)$ is continuous on the closed interval $[a,b]$, differentiable at every point of $(a,b)$, and $f(a)=f(b)$, then there is at least one number $c$ in $(a,b)$ at which $f'(c)=0$.** As the graph suggests, a differentiable curve that crosses a horizontal line at two points has a horizontal tangent somewhere between them. There may be just one such point, or several. Proof. Because $f$ is continuous, the [Extreme Value Theorem](https://nunada.my.id/articles/extreme-values-on-closed-intervals/#extreme-value-theorem) gives an absolute maximum and an absolute minimum on $[a,b]$, and each is taken at an interior point where $f'$ is zero, at an interior point where $f'$ does not exist, or at an endpoint. The hypothesis rules out the second possibility. If the maximum or the minimum is at an interior point $c$, then $f'(c)=0$ by the [First Derivative Theorem](https://nunada.my.id/articles/extreme-values-on-closed-intervals/#critical-points), and $c$ is the point we want. If both are at the endpoints, then since $f(a)=f(b)$ the largest and the smallest value are equal, so $f$ is constant, $f'(x)=0$ everywhere inside, and $c$ can be any point of $(a,b)$. ∎ **The hypotheses are essential.** If they fail at even one point, the graph may have no horizontal tangent at all: - discontinuous at an endpoint: $f(x)=x$ for $0\le x<1$ and $f(1)=0$ has $f(0)=f(1)=0$, but its slope is $1$ everywhere inside; - discontinuous at an interior point: a graph that jumps over the gap leaves both pieces sloping the same way; - continuous but not differentiable at an interior point: $|x|$ on $[-1,1]$ has $f(-1)=f(1)$ and a corner at $0$, with slopes $-1$ and then $1$, never $0$; $x^{2/3}$ on $[-1,1]$ has a cusp at $0$. The opposite also needs care: a failed hypothesis does not make the conclusion false, only unpromised. Choose a case below and see which hypothesis it breaks. ## How does Rolle’s Theorem count the solutions of an equation? **Rolle's Theorem turns a statement about zeros of $f$ into a statement about zeros of $f'$: between any two zeros of $f$ there is a zero of $f'$.** So if $f'$ has $k$ zeros, $f$ cannot have more than $k+1$. **Example 1.** Show that $x^3+3x+1=0$ has exactly one real solution. Let $f(x)=x^3+3x+1$, which is continuous. Since $f(-1)=-3$ and $f(0)=1$, the Intermediate Value Theorem says the graph crosses the $x$-axis somewhere in $(-1,0)$, so there is at least one solution. Now suppose there were two zeros $x=a$ and $x=b$. Rolle's Theorem would give a point $c$ between them with $f'(c)=0$. But $$f'(x)=3x^2+3$$ is never zero, because it is always at least $3$. So there cannot be two zeros, and there is exactly one. The same reasoning counts roots in general. A cubic has a quadratic derivative with at most two zeros, so a cubic has at most three real zeros. For a polynomial with $n$ different real zeros, every one of the $n-1$ gaps between neighbours holds a zero of $f'$, and $f'$ has degree $n-1$, so those are all of its zeros: exactly one in each gap. Choose the zeros below and see it happen; the point with the horizontal tangent is always caught between two zeros. ## What does the Mean Value Theorem say? **The Mean Value Theorem is a slanted version of Rolle's Theorem: if $y=f(x)$ is continuous on $[a,b]$ and differentiable on $(a,b)$, then there is at least one point $c$ in $(a,b)$ at which** $$\frac{f(b)-f(a)}{b-a}=f'(c).$$ Geometrically, the left side is the slope of the secant line through $A(a,f(a))$ and $B(b,f(b))$, and the right side is the slope of the tangent at $c$: somewhere between $a$ and $b$ the curve has a tangent line parallel to the secant. When $f(a)=f(b)$ the secant is horizontal and this is Rolle's Theorem. Proof. The secant line is the graph of $$g(x)=f(a)+\frac{f(b)-f(a)}{b-a}(x-a).$$ The vertical distance between the graph of $f$ and the secant is $$h(x)=f(x)-g(x)$$ $$h(x)=f(x)-f(a)-\frac{f(b)-f(a)}{b-a}(x-a).$$ The function $h$ is continuous on $[a,b]$ and differentiable on $(a,b)$ because $f$ and $g$ are, and $h(a)=h(b)=0$ because both graphs pass through $A$ and $B$. So Rolle's Theorem gives a point $c$ in $(a,b)$ with $h'(c)=0$. Differentiating $h$ and putting $x=c$: $$h'(c)=f'(c)-\frac{f(b)-f(a)}{b-a}=0,$$ which is the equation of the theorem. ∎ **What it needs, and what it does not.** Continuity on the closed interval and differentiability inside are all that the proof used. In particular $f$ need not be differentiable at $a$ or at $b$: one-sided continuity is enough. The function $f(x)=\sqrt{1-x^2}$ on $[-1,1]$ has vertical tangents at both ends, yet it satisfies the theorem, with $c=0$. **What it does not say.** The theorem does not say there is only one point, and it gives no formula for $c$; it says only that at least one exists. Type a function and an interval below, or pick an example. The orange line is the secant, the green lines are the tangents at the points the theorem promises, and the two cases where a hypothesis fails show what the theorem does not cover. ## How do you find the point c? **To find $c$, compute the slope of the secant $m=\frac{f(b)-f(a)}{b-a}$, solve $f'(c)=m$, and keep the solutions that lie inside the open interval $(a,b)$.** The theorem guarantees that the list is not empty when the hypotheses hold. **Example 2.** $f(x)=x^2$ on $[0,2]$. The slope is $\frac{4-0}{2-0}=2$ and $f'(c)=2c=2$, so $c=1$. **Example 3.** $f(x)=x^2+2x-1$ on $[0,1]$. The slope is $\frac{2-(-1)}{1-0}=3$, and $f'(c)=2c+2=3$ gives $c=\frac12$. **Example 4.** $f(x)=x^{2/3}$ on $[0,1]$. The slope is $1$ and $f'(c)=\frac23c^{-1/3}=1$ gives $c^{1/3}=\frac23$, so $c=\frac{8}{27}$. The cusp is at $0$, an endpoint, so $f$ is differentiable inside and the theorem applies. **Example 5.** $f(x)=x^3-x^2$ on $[-1,2]$. The slope is $\frac{4-(-2)}{3}=2$, and $f'(c)=3c^2-2c=2$ gives $$3c^2-2c-2=0\qquad c=\frac{1\pm\sqrt7}{3}.$$ Both $c\approx-0.549$ and $c\approx1.215$ lie in $(-1,2)$, so there are two points. The theorem said "at least one". **The two means.** For $f(x)=\frac1x$ on an interval $[a,b]$ of positive numbers, the slope is $-\frac1{ab}$ and $f'(c)=-\frac1{c^2}$, so $c=\sqrt{ab}$, the geometric mean of $a$ and $b$. For $f(x)=x^2$ it is $2c=a+b$, so $c=\frac{a+b}{2}$, the arithmetic mean. Indeed for every quadratic $px^2+qx+r$ the slope of the secant is $p(a+b)+q$ and $f'(c)=2pc+q$, so $c$ is always the midpoint, and it is the only such point. **When c cannot be written down.** For $f(x)=xe^x$ on $[0,1]$ the slope is $e$ and the equation is $(1+c)e^c=e$. It has exactly one solution in $(0,1)$, but no elementary formula; a computer finds $c\approx0.5571$. The theorem is valuable because it promises $c$ without needing to compute it. ## What does the theorem say about speed and average rates? **Read as a statement about rates, the Mean Value Theorem says that the average rate of change over an interval is the instantaneous rate at some interior point.** The number $\frac{f(b)-f(a)}{b-a}$ is the average change of $f$ over $[a,b]$, and $f'(c)$ is an instantaneous change; the theorem says they meet. It applies to anything whose rate is a derivative, as in the [motion along a line](https://nunada.my.id/articles/the-derivative-as-a-rate-of-change/#motion-along-a-line) of the rates article. **Example 6.** A car accelerating from rest takes $8$ s to go $176$ m. Its average velocity is $\frac{176}{8}=22$ m/s, so at some moment during the acceleration the speedometer must read exactly $22$ m/s, which is $22\times3.6=79.2$ km/h. If the car has $s=2.75t^2$, which does match $176$ m at $t=8$, then $v=s'=5.5t$ equals $22$ at $t=4$ s. **A speeding ticket.** A truck driver hands in a tollbooth ticket showing that she covered $230$ km of a toll road with a $100$ km/h limit in $2$ hours. The average speed is $115$ km/h, so by the theorem the truck was doing exactly $115$ km/h at some instant, above the limit: a citation is justified without anyone having seen her speed. **More of the same.** - A thermometer taken from a freezer at $-19$ °C into boiling water at $100$ °C and reading it after $14$ s rose $\frac{119}{14}=8.5$ °C per second on average, so at some moment the mercury was rising at exactly $8.5$ °C/s. - A trireme that covered $184$ sea miles in $24$ hours averaged $7.67$ knots, so at some point its speed exceeded $7.5$ knots. - A marathoner who ran $42$ km in $2.2$ hours averaged $19.09$ km/h. Her speed was $19.09$ km/h at some instant, by the theorem. It starts at $0$ and ends at $0$, and a speed that changes continuously cannot skip values (the Intermediate Value Theorem), so it passed $18$ km/h once on the way up and again on the way down: at least twice. **What it does not say.** The theorem promises an instant, not that the speed stayed at the average, and it does not say when. It is an existence statement, and that is exactly what a proof or a legal argument needs. ## What follows when two functions have the same derivative? **The first question the theorem answers is which functions have a zero derivative: only constant ones.** Corollary 1: if $f'(x)=0$ at every point of an open interval $(a,b)$, then $f(x)=C$ for all $x$ in $(a,b)$, where $C$ is a constant. Proof. Take any two points $x_1', mvt_points(f, a, b)) # x**2 [0, 2] -> (2, {1}) # x**3 - x**2 [-1, 2] -> (2, {1/3 - sqrt(7)/3, 1/3 + sqrt(7)/3}) # 1/x [1, 4] -> (-1/4, {2}) # sqrt(1 - x**2) [-1, 1] -> (0, {0}) # sin(x) [0, 3*pi] -> (0, {pi/2, 3*pi/2, 5*pi/2}) # Abs(x) [-1, 2] -> (1/3, EmptySet) ``` ```javascript const mvt = (f, df, a, b, n = 4000) => { const slope = (f(b) - f(a)) / (b - a) const g = (x) => df(x) - slope // the points c are the zeros of g const cs = [] for (let i = 0; i < n; i++) { let lo = a + ((b - a) * i) / n let hi = a + ((b - a) * (i + 1)) / n if (g(lo) === 0 && i > 0) cs.push(lo) // a zero that falls exactly on a grid point else if (g(lo) * g(hi) < 0) { // g changes sign: bisect for (let k = 0; k < 60; k++) { const mid = (lo + hi) / 2 if (g(lo) * g(mid) <= 0) hi = mid else lo = mid } const c = (lo + hi) / 2 if (Math.abs(g(c)) < 1e-6) cs.push(c) // a corner makes g jump across 0: that is not a zero } } return { slope, cs } } mvt((x) => x * x, (x) => 2 * x, 0, 2) // slope 2, cs [1] mvt((x) => x ** 3 - x ** 2, (x) => 3 * x * x - 2 * x, -1, 2) // slope 2, cs [-0.5486, 1.2153] mvt((x) => x * Math.exp(x), (x) => (1 + x) * Math.exp(x), 0, 1) // slope e = 2.7183, cs [0.5571] mvt((x) => 1 / x, (x) => -1 / (x * x), 1, 4) // slope -0.25, cs [2] mvt(Math.abs, Math.sign, -1, 2) // slope 0.3333, cs []: the corner at 0 is rejected ``` ```cpp #include #include #include using namespace std; double f(int k, double x) { if (k == 0) return x * x * x - x * x; // Example 5 on [-1, 2] if (k == 1) return x * exp(x); // no formula for c, on [0, 1] return 1 / x; // the geometric mean, on [1, 4] } double df(int k, double x) { if (k == 0) return 3 * x * x - 2 * x; if (k == 1) return (1 + x) * exp(x); return -1 / (x * x); } void mvt(int k, double a, double b) { double slope = (f(k, b) - f(k, a)) / (b - a); int n = 2000; for (int i = 0; i < n; i++) { double lo = a + (b - a) * i / n; double hi = a + (b - a) * (i + 1) / n; if ((df(k, lo) - slope) * (df(k, hi) - slope) < 0) { // f' - slope changes sign: bisect for (int j = 0; j < 60; j++) { double mid = (lo + hi) / 2; if ((df(k, lo) - slope) * (df(k, mid) - slope) <= 0) hi = mid; else lo = mid; } double c = (lo + hi) / 2; printf("slope=%.4f c=%.4f f'(c)=%.4f\n", slope, c, df(k, c)); } } } int main() { mvt(0, -1, 2); mvt(1, 0, 1); mvt(2, 1, 4); printf("%.4f %.4f\n", sqrt(1.0 * 4), (1.0 + 4) / 2); // the geometric and the arithmetic mean of 1 and 4 return 0; } /* output: slope=2.0000 c=-0.5486 f'(c)=2.0000 slope=2.0000 c=1.2153 f'(c)=2.0000 slope=2.7183 c=0.5571 f'(c)=2.7183 slope=-0.2500 c=2.0000 f'(c)=-0.2500 2.0000 2.5000 */ ``` ## Where does the Mean Value Theorem come from? **The theorem is older than the definition of the derivative it is stated with, and it was proved first for polynomials.** - **Parameshvara, 15th century.** The Indian astronomer Parameshvara of the Kerala school is credited with a special case of the theorem, for the sine function. - **Rolle, 1691.** Michel Rolle showed, for polynomial equations, that between two roots there lies a root of the derivative, as a step in a method for separating the roots. He was a critic of the new infinitesimal calculus, and the name Rolle's theorem was given to the result in the 19th century (by Giusto Bellavitis, in 1846). - **Lagrange, 1797.** Joseph-Louis Lagrange stated the Mean Value Theorem and used it as the base of his attempt to build calculus on power series. Its other name, the Lagrange mean value theorem, is from this. - **Cauchy, 1823.** Augustin-Louis Cauchy, with the derivative defined as a limit, gave the proof by Rolle's Theorem used in books today, and a generalization to two functions, $\frac{f(b)-f(a)}{g(b)-g(a)}=\frac{f'(c)}{g'(c)}$, from which the rule of l'Hôpital for limits follows. ## What mistakes do people make with the theorem? **The most common mistakes with the Mean Value Theorem are the nine below, each with the correct statement.** | Mistake | Correct | |---|---| | ❌ There is exactly one point $c$ | The theorem says at least one: $x^3-x^2$ on $[-1,2]$ has two, and $\sin x$ on $[0,3\pi]$ has three horizontal tangents. | | ❌ Use it on $|x|$ over $[-1,2]$ | There is a corner at $0$, so $f$ is not differentiable inside; the slope of the secant is $\frac13$ and no tangent has that slope. | | ❌ Use it on $\frac1x$ over $[-1,1]$ | $f$ is not continuous there, not even defined at $0$, so nothing is promised. | | ❌ $f$ must be differentiable at the endpoints | Only continuity at the ends is needed: $\sqrt{1-x^2}$ on $[-1,1]$ works, with $c=0$. | | ❌ The theorem says $f(c)$ is the average of the values of $f$ | It says $f'(c)$ is the average rate, $\frac{f(b)-f(a)}{b-a}$; averages of values belong to integrals. | | ❌ $f'=0$ on $(-1,0)\cup(0,1)$, so $f$ is constant | The set must be one interval: $f(x)=\frac{x}{|x|}$ has $f'=0$ wherever defined and is $-1$ and then $1$. | | ❌ $c$ is always the midpoint $\frac{a+b}{2}$ | Only for quadratics: $x^3$ on $[0,2]$ has $c=\frac{2}{\sqrt3}\approx1.155$, not $1$. | | ❌ If $f'=g'$ then $f=g$ | They differ by a constant: $x^2$ and $x^2+3$ have the same derivative. | | ❌ An average speed of $115$ km/h means the speed was always $115$ | The theorem gives at least one instant at that speed, not all of them. | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: the Mean Value Theorem at a glance - **Rolle's Theorem:** $f$ continuous on $[a,b]$, differentiable on $(a,b)$, $f(a)=f(b)$ give some $c$ with $f'(c)=0$. - **Mean Value Theorem:** the same two hypotheses give some $c$ with $f'(c)=\frac{f(b)-f(a)}{b-a}$, a tangent parallel to the secant. - **Proof:** apply Rolle's Theorem to $h(x)=f(x)-f(a)-\frac{f(b)-f(a)}{b-a}(x-a)$. - **Watch for:** corners, cusps and poles inside the interval; the point $c$ is not unique and has no formula in general. - **Rates:** the average rate over an interval is the instantaneous rate at some interior instant. - **Corollaries:** $f'=0$ on an interval means constant; $f'=g'$ means $f=g+C$. - **Bounds:** $m\le f'\le M$ gives $m(b-a)\le f(b)-f(a)\le M(b-a)$. - **Next:** the sign of $f'$ on an interval tells where $f$ rises and falls, the subject of the next article. - **Code:** `sp.solveset(sp.diff(f, x) - slope, x, sp.Interval.open(a, b))`, or a scan with bisection that rejects jumps. ## Glossary: key terms - **Rolle’s Theorem**: The theorem that a function continuous on [a, b], differentiable on (a, b) and equal at the two ends has a point inside where the derivative is zero. - **Mean Value Theorem**: The theorem that a function continuous on [a, b] and differentiable on (a, b) has a point inside where the tangent is parallel to the secant through the ends. - **Secant line**: The line through two points of a graph; its slope is the average rate of change between them. - **Average rate of change**: The change in the value of a function divided by the change in the variable over an interval: the slope of the secant. - **Antiderivative**: A function whose derivative is a given function; on an interval, any two antiderivatives differ by a constant. - **Corollary**: A statement that follows directly from a theorem; the zero-derivative and equal-derivative results follow from the Mean Value Theorem. ## Frequently asked questions ### What is the Mean Value Theorem? It says that if a function is continuous on a closed interval and differentiable inside it, then at some point inside, the slope of the tangent equals the slope of the secant through the two ends. The instantaneous rate equals the average rate somewhere. ### What is the difference between Rolle’s Theorem and the Mean Value Theorem? Rolle’s Theorem is the special case where the function has the same value at both ends, so the secant is horizontal and the tangent at the promised point is horizontal too. The Mean Value Theorem tilts the picture to any secant. ### Why does the Mean Value Theorem need continuity and differentiability? Continuity on the closed interval lets the extreme values exist, and differentiability inside lets a tangent exist at them. Without them there may be no tangent with the right slope, as for the absolute value function on an interval that contains its corner. ### How do you find the value of c? Compute the secant slope, the change in the function divided by the change in x, then solve the equation that sets the derivative equal to it. Keep the solutions that lie strictly between the two ends; there may be more than one. ### Is the point c in the Mean Value Theorem unique? No. The theorem guarantees at least one. The function x cubed minus x squared on the interval from minus 1 to 2 has two such points, and sine on the interval from 0 to 3 pi has three horizontal tangents. ### What does the Mean Value Theorem say about speed? A moving body must have an instantaneous speed equal to its average speed at some moment. A car that goes 176 meters in 8 seconds read exactly 22 meters per second at some instant, and a truck that averaged 115 kilometers per hour was at 115. ### Why does a zero derivative mean a constant function? For any two points of the interval, the Mean Value Theorem says the change in the function equals the derivative somewhere between them times the distance. If the derivative is zero everywhere, the change is zero, so all values are equal. ### How is the Mean Value Theorem used to prove inequalities? If the derivative stays between two numbers, the change in the function is between those numbers times the length of the interval. Since the derivative of sine is at most 1 in size, the sine of b minus the sine of a is at most b minus a. --- # Teorema Nilai Rata-rata Source: https://nunada.my.id/artikel/teorema-nilai-rata-rata/ Updated: 2026-10-21 ## Jawaban singkat **Jika $f$ kontinu pada $[a,b]$ dan terdiferensialkan pada $(a,b)$, Teorema Nilai Rata-rata menyatakan bahwa ada titik $c$ di $(a,b)$ dengan $f'(c)=\frac{f(b)-f(a)}{b-a}$: garis singgung di sana sejajar dengan tali busur melalui kedua ujung.** Di suatu tempat laju perubahan sesaat sama dengan laju rata-rata sepanjang selang. Teorema Rolle adalah kasus $f(a)=f(b)$, tempat $f'(c)=0$. ### Poin penting - Teorema Rolle: jika $f$ kontinu pada $[a,b]$, terdiferensialkan pada $(a,b)$, dan $f(a)=f(b)$, maka $f'(c)=0$ untuk suatu $c$ di $(a,b)$; grafik memiliki garis singgung mendatar di antara dua nilai yang sama. - Teorema Nilai Rata-rata: dengan dua syarat yang sama, $f'(c)=\frac{f(b)-f(a)}{b-a}$ untuk suatu $c$ di $(a,b)$; teorema ini dibuktikan dengan menerapkan Teorema Rolle pada selisih tegak antara grafik dan tali busur. - Kedua syarat penting, dan keterdiferensialan hanya diperlukan di dalam selang, bukan di ujungnya: $\sqrt{1-x^2}$ pada $[-1,1]$ memenuhi, sedangkan $|x|$ pada $[-1,1]$ memiliki sudut dan tidak punya garis singgung mendatar. - Kecepatan rata-rata adalah kecepatan sesaat di suatu saat: mobil yang menempuh $176$ m dalam $8$ detik pasti menunjukkan $22$ m/detik pada suatu saat, dan truk yang menempuh $230$ km dalam $2$ jam di jalan berbatas $100$ km/jam pasti melanggar. - Akibatnya: jika $f'=0$ pada suatu selang maka $f$ konstan di sana, dan jika $f'=g'$ maka $f=g+C$; jadi setiap antiturunan suatu fungsi adalah salah satunya ditambah konstanta, dan satu titik menetapkan $C$. - Kegunaan: persamaan memiliki paling banyak satu penyelesaian real lebih banyak daripada nol turunannya, dan batas $m\le f'\le M$ memberi $m(b-a)\le f(b)-f(a)\le M(b-a)$. ## Apa itu Teorema Rolle? **Teorema Rolle menyatakan bahwa jika $y=f(x)$ kontinu pada selang tertutup $[a,b]$, terdiferensialkan di setiap titik $(a,b)$, dan $f(a)=f(b)$, maka ada paling sedikit satu bilangan $c$ di $(a,b)$ tempat $f'(c)=0$.** Seperti ditunjukkan grafiknya, kurva terdiferensialkan yang memotong garis mendatar di dua titik memiliki garis singgung mendatar di suatu tempat di antara keduanya. Titik seperti itu bisa hanya satu, bisa juga beberapa. Bukti. Karena $f$ kontinu, [Teorema Nilai Ekstrem](https://nunada.my.id/artikel/nilai-ekstrem-pada-selang-tertutup/#extreme-value-theorem) memberi maksimum mutlak dan minimum mutlak pada $[a,b]$, dan masing-masing dicapai di titik dalam tempat $f'$ nol, di titik dalam tempat $f'$ tidak ada, atau di ujung selang. Syarat teorema menyingkirkan kemungkinan kedua. Jika maksimum atau minimum ada di titik dalam $c$, maka $f'(c)=0$ menurut [Teorema Turunan Pertama](https://nunada.my.id/artikel/nilai-ekstrem-pada-selang-tertutup/#critical-points), dan $c$ adalah titik yang kita cari. Jika keduanya di ujung selang, maka karena $f(a)=f(b)$ nilai terbesar dan terkecil sama, sehingga $f$ konstan, $f'(x)=0$ di seluruh bagian dalam, dan $c$ boleh titik mana pun di $(a,b)$. ∎ **Syaratnya mutlak diperlukan.** Jika syarat gagal di satu titik saja, grafik mungkin tidak memiliki garis singgung mendatar sama sekali: - tidak kontinu di ujung: $f(x)=x$ untuk $0\le x<1$ dan $f(1)=0$ memiliki $f(0)=f(1)=0$, tetapi gradiennya $1$ di mana-mana di dalam; - tidak kontinu di titik dalam: grafik yang melompati celah meninggalkan kedua bagiannya miring ke arah yang sama; - kontinu tetapi tidak terdiferensialkan di titik dalam: $|x|$ pada $[-1,1]$ memiliki $f(-1)=f(1)$ dan sudut di $0$, dengan gradien $-1$ lalu $1$, tidak pernah $0$; $x^{2/3}$ pada $[-1,1]$ memiliki titik puncak di $0$. Kebalikannya juga perlu hati-hati: syarat yang gagal tidak membuat kesimpulan salah, hanya tidak dijanjikan. Pilih satu kasus di bawah dan lihat syarat mana yang dilanggarnya. ## Bagaimana Teorema Rolle menghitung penyelesaian suatu persamaan? **Teorema Rolle mengubah pernyataan tentang nol $f$ menjadi pernyataan tentang nol $f'$: di antara dua nol $f$ ada nol $f'$.** Jadi jika $f'$ memiliki $k$ nol, $f$ tidak dapat memiliki lebih dari $k+1$. **Contoh 1.** Tunjukkan bahwa $x^3+3x+1=0$ memiliki tepat satu penyelesaian real. Misalkan $f(x)=x^3+3x+1$, yang kontinu. Karena $f(-1)=-3$ dan $f(0)=1$, Teorema Nilai Antara menyatakan grafik memotong sumbu $x$ di suatu tempat dalam $(-1,0)$, sehingga ada paling sedikit satu penyelesaian. Sekarang andaikan ada dua nol $x=a$ dan $x=b$. Teorema Rolle akan memberi titik $c$ di antara keduanya dengan $f'(c)=0$. Tetapi $$f'(x)=3x^2+3$$ tidak pernah nol, karena selalu paling sedikit $3$. Jadi tidak mungkin ada dua nol, dan ada tepat satu. Penalaran yang sama menghitung akar secara umum. Polinom kubik memiliki turunan kuadrat dengan paling banyak dua nol, sehingga polinom kubik memiliki paling banyak tiga nol real. Untuk polinom dengan $n$ nol real berbeda, setiap dari $n-1$ celah antara nol bertetangga memuat nol $f'$, dan $f'$ berderajat $n-1$, sehingga itulah semua nolnya: tepat satu di setiap celah. Pilih nol di bawah dan lihat hal itu terjadi; titik dengan garis singgung mendatar selalu terjepit di antara dua nol. ## Apa isi Teorema Nilai Rata-rata? **Teorema Nilai Rata-rata adalah versi miring dari Teorema Rolle: jika $y=f(x)$ kontinu pada $[a,b]$ dan terdiferensialkan pada $(a,b)$, maka ada paling sedikit satu titik $c$ di $(a,b)$ tempat** $$\frac{f(b)-f(a)}{b-a}=f'(c).$$ Secara geometri, ruas kiri adalah gradien tali busur melalui $A(a,f(a))$ dan $B(b,f(b))$, dan ruas kanan adalah gradien garis singgung di $c$: di suatu tempat antara $a$ dan $b$ kurva memiliki garis singgung yang sejajar dengan tali busur. Ketika $f(a)=f(b)$ tali busur mendatar dan ini adalah Teorema Rolle. Bukti. Tali busur adalah grafik dari $$g(x)=f(a)+\frac{f(b)-f(a)}{b-a}(x-a).$$ Jarak tegak antara grafik $f$ dan tali busur adalah $$h(x)=f(x)-g(x)$$ $$h(x)=f(x)-f(a)-\frac{f(b)-f(a)}{b-a}(x-a).$$ Fungsi $h$ kontinu pada $[a,b]$ dan terdiferensialkan pada $(a,b)$ karena $f$ dan $g$ demikian, dan $h(a)=h(b)=0$ karena kedua grafik melalui $A$ dan $B$. Jadi Teorema Rolle memberi titik $c$ di $(a,b)$ dengan $h'(c)=0$. Dengan menurunkan $h$ dan mengambil $x=c$: $$h'(c)=f'(c)-\frac{f(b)-f(a)}{b-a}=0,$$ yang merupakan persamaan pada teorema. ∎ **Apa yang dibutuhkan, dan apa yang tidak.** Kekontinuan pada selang tertutup dan keterdiferensialan di dalam adalah semua yang dipakai bukti. Khususnya $f$ tidak harus terdiferensialkan di $a$ atau di $b$: kekontinuan satu sisi sudah cukup. Fungsi $f(x)=\sqrt{1-x^2}$ pada $[-1,1]$ memiliki garis singgung tegak di kedua ujung, namun memenuhi teorema, dengan $c=0$. **Apa yang tidak dikatakan.** Teorema ini tidak menyatakan hanya ada satu titik, dan tidak memberi rumus untuk $c$; ia hanya menyatakan paling sedikit satu ada. Ketik fungsi dan selang di bawah, atau pilih contoh. Garis oranye adalah tali busur, garis hijau adalah garis singgung di titik yang dijanjikan teorema, dan dua kasus tempat syaratnya gagal menunjukkan apa yang tidak dicakup teorema. ## Bagaimana mencari titik c? **Untuk mencari $c$, hitung gradien tali busur $m=\frac{f(b)-f(a)}{b-a}$, selesaikan $f'(c)=m$, dan simpan penyelesaian yang berada di dalam selang terbuka $(a,b)$.** Teorema menjamin daftarnya tidak kosong ketika syaratnya terpenuhi. **Contoh 2.** $f(x)=x^2$ pada $[0,2]$. Gradiennya $\frac{4-0}{2-0}=2$ dan $f'(c)=2c=2$, sehingga $c=1$. **Contoh 3.** $f(x)=x^2+2x-1$ pada $[0,1]$. Gradiennya $\frac{2-(-1)}{1-0}=3$, dan $f'(c)=2c+2=3$ memberi $c=\frac12$. **Contoh 4.** $f(x)=x^{2/3}$ pada $[0,1]$. Gradiennya $1$ dan $f'(c)=\frac23c^{-1/3}=1$ memberi $c^{1/3}=\frac23$, sehingga $c=\frac{8}{27}$. Titik puncak ada di $0$, sebuah ujung selang, sehingga $f$ terdiferensialkan di dalam dan teorema berlaku. **Contoh 5.** $f(x)=x^3-x^2$ pada $[-1,2]$. Gradiennya $\frac{4-(-2)}{3}=2$, dan $f'(c)=3c^2-2c=2$ memberi $$3c^2-2c-2=0\qquad c=\frac{1\pm\sqrt7}{3}.$$ Baik $c\approx-0{,}549$ maupun $c\approx1{,}215$ berada di $(-1,2)$, sehingga ada dua titik. Teorema menyatakan "paling sedikit satu". **Dua rata-rata.** Untuk $f(x)=\frac1x$ pada selang $[a,b]$ bilangan positif, gradiennya $-\frac1{ab}$ dan $f'(c)=-\frac1{c^2}$, sehingga $c=\sqrt{ab}$, rata-rata geometri $a$ dan $b$. Untuk $f(x)=x^2$ menjadi $2c=a+b$, sehingga $c=\frac{a+b}{2}$, rata-rata aritmetika. Memang untuk setiap kuadrat $px^2+qx+r$ gradien tali busur adalah $p(a+b)+q$ dan $f'(c)=2pc+q$, sehingga $c$ selalu titik tengah, dan itulah satu-satunya titik seperti itu. **Ketika c tidak dapat dituliskan.** Untuk $f(x)=xe^x$ pada $[0,1]$ gradiennya $e$ dan persamaannya $(1+c)e^c=e$. Persamaan ini memiliki tepat satu penyelesaian di $(0,1)$, tetapi tidak ada rumus elementernya; komputer menemukan $c\approx0{,}5571$. Teorema ini berharga karena menjanjikan $c$ tanpa perlu menghitungnya. ## Apa kata teorema tentang kecepatan dan laju rata-rata? **Dibaca sebagai pernyataan tentang laju, Teorema Nilai Rata-rata menyatakan bahwa laju perubahan rata-rata pada suatu selang adalah laju sesaat di suatu titik dalam.** Bilangan $\frac{f(b)-f(a)}{b-a}$ adalah perubahan rata-rata $f$ pada $[a,b]$, dan $f'(c)$ adalah perubahan sesaat; teorema menyatakan keduanya bertemu. Teorema ini berlaku untuk apa pun yang lajunya adalah turunan, seperti pada [gerak sepanjang garis](https://nunada.my.id/artikel/turunan-sebagai-laju-perubahan/#motion-along-a-line) di artikel laju perubahan. **Contoh 6.** Mobil yang berakselerasi dari diam membutuhkan $8$ detik untuk menempuh $176$ m. Kecepatan rata-ratanya $\frac{176}{8}=22$ m/detik, sehingga pada suatu saat selama akselerasi spidometer pasti menunjukkan tepat $22$ m/detik, yaitu $22\times3{,}6=79{,}2$ km/jam. Jika mobil itu memiliki $s=2{,}75t^2$, yang memang cocok dengan $176$ m di $t=8$, maka $v=s'=5{,}5t$ sama dengan $22$ di $t=4$ detik. **Surat tilang.** Seorang pengemudi truk menyerahkan karcis di gerbang tol yang menunjukkan ia menempuh $230$ km jalan tol berbatas $100$ km/jam dalam $2$ jam. Kecepatan rata-ratanya $115$ km/jam, sehingga menurut teorema truk itu melaju tepat $115$ km/jam pada suatu saat, di atas batas: tilang dibenarkan tanpa ada yang melihat kecepatannya. **Contoh serupa.** - Termometer yang dipindahkan dari pembeku bersuhu $-19$ °C ke air mendidih $100$ °C dan dibaca setelah $14$ detik naik rata-rata $\frac{119}{14}=8{,}5$ °C per detik, sehingga pada suatu saat air raksa naik tepat $8{,}5$ °C/detik. - Kapal trireme yang menempuh $184$ mil laut dalam $24$ jam rata-rata melaju $7{,}67$ knot, sehingga pada suatu titik kecepatannya melebihi $7{,}5$ knot. - Pelari maraton yang menempuh $42$ km dalam $2{,}2$ jam rata-rata melaju $19{,}09$ km/jam. Kecepatannya $19{,}09$ km/jam pada suatu saat, menurut teorema. Ia mulai dari $0$ dan berakhir di $0$, dan kecepatan yang berubah kontinu tidak dapat melompati nilai (Teorema Nilai Antara), sehingga ia melewati $18$ km/jam sekali saat naik dan sekali lagi saat turun: paling sedikit dua kali. **Apa yang tidak dikatakan.** Teorema menjanjikan suatu saat, bukan bahwa kecepatan bertahan di rata-rata, dan tidak menyatakan kapan. Ini pernyataan keberadaan, dan itulah yang dibutuhkan bukti atau argumen hukum. ## Apa akibatnya jika dua fungsi memiliki turunan yang sama? **Pertanyaan pertama yang dijawab teorema ini adalah fungsi mana yang berturunan nol: hanya yang konstan.** Akibat 1: jika $f'(x)=0$ di setiap titik pada selang terbuka $(a,b)$, maka $f(x)=C$ untuk semua $x$ di $(a,b)$, dengan $C$ konstanta. Bukti. Ambil dua titik mana pun $x_1', mvt_points(f, a, b)) # x**2 [0, 2] -> (2, {1}) # x**3 - x**2 [-1, 2] -> (2, {1/3 - sqrt(7)/3, 1/3 + sqrt(7)/3}) # 1/x [1, 4] -> (-1/4, {2}) # sqrt(1 - x**2) [-1, 1] -> (0, {0}) # sin(x) [0, 3*pi] -> (0, {pi/2, 3*pi/2, 5*pi/2}) # Abs(x) [-1, 2] -> (1/3, EmptySet) ``` ```javascript const mvt = (f, df, a, b, n = 4000) => { const slope = (f(b) - f(a)) / (b - a) const g = (x) => df(x) - slope // the points c are the zeros of g const cs = [] for (let i = 0; i < n; i++) { let lo = a + ((b - a) * i) / n let hi = a + ((b - a) * (i + 1)) / n if (g(lo) === 0 && i > 0) cs.push(lo) // a zero that falls exactly on a grid point else if (g(lo) * g(hi) < 0) { // g changes sign: bisect for (let k = 0; k < 60; k++) { const mid = (lo + hi) / 2 if (g(lo) * g(mid) <= 0) hi = mid else lo = mid } const c = (lo + hi) / 2 if (Math.abs(g(c)) < 1e-6) cs.push(c) // a corner makes g jump across 0: that is not a zero } } return { slope, cs } } mvt((x) => x * x, (x) => 2 * x, 0, 2) // slope 2, cs [1] mvt((x) => x ** 3 - x ** 2, (x) => 3 * x * x - 2 * x, -1, 2) // slope 2, cs [-0.5486, 1.2153] mvt((x) => x * Math.exp(x), (x) => (1 + x) * Math.exp(x), 0, 1) // slope e = 2.7183, cs [0.5571] mvt((x) => 1 / x, (x) => -1 / (x * x), 1, 4) // slope -0.25, cs [2] mvt(Math.abs, Math.sign, -1, 2) // slope 0.3333, cs []: the corner at 0 is rejected ``` ```cpp #include #include #include using namespace std; double f(int k, double x) { if (k == 0) return x * x * x - x * x; // Example 5 on [-1, 2] if (k == 1) return x * exp(x); // no formula for c, on [0, 1] return 1 / x; // the geometric mean, on [1, 4] } double df(int k, double x) { if (k == 0) return 3 * x * x - 2 * x; if (k == 1) return (1 + x) * exp(x); return -1 / (x * x); } void mvt(int k, double a, double b) { double slope = (f(k, b) - f(k, a)) / (b - a); int n = 2000; for (int i = 0; i < n; i++) { double lo = a + (b - a) * i / n; double hi = a + (b - a) * (i + 1) / n; if ((df(k, lo) - slope) * (df(k, hi) - slope) < 0) { // f' - slope changes sign: bisect for (int j = 0; j < 60; j++) { double mid = (lo + hi) / 2; if ((df(k, lo) - slope) * (df(k, mid) - slope) <= 0) hi = mid; else lo = mid; } double c = (lo + hi) / 2; printf("slope=%.4f c=%.4f f'(c)=%.4f\n", slope, c, df(k, c)); } } } int main() { mvt(0, -1, 2); mvt(1, 0, 1); mvt(2, 1, 4); printf("%.4f %.4f\n", sqrt(1.0 * 4), (1.0 + 4) / 2); // the geometric and the arithmetic mean of 1 and 4 return 0; } /* output: slope=2.0000 c=-0.5486 f'(c)=2.0000 slope=2.0000 c=1.2153 f'(c)=2.0000 slope=2.7183 c=0.5571 f'(c)=2.7183 slope=-0.2500 c=2.0000 f'(c)=-0.2500 2.0000 2.5000 */ ``` ## Dari mana asal Teorema Nilai Rata-rata? **Teorema ini lebih tua daripada definisi turunan yang dipakai menyatakannya, dan mula-mula dibuktikan untuk polinom.** - **Parameshvara, abad ke-15.** Astronom India Parameshvara dari aliran Kerala dianggap menemukan kasus khusus teorema ini, untuk fungsi sinus. - **Rolle, 1691.** Michel Rolle menunjukkan, untuk persamaan polinom, bahwa di antara dua akar terdapat akar turunan, sebagai langkah dalam metode memisahkan akar. Ia seorang pengkritik kalkulus infinitesimal yang baru, dan nama teorema Rolle diberikan pada hasil ini pada abad ke-19 (oleh Giusto Bellavitis, tahun 1846). - **Lagrange, 1797.** Joseph-Louis Lagrange menyatakan Teorema Nilai Rata-rata dan memakainya sebagai dasar upayanya membangun kalkulus di atas deret pangkat. Nama lainnya, teorema nilai rata-rata Lagrange, berasal dari sini. - **Cauchy, 1823.** Augustin-Louis Cauchy, dengan turunan yang didefinisikan sebagai limit, memberi bukti dengan Teorema Rolle yang dipakai di buku sekarang, dan perampatan untuk dua fungsi, $\frac{f(b)-f(a)}{g(b)-g(a)}=\frac{f'(c)}{g'(c)}$, yang darinya aturan l'Hôpital untuk limit diturunkan. ## Kesalahan apa yang sering terjadi pada teorema ini? **Kesalahan paling umum pada Teorema Nilai Rata-rata adalah sembilan hal berikut, masing-masing dengan pernyataan yang benar.** | Kesalahan | Yang benar | |---|---| | ❌ Hanya ada tepat satu titik $c$ | Teorema menyatakan paling sedikit satu: $x^3-x^2$ pada $[-1,2]$ memiliki dua, dan $\sin x$ pada $[0,3\pi]$ memiliki tiga garis singgung mendatar. | | ❌ Memakainya pada $|x|$ di $[-1,2]$ | Ada sudut di $0$, sehingga $f$ tidak terdiferensialkan di dalam; gradien tali busur $\frac13$ dan tidak ada garis singgung dengan gradien itu. | | ❌ Memakainya pada $\frac1x$ di $[-1,1]$ | $f$ tidak kontinu di sana, bahkan tak terdefinisi di $0$, sehingga tidak ada yang dijanjikan. | | ❌ $f$ harus terdiferensialkan di ujung selang | Hanya kekontinuan di ujung yang diperlukan: $\sqrt{1-x^2}$ pada $[-1,1]$ berlaku, dengan $c=0$. | | ❌ Teorema menyatakan $f(c)$ adalah rata-rata nilai $f$ | Teorema menyatakan $f'(c)$ adalah laju rata-rata, $\frac{f(b)-f(a)}{b-a}$; rata-rata nilai adalah urusan integral. | | ❌ $f'=0$ pada $(-1,0)\cup(0,1)$, jadi $f$ konstan | Himpunannya harus satu selang: $f(x)=\frac{x}{|x|}$ memiliki $f'=0$ di mana pun terdefinisi dan bernilai $-1$ lalu $1$. | | ❌ $c$ selalu titik tengah $\frac{a+b}{2}$ | Hanya untuk kuadrat: $x^3$ pada $[0,2]$ memiliki $c=\frac{2}{\sqrt3}\approx1{,}155$, bukan $1$. | | ❌ Jika $f'=g'$ maka $f=g$ | Keduanya berbeda oleh konstanta: $x^2$ dan $x^2+3$ memiliki turunan yang sama. | | ❌ Kecepatan rata-rata $115$ km/jam berarti kecepatannya selalu $115$ | Teorema memberi paling sedikit satu saat dengan kecepatan itu, bukan semuanya. | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: Teorema Nilai Rata-rata sekilas - **Teorema Rolle:** $f$ kontinu pada $[a,b]$, terdiferensialkan pada $(a,b)$, $f(a)=f(b)$ memberi suatu $c$ dengan $f'(c)=0$. - **Teorema Nilai Rata-rata:** dua syarat yang sama memberi suatu $c$ dengan $f'(c)=\frac{f(b)-f(a)}{b-a}$, garis singgung sejajar tali busur. - **Bukti:** terapkan Teorema Rolle pada $h(x)=f(x)-f(a)-\frac{f(b)-f(a)}{b-a}(x-a)$. - **Waspadai:** sudut, titik puncak, dan kutub di dalam selang; titik $c$ tidak tunggal dan umumnya tidak punya rumus. - **Laju:** laju rata-rata pada suatu selang adalah laju sesaat di suatu saat di dalamnya. - **Akibat:** $f'=0$ pada suatu selang berarti konstan; $f'=g'$ berarti $f=g+C$. - **Batas:** $m\le f'\le M$ memberi $m(b-a)\le f(b)-f(a)\le M(b-a)$. - **Berikutnya:** tanda $f'$ pada suatu selang menunjukkan di mana $f$ naik dan turun, topik artikel berikutnya. - **Kode:** `sp.solveset(sp.diff(f, x) - slope, x, sp.Interval.open(a, b))`, atau pemindaian dengan bisection yang menolak lompatan. ## Glosarium: istilah penting - **Teorema Rolle**: Teorema bahwa fungsi kontinu pada [a, b], terdiferensialkan pada (a, b), dan sama di kedua ujung memiliki titik di dalam tempat turunannya nol. - **Teorema Nilai Rata-rata**: Teorema bahwa fungsi kontinu pada [a, b] dan terdiferensialkan pada (a, b) memiliki titik di dalam tempat garis singgung sejajar dengan tali busur melalui ujungnya. - **Tali busur**: Garis melalui dua titik pada grafik; gradiennya adalah laju perubahan rata-rata di antara keduanya. - **Laju perubahan rata-rata**: Perubahan nilai fungsi dibagi perubahan peubah pada suatu selang: gradien tali busur. - **Antiturunan**: Fungsi yang turunannya adalah fungsi yang diberikan; pada suatu selang, dua antiturunan mana pun berbeda oleh konstanta. - **Akibat**: Pernyataan yang mengikuti langsung dari suatu teorema; hasil turunan nol dan turunan sama mengikuti dari Teorema Nilai Rata-rata. ## Pertanyaan yang sering diajukan ### Apa itu Teorema Nilai Rata-rata? Teorema ini menyatakan bahwa jika fungsi kontinu pada selang tertutup dan terdiferensialkan di dalamnya, maka di suatu titik di dalam, gradien garis singgung sama dengan gradien tali busur melalui kedua ujung. Laju sesaat sama dengan laju rata-rata di suatu tempat. ### Apa beda Teorema Rolle dan Teorema Nilai Rata-rata? Teorema Rolle adalah kasus khusus tempat fungsi bernilai sama di kedua ujung, sehingga tali busur mendatar dan garis singgung di titik yang dijanjikan juga mendatar. Teorema Nilai Rata-rata memiringkan gambar itu untuk tali busur mana pun. ### Mengapa Teorema Nilai Rata-rata memerlukan kekontinuan dan keterdiferensialan? Kekontinuan pada selang tertutup membuat nilai ekstrem ada, dan keterdiferensialan di dalam membuat garis singgung ada di sana. Tanpa keduanya mungkin tidak ada garis singgung dengan gradien yang tepat, seperti fungsi nilai mutlak pada selang yang memuat sudutnya. ### Bagaimana mencari nilai c? Hitung gradien tali busur, yaitu perubahan fungsi dibagi perubahan x, lalu selesaikan persamaan yang menyamakan turunan dengannya. Simpan penyelesaian yang benar-benar di antara kedua ujung; bisa lebih dari satu. ### Apakah titik c pada Teorema Nilai Rata-rata tunggal? Tidak. Teorema menjamin paling sedikit satu. Fungsi x pangkat tiga dikurangi x kuadrat pada selang dari minus 1 sampai 2 memiliki dua titik seperti itu, dan sinus pada selang dari 0 sampai 3 pi memiliki tiga garis singgung mendatar. ### Apa kata Teorema Nilai Rata-rata tentang kecepatan? Benda bergerak pasti memiliki kecepatan sesaat yang sama dengan kecepatan rata-ratanya pada suatu saat. Mobil yang menempuh 176 meter dalam 8 detik pasti menunjukkan tepat 22 meter per detik pada suatu saat, dan truk yang rata-rata 115 kilometer per jam pasti pernah tepat 115. ### Mengapa turunan nol berarti fungsi konstan? Untuk dua titik mana pun pada selang, Teorema Nilai Rata-rata menyatakan perubahan fungsi sama dengan turunan di suatu tempat di antaranya dikali jaraknya. Jika turunan nol di mana-mana, perubahannya nol, sehingga semua nilainya sama. ### Bagaimana Teorema Nilai Rata-rata dipakai untuk membuktikan pertidaksamaan? Jika turunan tetap di antara dua bilangan, perubahan fungsi berada di antara bilangan-bilangan itu dikali panjang selang. Karena turunan sinus besarnya paling banyak 1, selisih sinus b dan sinus a paling banyak b dikurangi a. --- # Extreme Values of Functions on Closed Intervals Source: https://nunada.my.id/articles/extreme-values-on-closed-intervals/ Updated: 2026-10-21 ## Quick answer **A continuous function on a closed, bounded interval $[a,b]$ always has an absolute maximum and an absolute minimum (the Extreme Value Theorem), and they can occur only at the endpoints or at critical points, where $f'=0$ or $f'$ does not exist.** So to find them, list the critical points inside $(a,b)$, evaluate $f$ at those points and at $a$ and $b$, and take the largest and the smallest value. ### Key takeaways - An absolute maximum $f(c)$ satisfies $f(x)\le f(c)$ for every $x$ in the domain, and an absolute minimum satisfies $f(x)\ge f(c)$; they depend on the domain, not only on the formula. - Extreme Value Theorem: if $f$ is continuous on a closed interval $[a,b]$, it attains both an absolute maximum $M$ and an absolute minimum $m$ there; closed, bounded and continuous are all needed. - First Derivative Theorem: if $f$ has a local maximum or minimum at an interior point $c$ where $f'$ exists, then $f'(c)=0$. - A critical point is an interior point where $f'$ is $0$ or does not exist; it is only a candidate, as $x^3$ and $\sqrt[3]{x}$ show at $0$. - Closed interval method: find the critical points in the interval, evaluate $f$ at them and at the endpoints, and compare; the largest value is the maximum and the smallest the minimum. - Every endpoint is a candidate, a corner or a cusp can hold an extreme ($|x|$ at $0$, $x^{2/3}$ at $0$), and a critical point outside the interval does not count. ## What are the absolute maximum and minimum of a function? **A function $f$ with domain $D$ has an absolute maximum value at $c$ if $f(x)\le f(c)$ for all $x$ in $D$, and an absolute minimum value at $c$ if $f(x)\ge f(c)$ for all $x$ in $D$.** Maximum and minimum values are called extreme values (or extrema) of the function, and absolute maxima and minima are also called global maxima and minima. The value is a number, $f(c)$, and the place where it is taken is a point, $c$: the maximum of $y=x^2$ on $[0,2]$ is $4$, taken at $x=2$. The extremes depend on the domain and not only on the formula. On the closed interval $\left[-\frac\pi2,\frac\pi2\right]$ the function $\cos x$ takes the absolute maximum $1$ (once, at $0$) and the absolute minimum $0$ (twice, at both ends), while $\sin x$ takes the maximum $1$ and the minimum $-1$. A value can be taken at more than one place. **Example 1.** All four functions below have the same rule $y=x^2$, but the domains differ. | Domain $D$ | Absolute extrema of $y=x^2$ on $D$ | |---|---| | $(-\infty,\infty)$ | no absolute maximum; absolute minimum $0$ at $x=0$ | | $[0,2]$ | absolute maximum $4$ at $x=2$; absolute minimum $0$ at $x=0$ | | $(0,2]$ | absolute maximum $4$ at $x=2$; no absolute minimum | | $(0,2)$ | no absolute maximum and no absolute minimum | So a function might have no maximum or minimum if the domain is not bounded or does not contain an endpoint. On $(0,2]$ the values $0.01$, $0.0001$, $0.000001$, … keep getting smaller, and there is no smallest one: $0$ would be the smallest, but $0$ is not in the domain. The next section says exactly when this cannot happen. ## When is a maximum or a minimum guaranteed? **The Extreme Value Theorem says that if $f$ is continuous on a closed interval $[a,b]$, then $f$ attains both an absolute maximum value $M$ and an absolute minimum value $m$ in $[a,b]$.** That is, there are numbers $x_1$ and $x_2$ in $[a,b]$ with $f(x_1)=m$, $f(x_2)=M$, and $m\le f(x)\le M$ for all $x$ in $[a,b]$. The proof needs a careful knowledge of the real numbers (their completeness) and is not given here. It also does not say where the extremes are: they may be at interior points, at the endpoints, or one of each. The three requirements, closed, bounded and continuous, are all essential. Without one of them the conclusion can fail: - not closed: $y=x^2$ on $(0,2]$ has no minimum, and on $(0,2)$ neither; - not bounded: $y=x^2$ on $(-\infty,\infty)$ has no maximum, and $y=e^x$ on $(-\infty,\infty)$ has neither; - not continuous: the function $y=x$ for $0\le x<1$ and $y=0$ at $x=1$ is continuous at every point of $[0,1]$ except $x=1$, yet it has no highest point: the values come as near to $1$ as we like and never reach it. The theorem gives a guarantee and not an equivalence. A function that fails a hypothesis may still have extremes (the function above has the minimum $0$), but only when the three hold are we sure. Look at the six cases below, and at which condition each one breaks. ## What are local extreme values? **A function $f$ has a local maximum at $c$ if $f(x)\le f(c)$ for all $x$ of the domain in some open interval around $c$, and a local minimum if $f(x)\ge f(c)$ there; local extrema are also called relative extrema.** The word local means that only the neighbours of $c$ are compared, and not the whole domain. At an endpoint $x=a$ of $[a,b]$ the neighbours are the $x$ in a half-open interval $[a,a+\delta)$, and at $x=b$ those in $(b-\delta,b]$. An absolute maximum is also a local maximum, because it is the largest value overall and so also the largest in its neighbourhood; the list of local maxima therefore includes the absolute maximum if there is one, and the same holds for minima. The converse is false. For $f(x)=x^3-3x$ on $[-2,3]$ the local maximum $f(-1)=2$ is far below the absolute maximum $f(3)=18$, and the local minimum $f(1)=-2$ equals the endpoint value $f(-2)=-2$, so the absolute minimum is taken twice. A function can have many local extrema, even on a finite interval: $f(x)=\sin\frac1x$ on $(0,1]$ has infinitely many. ## What is a critical point, and why do extremes sit on them? **First Derivative Theorem for local extreme values: if $f$ has a local maximum or minimum at an interior point $c$ of its domain, and $f'$ is defined at $c$, then $f'(c)=0$.** The tangent line there has to be horizontal, because a slope that is not zero would let $f$ climb on one side of $c$. Proof. Suppose $f$ has a local maximum at $c$, so $f(x)-f(c)\le0$ for $x$ near $c$. Because $c$ is an interior point, $f'(c)=\lim_{x\to c}\frac{f(x)-f(c)}{x-c}$ is a two-sided limit: the right-hand and left-hand limits both exist and equal $f'(c)$. From the right, $x-c>0$ and $f(x)-f(c)\le0$, so the quotient is $\le0$: $$f'(c)=\lim_{x\to c^+}\frac{f(x)-f(c)}{x-c}\le0.$$ From the left, $x-c<0$ and $f(x)-f(c)\le0$, so the quotient is $\ge0$: $$f'(c)=\lim_{x\to c^-}\frac{f(x)-f(c)}{x-c}\ge0.$$ Together $f'(c)=0$. For a local minimum reverse the inequalities. ∎ **Where extremes can be.** Since all the domains here are intervals, a function can have an extreme value (local or absolute) only at 1. interior points where $f'=0$, 2. interior points where $f'$ does not exist, 3. endpoints of the interval. **Definition.** An interior point of the domain of $f$ where $f'$ is zero or does not exist is a critical point of $f$. So the only places where a continuous function on a closed, bounded interval can take an extreme value are its critical points and its endpoints. The second kind of critical point is a real possibility: the [derivative does not exist](https://nunada.my.id/articles/tangent-lines-and-derivative-at-a-point/#no-derivative) at a corner, a cusp or a vertical tangent line, and the [derivative function](https://nunada.my.id/articles/the-derivative-as-a-function/#where-defined) may be undefined elsewhere too. **A critical point is only a candidate.** $y=x^3$ has $y'=3x^2=0$ at $x=0$, and $y=x^{1/3}$ has $y'=\frac13x^{-2/3}$ undefined at $x=0$, yet neither has a local extreme value at $0$: each is increasing through the origin, and each has a point of inflection there. Conversely, an extreme value can sit where there is no derivative at all: $f(x)=|x|$ has an absolute minimum at $x=0$ although it is not differentiable there, which is consistent with the theorem, because the theorem only speaks about points where $f'$ is defined. ## How do you find the absolute extrema on a closed interval? **To find the absolute extrema of a continuous function $f$ on a finite closed interval, find all the critical points of $f$ in the interval, evaluate $f$ at all critical points and at the endpoints, and take the largest and the smallest of these values.** The Extreme Value Theorem makes sure that the extremes exist, and the First Derivative Theorem makes sure that no other place has to be examined. **Example 2.** Find the absolute maximum and minimum of $f(x)=x^2$ on $[-2,1]$. The function is differentiable everywhere, so the only critical point is where $f'(x)=2x=0$, namely $x=0$. The values are $$f(0)=0\qquad f(-2)=4\qquad f(1)=1,$$ so the absolute maximum is $4$ at $x=-2$ and the absolute minimum is $0$ at $x=0$. **Example 3.** Find the absolute maximum and minimum of $f(x)=10x(2-\ln x)$ on $\left[1,e^2\right]$. The derivative is $$f'(x)=10(2-\ln x)+10x\left(-\frac1x\right)$$ $$f'(x)=10(1-\ln x),$$ which is $0$ only where $\ln x=1$, at $x=e$, inside the interval. The values are $$f(e)=10e\qquad f(1)=20$$ $$f\left(e^2\right)=10e^2(2-2)=0.$$ Since $10e\approx27.2$, the absolute maximum is $10e$ at the critical point $x=e$, and the absolute minimum is $0$ at the right endpoint $x=e^2$. **Example 4.** Find the absolute maximum and minimum of $f(x)=x^{2/3}$ on $[-2,3]$. The derivative $f'(x)=\frac23x^{-1/3}$ has no zero, but it is undefined at the interior point $x=0$, which is therefore the only critical point. The values are $$f(0)=0\qquad f(-2)=\sqrt[3]{4}\approx1.59$$ $$f(3)=\sqrt[3]{9}\approx2.08.$$ The absolute maximum is $\sqrt[3]{9}\approx2.08$ at the right endpoint $x=3$ and the absolute minimum is $0$ at $x=0$, where the graph has a cusp. Try the method yourself below: type a function and a closed interval, or choose one of the examples, and read the table of candidates. ## What is the biggest box, the peak current and the highest point? **The closed interval method answers questions that ask for the best value of something: cut squares of side $x$ from the corners of a $10$ by $16$ sheet and fold up the sides, and the volume is $V(x)=x(10-2x)(16-2x)$ for $0\le x\le5$, whose largest value is $144$ at $x=2$.** The derivative is $$V'(x)=12x^2-104x+160$$ $$V'(x)=4(3x-20)(x-2),$$ so the critical points are $x=2$ and $x=\frac{20}{3}$; the second is outside $[0,5]$ and does not count. The values at the candidates are $V(0)=0$, $V(2)=144$ and $V(5)=0$. The absolute maximum is $144$ cubic units, from squares of side $2$ and a box $6$ by $12$ by $2$, and the extreme values at the endpoints are the smallest: no box at all. Change the sheet below; for a sheet $w$ by $l$ the critical point inside is $x=\frac{(w+l)-\sqrt{w^2-wl+l^2}}{6}$. **The peak of an alternating current.** If $i=2\cos t+2\sin t$ amperes at time $t$ seconds, then $i'=-2\sin t+2\cos t=0$ when $\tan t=1$, that is $t=\frac\pi4$ and $t=\frac{5\pi}{4}$ in $[0,2\pi]$. The values are $i\left(\frac\pi4\right)=2\sqrt2$, $i\left(\frac{5\pi}{4}\right)=-2\sqrt2$ and $i(0)=i(2\pi)=2$, so the peak current, the largest magnitude, is $2\sqrt2\approx2.83$ A. **The highest point of a body.** A body moving vertically has the height $s=-\frac12gt^2+v_0t+s_0$, with $s$ in meters and $t$ in seconds. Then $s'=-gt+v_0=0$ at $t=\frac{v_0}{g}$, the moment the velocity is zero, and the maximum height is $s_0+\frac{v_0^2}{2g}$. With $v_0=20$ m/s, $s_0=5$ m and $g=9.8$ m/s², that is $5+\frac{400}{19.6}\approx25.4$ m, reached after about $2.04$ s. **Beyond closed intervals.** If the interval is not closed or not bounded, an extreme value may not exist at all, as the four domains of $y=x^2$ show. Such problems need more than the three steps above: the sign of $f'$ on both sides of each critical point, or the limits at the open ends. ## How do you find extreme values in code? **In code the closed interval method is three loops: scan for the critical points, evaluate at every candidate, and keep the largest and the smallest.** SymPy does it exactly: `sp.solveset(df, x, interval)` returns every solution of $f'=0$ in the interval (the older `sp.solve` can return only one of the periodic solutions of $\cos x-\sin x=0$), `sp.singularities(df, x)` finds where $f'$ does not exist, and `maximum` and `minimum` from `sympy.calculus.util` give the answer directly. Without a CAS, scan for sign changes of $f'$ and refine them by bisection, which is what the C++ program at the end does. ```python import sympy as sp from sympy.calculus.util import maximum, minimum x = sp.symbols('x', real=True) def closed_interval(f, a, b): """The closed interval method: the critical points inside (a, b), then compare the values.""" df = sp.diff(f, x) crit = set(sp.solveset(df, x, sp.Interval.open(a, b))) # f'(c) = 0, every solution in the interval crit |= {c for c in sp.singularities(df, x) if a < c < b} # f' does not exist values = {p: sp.simplify(f.subs(x, p)) for p in sorted({a, b, *crit}, key=float)} return values, max(values.values(), key=float), min(values.values(), key=float) examples = ( (x**2, -2, 1), # Example 2 (10 * x * (2 - sp.log(x)), 1, sp.E**2), # Example 3 (x * (10 - 2 * x) * (16 - 2 * x), 0, 5), # the box of Exercise 67 (2 * sp.cos(x) + 2 * sp.sin(x), 0, 2 * sp.pi), # Exercise 70, the peak current (x**3, -1, 1), # a critical point that is not an extreme value ) for f, a, b in examples: print(f, '->', closed_interval(f, a, b)) # x**2 -> ({-2: 4, 0: 0, 1: 1}, 4, 0) # 10*x*(2 - log(x)) -> ({1: 20, E: 10*E, exp(2): 0}, 10*E, 0) # x*(10 - 2*x)*(16 - 2*x) -> ({0: 0, 2: 144, 5: 0}, 144, 0) # 2*sin(x) + 2*cos(x) -> ({0: 2, pi/4: 2*sqrt(2), 5*pi/4: -2*sqrt(2), 2*pi: 2}, 2*sqrt(2), -2*sqrt(2)) # x**3 -> ({-1: -1, 0: 0, 1: 1}, 1, -1) print(maximum(x**2, x, sp.Interval(-2, 1)), minimum(x**2, x, sp.Interval(-2, 1))) # 4 0 (SymPy's own answer) print(sp.singularities(sp.diff(x ** sp.Rational(2, 3), x), x)) # {0} (Example 4: f' does not exist at 0) ``` ```javascript const best = (f, a, b, critical) => { const pts = [a, ...critical, b].map((x) => [x, f(x)]) return [pts.reduce((m, p) => (p[1] > m[1] ? p : m)), pts.reduce((m, p) => (p[1] < m[1] ? p : m))] // [max, min] } best((x) => x * x, -2, 1, [0]) // [[-2, 4], [0, 0]] best((x) => 10 * x * (2 - Math.log(x)), 1, Math.E ** 2, [Math.E]) // [[2.718281828459045, 27.18281828459045], [7.3890560989306495, 0]] best((x) => Math.cbrt(x) ** 2, -2, 3, [0]) // [[3, 2.080083823051904], [0, 0]]: 0 is where f' does not exist best((x) => x ** 3, -1, 1, [0]) // [[1, 1], [-1, -1]]: 0 is critical but not an extreme ``` ```cpp #include #include #include using namespace std; double f(double x) { return 10 * x * (2 - log(x)); } // Example 3, on [1, e^2] double df(double x) { return 10 * (1 - log(x)); } double clean(double v) { return fabs(v) < 1e-9 ? 0 : v; } // round noise like 1e-15 to 0 double bisect(double lo, double hi) { // a zero of f' between lo and hi for (int i = 0; i < 100; i++) { double mid = (lo + hi) / 2; if (df(lo) * df(mid) <= 0) hi = mid; else lo = mid; } return (lo + hi) / 2; } int main() { double a = 1, b = exp(2.0), cand[12]; int n = 0; cand[n++] = a; // the endpoints are candidates double step = (b - a) / 1000; for (int i = 0; i < 1000; i++) { // step 1: the critical points, where f' changes sign double x0 = a + i * step, x1 = x0 + step; if (df(x0) * df(x1) < 0) cand[n++] = bisect(x0, x1); } cand[n++] = b; double hiX = cand[0], loX = cand[0]; for (int i = 0; i < n; i++) { // steps 2 and 3: evaluate f and compare printf("x = %.4f value %.4f\n", cand[i], clean(f(cand[i]))); if (f(cand[i]) > f(hiX)) hiX = cand[i]; if (f(cand[i]) < f(loX)) loX = cand[i]; } printf("maximum %.4f at x = %.4f; minimum %.4f at x = %.4f\n", f(hiX), hiX, clean(f(loX)), loX); // Example 4: x^(2/3) on [-2, 3]; the only critical point is 0, where f' does not exist printf("%.4f %.4f %.4f\n", pow(fabs(-2.0), 2.0 / 3), 0.0, pow(3.0, 2.0 / 3)); // the box of Exercise 67: V(x) = x (10 - 2x)(16 - 2x) at 0, at the critical point 2 and at 5 printf("%.0f %.0f %.0f\n", 0.0, 2 * (10 - 4.0) * (16 - 4.0), 5 * (10 - 10.0) * (16 - 10.0)); return 0; } /* output: x = 1.0000 value 20.0000 x = 2.7183 value 27.1828 x = 7.3891 value 0.0000 maximum 27.1828 at x = 2.7183; minimum 0.0000 at x = 7.3891 1.5874 0.0000 2.0801 0 144 0 */ ``` ## Where do maxima and minima come from? **The search for the biggest and the smallest is older than the derivative, and the derivative began as a tool for it.** - **Kepler, 1615.** Johannes Kepler, looking for the best shape of a wine barrel, noticed that near the largest volume the volume changes very little when the shape changes a little: the flat top of a curve, the horizontal tangent of the theorem above. - **Fermat, about 1629.** Pierre de Fermat found maxima and minima by comparing $f(x)$ with $f(x+e)$, dividing the (nearly) zero difference by $e$ and then putting $e=0$. That is the condition $f'(x)=0$ before there was a derivative, and the First Derivative Theorem is still called Fermat's theorem on stationary points. - **Newton and Leibniz.** With the derivative as a limit of difference quotients, the argument of the proof above became a few lines. The distinction between a critical point and an extreme, between $x^3$ and $x^2$, was made clear by the second-derivative and sign tests that followed. - **Bolzano and Weierstrass.** The Extreme Value Theorem looks obvious from a graph but cannot be proved without the completeness of the real numbers. Bernard Bolzano gave the first arguments in manuscripts of the 1830s, and Karl Weierstrass proved it in his lectures in the 1860s; this is why the proof is not part of an introductory course. ## What mistakes do people make with extreme values? **The most common mistakes with extreme values are the nine below, each with the correct statement.** | Mistake | Correct | |---|---| | ❌ Look only at the points where $f'=0$ | Evaluate at the endpoints too: for $x^2$ on $[-2,1]$ the maximum $4$ is at $x=-2$, where $f'=-4$. | | ❌ If $f'(c)=0$, then $f$ has a maximum or a minimum at $c$ | $f'(0)=0$ for $y=x^3$, which has no extreme value at $0$: a critical point is only a candidate. | | ❌ Ignore the points where $f'$ does not exist | They are critical points: $x^{2/3}$ has its minimum at $0$, and $|x|$ too. | | ❌ Use the closed interval method on $(0,2)$ or on $[0,\infty)$ | The theorem needs a closed, bounded interval; $x^2$ on $(0,2)$ has no extreme value. | | ❌ Use it on $\frac1x$ over $[-1,2]$ | $f$ is not continuous there (not even defined at $0$), so no extremes are guaranteed. | | ❌ Give the place instead of the value, or the reverse | The maximum value is $4$ and it is taken at $x=2$: report both. | | ❌ A function has only one place for its maximum | $\cos x$ on $\left[-\frac\pi2,\frac\pi2\right]$ takes its minimum $0$ at both ends. | | ❌ Count a critical point that is outside the interval | $V'=0$ at $x=\frac{20}{3}$ for the box, but the interval is $[0,5]$: only $x=2$ counts. | | ❌ A local maximum is the absolute maximum | For $x^3-3x$ on $[-2,3]$ the local maximum is $2$, the absolute maximum is $18$ at $x=3$. | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: extreme values at a glance - **Absolute extremes:** $f(c)\ge f(x)$ (maximum) or $\le$ (minimum) for all $x$ in the domain; they depend on the domain. - **Extreme Value Theorem:** $f$ continuous on a closed, bounded $[a,b]$ has both an absolute maximum and an absolute minimum there. - **First Derivative Theorem:** at an interior local extreme where $f'$ exists, $f'=0$. - **Critical point:** an interior point where $f'=0$ or $f'$ does not exist; a candidate only ($x^3$ at $0$). - **Closed interval method:** critical points in $(a,b)$, values at them and at $a$ and $b$, then the largest and the smallest. - **Watch for:** endpoints, corners and cusps ($|x|$, $x^{2/3}$), critical points outside the interval, breaks inside it. - **Code:** `sp.solveset(df, x, interval)`, `sp.singularities(df, x)`, or a scan for sign changes of $f'$ with bisection. ## Glossary: key terms - **Absolute maximum and minimum**: The largest and the smallest value that a function takes on its whole domain; they are also called global extremes and depend on the domain. - **Extreme Value Theorem**: The theorem that a function continuous on a closed, bounded interval attains both an absolute maximum and an absolute minimum there. - **Local extreme value**: A value that is the largest or the smallest only among the values at points near it; also called a relative extreme. - **Critical point**: An interior point of the domain of a function where the derivative is zero or does not exist; the only places, besides the endpoints, where an extreme value can occur. - **Closed interval method**: The procedure that finds the critical points of a continuous function in a closed interval, evaluates it there and at the endpoints, and takes the largest and the smallest value. - **Cusp**: A point of a graph where the curve has a vertical tangent and the two branches meet at a point, such as x to the two thirds at zero; the derivative does not exist there. ## Frequently asked questions ### What is the Extreme Value Theorem? It says that a function that is continuous on a closed, bounded interval has an absolute maximum and an absolute minimum on that interval. The function takes its largest and its smallest value at least once, at an endpoint or inside. ### How do you find the absolute maximum and minimum on a closed interval? Find the critical points of the function inside the interval, evaluate the function at those points and at both endpoints, and compare. The largest of these values is the absolute maximum and the smallest is the absolute minimum. ### What is a critical point? A critical point is an interior point of the domain of a function where the derivative is zero or does not exist. Together with the endpoints, these are the only places where an extreme value can occur. ### Is every critical point a maximum or a minimum? No. A critical point is only a candidate. The function x cubed has a zero derivative at 0, and the cube root has no derivative at 0, but neither has a maximum or a minimum there, since both keep increasing. ### Can a function have an extreme value where it is not differentiable? Yes. The absolute value function has its minimum at 0, where it has a corner and no derivative, and x to the two thirds has its minimum at 0, a cusp. These are critical points of the second kind. ### What is the difference between absolute and local extrema? An absolute extreme is the largest or smallest value on the whole domain, and a local extreme is the largest or smallest only among nearby points. An absolute maximum is also a local one, but a local maximum need not be absolute. ### Why must the interval be closed for the Extreme Value Theorem? Because an endpoint that is left out can be where the extreme would be. On the interval from 0 to 2 without 0, the function x squared has values as small as we like but no smallest value, since 0 is not allowed. ### Do endpoints count as critical points? By the definition, no: a critical point is an interior point. But the endpoints are always candidates for the absolute extremes, so in the closed interval method you evaluate the function at them too. --- # Nilai Ekstrem Fungsi pada Selang Tertutup Source: https://nunada.my.id/artikel/nilai-ekstrem-pada-selang-tertutup/ Updated: 2026-10-21 ## Jawaban singkat **Fungsi kontinu pada selang tertutup dan terbatas $[a,b]$ selalu memiliki maksimum mutlak dan minimum mutlak (Teorema Nilai Ekstrem), dan keduanya hanya dapat terjadi di ujung selang atau di titik kritis, tempat $f'=0$ atau $f'$ tidak ada.** Jadi untuk mencarinya, daftar titik kritis di dalam $(a,b)$, hitung $f$ di titik-titik itu dan di $a$ serta $b$, lalu ambil nilai terbesar dan terkecil. ### Poin penting - Maksimum mutlak $f(c)$ memenuhi $f(x)\le f(c)$ untuk setiap $x$ di domain, dan minimum mutlak memenuhi $f(x)\ge f(c)$; keduanya bergantung pada domain, bukan hanya pada rumus. - Teorema Nilai Ekstrem: jika $f$ kontinu pada selang tertutup $[a,b]$, ia mencapai maksimum mutlak $M$ dan minimum mutlak $m$ di sana; tertutup, terbatas, dan kontinu semuanya diperlukan. - Teorema Turunan Pertama: jika $f$ memiliki maksimum atau minimum lokal di titik dalam $c$ tempat $f'$ ada, maka $f'(c)=0$. - Titik kritis adalah titik dalam tempat $f'$ bernilai $0$ atau tidak ada; ia hanya kandidat, seperti ditunjukkan $x^3$ dan $\sqrt[3]{x}$ di $0$. - Metode selang tertutup: cari titik kritis di dalam selang, hitung $f$ di titik-titik itu dan di ujung selang, lalu bandingkan; nilai terbesar adalah maksimum dan nilai terkecil adalah minimum. - Setiap ujung selang adalah kandidat, sudut atau titik puncak dapat memuat ekstrem ($|x|$ di $0$, $x^{2/3}$ di $0$), dan titik kritis di luar selang tidak dihitung. ## Apa itu maksimum dan minimum mutlak suatu fungsi? **Fungsi $f$ dengan domain $D$ memiliki nilai maksimum mutlak di $c$ jika $f(x)\le f(c)$ untuk semua $x$ di $D$, dan nilai minimum mutlak di $c$ jika $f(x)\ge f(c)$ untuk semua $x$ di $D$.** Nilai maksimum dan minimum disebut nilai ekstrem (atau ekstrem) fungsi, dan maksimum serta minimum mutlak juga disebut maksimum dan minimum global. Nilainya adalah bilangan, $f(c)$, dan tempat nilai itu dicapai adalah titik, $c$: maksimum $y=x^2$ pada $[0,2]$ adalah $4$, dicapai di $x=2$. Ekstrem bergantung pada domain dan bukan hanya pada rumus. Pada selang tertutup $\left[-\frac\pi2,\frac\pi2\right]$ fungsi $\cos x$ mencapai maksimum mutlak $1$ (sekali, di $0$) dan minimum mutlak $0$ (dua kali, di kedua ujung), sedangkan $\sin x$ mencapai maksimum $1$ dan minimum $-1$. Suatu nilai dapat dicapai di lebih dari satu tempat. **Contoh 1.** Keempat fungsi di bawah memiliki aturan yang sama $y=x^2$, tetapi domainnya berbeda. | Domain $D$ | Ekstrem mutlak $y=x^2$ pada $D$ | |---|---| | $(-\infty,\infty)$ | tidak ada maksimum mutlak; minimum mutlak $0$ di $x=0$ | | $[0,2]$ | maksimum mutlak $4$ di $x=2$; minimum mutlak $0$ di $x=0$ | | $(0,2]$ | maksimum mutlak $4$ di $x=2$; tidak ada minimum mutlak | | $(0,2)$ | tidak ada maksimum mutlak dan tidak ada minimum mutlak | Jadi suatu fungsi mungkin tidak memiliki maksimum atau minimum jika domainnya tidak terbatas atau tidak memuat ujungnya. Pada $(0,2]$ nilai $0{,}01$; $0{,}0001$; $0{,}000001$; … terus mengecil, dan tidak ada yang terkecil: $0$ akan menjadi yang terkecil, tetapi $0$ tidak ada di domain. Bagian berikut menyatakan tepatnya kapan hal ini tidak dapat terjadi. ## Kapan maksimum atau minimum dijamin ada? **Teorema Nilai Ekstrem menyatakan bahwa jika $f$ kontinu pada selang tertutup $[a,b]$, maka $f$ mencapai nilai maksimum mutlak $M$ dan nilai minimum mutlak $m$ di $[a,b]$.** Artinya, ada bilangan $x_1$ dan $x_2$ di $[a,b]$ dengan $f(x_1)=m$, $f(x_2)=M$, dan $m\le f(x)\le M$ untuk semua $x$ di $[a,b]$. Buktinya memerlukan pemahaman cermat tentang bilangan real (kelengkapannya) dan tidak diberikan di sini. Teorema ini juga tidak menyatakan di mana ekstremnya: bisa di titik dalam, di ujung, atau satu di masing-masing. Tiga syaratnya, tertutup, terbatas, dan kontinu, semuanya penting. Tanpa salah satunya kesimpulan dapat gagal: - tidak tertutup: $y=x^2$ pada $(0,2]$ tidak punya minimum, dan pada $(0,2)$ tidak punya keduanya; - tidak terbatas: $y=x^2$ pada $(-\infty,\infty)$ tidak punya maksimum, dan $y=e^x$ pada $(-\infty,\infty)$ tidak punya keduanya; - tidak kontinu: fungsi $y=x$ untuk $0\le x<1$ dan $y=0$ di $x=1$ kontinu di setiap titik $[0,1]$ kecuali $x=1$, namun tidak punya titik tertinggi: nilainya mendekati $1$ sedekat yang kita mau dan tidak pernah mencapainya. Teorema ini memberi jaminan dan bukan kesetaraan. Fungsi yang melanggar suatu syarat mungkin tetap punya ekstrem (fungsi di atas memiliki minimum $0$), tetapi hanya ketika ketiganya terpenuhi kita yakin. Perhatikan enam kasus di bawah, dan syarat mana yang dilanggar masing-masing. ## Apa itu nilai ekstrem lokal? **Fungsi $f$ memiliki maksimum lokal di $c$ jika $f(x)\le f(c)$ untuk semua $x$ di domain pada suatu selang terbuka di sekitar $c$, dan minimum lokal jika $f(x)\ge f(c)$ di sana; ekstrem lokal juga disebut ekstrem relatif.** Kata lokal berarti hanya tetangga $c$ yang dibandingkan, dan bukan seluruh domain. Di ujung $x=a$ pada $[a,b]$ tetangganya adalah $x$ pada selang setengah terbuka $[a,a+\delta)$, dan di $x=b$ adalah yang pada $(b-\delta,b]$. Maksimum mutlak juga maksimum lokal, karena ia nilai terbesar secara keseluruhan sehingga juga terbesar di lingkungannya; daftar maksimum lokal karenanya memuat maksimum mutlak jika ada, dan hal yang sama berlaku untuk minimum. Kebalikannya salah. Untuk $f(x)=x^3-3x$ pada $[-2,3]$ maksimum lokal $f(-1)=2$ jauh di bawah maksimum mutlak $f(3)=18$, dan minimum lokal $f(1)=-2$ sama dengan minimum mutlak $f(-2)=-2$, sehingga minimum itu dicapai dua kali. Suatu fungsi dapat memiliki banyak ekstrem lokal, bahkan pada selang terhingga: $f(x)=\sin\frac1x$ pada $(0,1]$ memiliki tak terhingga banyaknya. ## Apa itu titik kritis, dan mengapa ekstrem berada di sana? **Teorema Turunan Pertama untuk nilai ekstrem lokal: jika $f$ memiliki maksimum atau minimum lokal di titik dalam $c$ pada domainnya, dan $f'$ terdefinisi di $c$, maka $f'(c)=0$.** Garis singgung di sana harus mendatar, karena gradien yang tidak nol akan membuat $f$ naik di salah satu sisi $c$. Bukti. Misalkan $f$ memiliki maksimum lokal di $c$, sehingga $f(x)-f(c)\le0$ untuk $x$ di dekat $c$. Karena $c$ titik dalam, $f'(c)=\lim_{x\to c}\frac{f(x)-f(c)}{x-c}$ adalah limit dua sisi: limit kanan dan limit kiri keduanya ada dan sama dengan $f'(c)$. Dari kanan, $x-c>0$ dan $f(x)-f(c)\le0$, sehingga hasil baginya $\le0$: $$f'(c)=\lim_{x\to c^+}\frac{f(x)-f(c)}{x-c}\le0.$$ Dari kiri, $x-c<0$ dan $f(x)-f(c)\le0$, sehingga hasil baginya $\ge0$: $$f'(c)=\lim_{x\to c^-}\frac{f(x)-f(c)}{x-c}\ge0.$$ Bersama-sama $f'(c)=0$. Untuk minimum lokal balikkan pertidaksamaannya. ∎ **Di mana ekstrem dapat berada.** Karena semua domain di sini adalah selang, suatu fungsi dapat memiliki nilai ekstrem (lokal atau mutlak) hanya di 1. titik dalam tempat $f'=0$, 2. titik dalam tempat $f'$ tidak ada, 3. ujung selang. **Definisi.** Titik dalam domain $f$ tempat $f'$ nol atau tidak ada disebut titik kritis $f$. Jadi satu-satunya tempat fungsi kontinu pada selang tertutup dan terbatas dapat mencapai nilai ekstrem adalah titik kritis dan ujung selangnya. Jenis titik kritis yang kedua adalah kemungkinan nyata: [turunan tidak ada](https://nunada.my.id/artikel/garis-singgung-dan-turunan-di-suatu-titik/#no-derivative) pada sudut, titik puncak, atau garis singgung tegak, dan [fungsi turunan](https://nunada.my.id/artikel/turunan-sebagai-fungsi/#where-defined) dapat tak terdefinisi di tempat lain juga. **Titik kritis hanyalah kandidat.** $y=x^3$ memiliki $y'=3x^2=0$ di $x=0$, dan $y=x^{1/3}$ memiliki $y'=\frac13x^{-2/3}$ yang tak terdefinisi di $x=0$, namun keduanya tidak memiliki nilai ekstrem lokal di $0$: masing-masing naik melalui titik asal, dan masing-masing memiliki titik belok di sana. Sebaliknya, nilai ekstrem dapat berada di tempat yang sama sekali tidak ada turunannya: $f(x)=|x|$ memiliki minimum mutlak di $x=0$ walaupun tidak terdiferensialkan di sana, yang konsisten dengan teorema, karena teorema hanya berbicara tentang titik tempat $f'$ terdefinisi. ## Bagaimana mencari ekstrem mutlak pada selang tertutup? **Untuk mencari ekstrem mutlak fungsi kontinu $f$ pada selang tertutup terhingga, cari semua titik kritis $f$ di dalam selang, hitung $f$ di semua titik kritis dan di ujung selang, lalu ambil nilai terbesar dan terkecil dari nilai-nilai itu.** Teorema Nilai Ekstrem memastikan bahwa ekstremnya ada, dan Teorema Turunan Pertama memastikan bahwa tidak ada tempat lain yang perlu diperiksa. **Contoh 2.** Tentukan maksimum dan minimum mutlak $f(x)=x^2$ pada $[-2,1]$. Fungsi terdiferensialkan di mana-mana, sehingga satu-satunya titik kritis adalah tempat $f'(x)=2x=0$, yaitu $x=0$. Nilainya adalah $$f(0)=0\qquad f(-2)=4\qquad f(1)=1,$$ sehingga maksimum mutlaknya $4$ di $x=-2$ dan minimum mutlaknya $0$ di $x=0$. **Contoh 3.** Tentukan maksimum dan minimum mutlak $f(x)=10x(2-\ln x)$ pada $\left[1,e^2\right]$. Turunannya $$f'(x)=10(2-\ln x)+10x\left(-\frac1x\right)$$ $$f'(x)=10(1-\ln x),$$ yang bernilai $0$ hanya ketika $\ln x=1$, di $x=e$, di dalam selang. Nilainya adalah $$f(e)=10e\qquad f(1)=20$$ $$f\left(e^2\right)=10e^2(2-2)=0.$$ Karena $10e\approx27{,}2$, maksimum mutlaknya $10e$ di titik kritis $x=e$, dan minimum mutlaknya $0$ di ujung kanan $x=e^2$. **Contoh 4.** Tentukan maksimum dan minimum mutlak $f(x)=x^{2/3}$ pada $[-2,3]$. Turunan $f'(x)=\frac23x^{-1/3}$ tidak memiliki nol, tetapi tak terdefinisi di titik dalam $x=0$, yang karenanya satu-satunya titik kritis. Nilainya adalah $$f(0)=0\qquad f(-2)=\sqrt[3]{4}\approx1{,}59$$ $$f(3)=\sqrt[3]{9}\approx2{,}08.$$ Maksimum mutlaknya $\sqrt[3]{9}\approx2{,}08$ di ujung kanan $x=3$ dan minimum mutlaknya $0$ di $x=0$, tempat grafik memiliki titik puncak. Cobalah metodenya sendiri di bawah: ketik fungsi dan selang tertutup, atau pilih salah satu contoh, dan baca tabel kandidatnya. ## Apa kotak terbesar, arus puncak, dan titik tertinggi? **Metode selang tertutup menjawab pertanyaan yang meminta nilai terbaik dari sesuatu: potong persegi bersisi $x$ dari sudut karton $10$ kali $16$ dan lipat sisinya, dan volumenya adalah $V(x)=x(10-2x)(16-2x)$ untuk $0\le x\le5$, yang nilai terbesarnya $144$ di $x=2$.** Turunannya $$V'(x)=12x^2-104x+160$$ $$V'(x)=4(3x-20)(x-2),$$ sehingga titik kritisnya $x=2$ dan $x=\frac{20}{3}$; yang kedua di luar $[0,5]$ dan tidak dihitung. Nilai di kandidatnya adalah $V(0)=0$, $V(2)=144$, dan $V(5)=0$. Maksimum mutlaknya $144$ satuan kubik, dari persegi bersisi $2$ dan kotak $6$ kali $12$ kali $2$, dan nilai ekstrem di ujung selang adalah yang terkecil: tidak ada kotak sama sekali. Ubah karton di bawah; untuk karton $w$ kali $l$ titik kritis di dalamnya adalah $x=\frac{(w+l)-\sqrt{w^2-wl+l^2}}{6}$. **Puncak arus bolak-balik.** Jika $i=2\cos t+2\sin t$ ampere pada waktu $t$ detik, maka $i'=-2\sin t+2\cos t=0$ ketika $\tan t=1$, yaitu $t=\frac\pi4$ dan $t=\frac{5\pi}{4}$ di $[0,2\pi]$. Nilainya $i\left(\frac\pi4\right)=2\sqrt2$, $i\left(\frac{5\pi}{4}\right)=-2\sqrt2$, dan $i(0)=i(2\pi)=2$, sehingga arus puncak, besar terbesar, adalah $2\sqrt2\approx2{,}83$ A. **Titik tertinggi sebuah benda.** Benda yang bergerak vertikal memiliki tinggi $s=-\frac12gt^2+v_0t+s_0$, dengan $s$ dalam meter dan $t$ dalam detik. Maka $s'=-gt+v_0=0$ di $t=\frac{v_0}{g}$, saat kecepatannya nol, dan tinggi maksimumnya $s_0+\frac{v_0^2}{2g}$. Dengan $v_0=20$ m/detik, $s_0=5$ m, dan $g=9{,}8$ m/detik², itu $5+\frac{400}{19{,}6}\approx25{,}4$ m, dicapai setelah sekitar $2{,}04$ detik. **Di luar selang tertutup.** Jika selang tidak tertutup atau tidak terbatas, nilai ekstrem mungkin tidak ada sama sekali, seperti ditunjukkan keempat domain $y=x^2$. Soal seperti itu memerlukan lebih dari tiga langkah di atas: tanda $f'$ di kedua sisi tiap titik kritis, atau limit di ujung yang terbuka. ## Bagaimana mencari nilai ekstrem dengan kode? **Dalam kode metode selang tertutup adalah tiga perulangan: pindai titik kritis, hitung di setiap kandidat, dan simpan yang terbesar dan terkecil.** SymPy melakukannya secara eksak: `sp.solveset(df, x, interval)` mengembalikan setiap solusi $f'=0$ di dalam selang (`sp.solve` yang lama dapat mengembalikan hanya satu dari solusi periodik $\cos x-\sin x=0$), `sp.singularities(df, x)` menemukan tempat $f'$ tidak ada, dan `maximum` serta `minimum` dari `sympy.calculus.util` memberi jawabannya langsung. Tanpa CAS, pindai perubahan tanda $f'$ dan haluskan dengan bisection, yang dilakukan program C++ di akhir. ```python import sympy as sp from sympy.calculus.util import maximum, minimum x = sp.symbols('x', real=True) def closed_interval(f, a, b): """The closed interval method: the critical points inside (a, b), then compare the values.""" df = sp.diff(f, x) crit = set(sp.solveset(df, x, sp.Interval.open(a, b))) # f'(c) = 0, every solution in the interval crit |= {c for c in sp.singularities(df, x) if a < c < b} # f' does not exist values = {p: sp.simplify(f.subs(x, p)) for p in sorted({a, b, *crit}, key=float)} return values, max(values.values(), key=float), min(values.values(), key=float) examples = ( (x**2, -2, 1), # Example 2 (10 * x * (2 - sp.log(x)), 1, sp.E**2), # Example 3 (x * (10 - 2 * x) * (16 - 2 * x), 0, 5), # the box of Exercise 67 (2 * sp.cos(x) + 2 * sp.sin(x), 0, 2 * sp.pi), # Exercise 70, the peak current (x**3, -1, 1), # a critical point that is not an extreme value ) for f, a, b in examples: print(f, '->', closed_interval(f, a, b)) # x**2 -> ({-2: 4, 0: 0, 1: 1}, 4, 0) # 10*x*(2 - log(x)) -> ({1: 20, E: 10*E, exp(2): 0}, 10*E, 0) # x*(10 - 2*x)*(16 - 2*x) -> ({0: 0, 2: 144, 5: 0}, 144, 0) # 2*sin(x) + 2*cos(x) -> ({0: 2, pi/4: 2*sqrt(2), 5*pi/4: -2*sqrt(2), 2*pi: 2}, 2*sqrt(2), -2*sqrt(2)) # x**3 -> ({-1: -1, 0: 0, 1: 1}, 1, -1) print(maximum(x**2, x, sp.Interval(-2, 1)), minimum(x**2, x, sp.Interval(-2, 1))) # 4 0 (SymPy's own answer) print(sp.singularities(sp.diff(x ** sp.Rational(2, 3), x), x)) # {0} (Example 4: f' does not exist at 0) ``` ```javascript const best = (f, a, b, critical) => { const pts = [a, ...critical, b].map((x) => [x, f(x)]) return [pts.reduce((m, p) => (p[1] > m[1] ? p : m)), pts.reduce((m, p) => (p[1] < m[1] ? p : m))] // [max, min] } best((x) => x * x, -2, 1, [0]) // [[-2, 4], [0, 0]] best((x) => 10 * x * (2 - Math.log(x)), 1, Math.E ** 2, [Math.E]) // [[2.718281828459045, 27.18281828459045], [7.3890560989306495, 0]] best((x) => Math.cbrt(x) ** 2, -2, 3, [0]) // [[3, 2.080083823051904], [0, 0]]: 0 is where f' does not exist best((x) => x ** 3, -1, 1, [0]) // [[1, 1], [-1, -1]]: 0 is critical but not an extreme ``` ```cpp #include #include #include using namespace std; double f(double x) { return 10 * x * (2 - log(x)); } // Example 3, on [1, e^2] double df(double x) { return 10 * (1 - log(x)); } double clean(double v) { return fabs(v) < 1e-9 ? 0 : v; } // round noise like 1e-15 to 0 double bisect(double lo, double hi) { // a zero of f' between lo and hi for (int i = 0; i < 100; i++) { double mid = (lo + hi) / 2; if (df(lo) * df(mid) <= 0) hi = mid; else lo = mid; } return (lo + hi) / 2; } int main() { double a = 1, b = exp(2.0), cand[12]; int n = 0; cand[n++] = a; // the endpoints are candidates double step = (b - a) / 1000; for (int i = 0; i < 1000; i++) { // step 1: the critical points, where f' changes sign double x0 = a + i * step, x1 = x0 + step; if (df(x0) * df(x1) < 0) cand[n++] = bisect(x0, x1); } cand[n++] = b; double hiX = cand[0], loX = cand[0]; for (int i = 0; i < n; i++) { // steps 2 and 3: evaluate f and compare printf("x = %.4f value %.4f\n", cand[i], clean(f(cand[i]))); if (f(cand[i]) > f(hiX)) hiX = cand[i]; if (f(cand[i]) < f(loX)) loX = cand[i]; } printf("maximum %.4f at x = %.4f; minimum %.4f at x = %.4f\n", f(hiX), hiX, clean(f(loX)), loX); // Example 4: x^(2/3) on [-2, 3]; the only critical point is 0, where f' does not exist printf("%.4f %.4f %.4f\n", pow(fabs(-2.0), 2.0 / 3), 0.0, pow(3.0, 2.0 / 3)); // the box of Exercise 67: V(x) = x (10 - 2x)(16 - 2x) at 0, at the critical point 2 and at 5 printf("%.0f %.0f %.0f\n", 0.0, 2 * (10 - 4.0) * (16 - 4.0), 5 * (10 - 10.0) * (16 - 10.0)); return 0; } /* output: x = 1.0000 value 20.0000 x = 2.7183 value 27.1828 x = 7.3891 value 0.0000 maximum 27.1828 at x = 2.7183; minimum 0.0000 at x = 7.3891 1.5874 0.0000 2.0801 0 144 0 */ ``` ## Dari mana asal maksimum dan minimum? **Pencarian yang terbesar dan terkecil lebih tua daripada turunan, dan turunan dimulai sebagai alat untuk itu.** - **Kepler, 1615.** Johannes Kepler, saat mencari bentuk terbaik tong anggur, memperhatikan bahwa di dekat volume terbesar volume berubah sangat sedikit ketika bentuk berubah sedikit: puncak mendatar suatu kurva, garis singgung mendatar pada teorema di atas. - **Fermat, sekitar 1629.** Pierre de Fermat menemukan maksimum dan minimum dengan membandingkan $f(x)$ dengan $f(x+e)$, membagi selisih yang (hampir) nol itu dengan $e$ lalu mengambil $e=0$. Itu adalah syarat $f'(x)=0$ sebelum ada turunan, dan Teorema Turunan Pertama masih disebut teorema Fermat tentang titik stasioner. - **Newton dan Leibniz.** Dengan turunan sebagai limit hasil bagi selisih, argumen pada bukti di atas menjadi beberapa baris. Perbedaan antara titik kritis dan ekstrem, antara $x^3$ dan $x^2$, dijelaskan oleh uji turunan kedua dan uji tanda yang menyusul. - **Bolzano dan Weierstrass.** Teorema Nilai Ekstrem tampak jelas dari grafik tetapi tidak dapat dibuktikan tanpa kelengkapan bilangan real. Bernard Bolzano memberi argumen pertama dalam naskah tahun 1830-an, dan Karl Weierstrass membuktikannya dalam kuliahnya pada 1860-an; itulah sebabnya buktinya bukan bagian dari kursus pengantar. ## Kesalahan apa yang sering terjadi pada nilai ekstrem? **Kesalahan paling umum pada nilai ekstrem adalah sembilan hal berikut, masing-masing dengan pernyataan yang benar.** | Kesalahan | Yang benar | |---|---| | ❌ Hanya melihat titik tempat $f'=0$ | Hitung juga di ujung selang: untuk $x^2$ pada $[-2,1]$ maksimum $4$ ada di $x=-2$, tempat $f'=-4$. | | ❌ Jika $f'(c)=0$, maka $f$ memiliki maksimum atau minimum di $c$ | $f'(0)=0$ untuk $y=x^3$, yang tidak memiliki nilai ekstrem di $0$: titik kritis hanyalah kandidat. | | ❌ Mengabaikan titik tempat $f'$ tidak ada | Itu titik kritis: $x^{2/3}$ memiliki minimum di $0$, begitu pula $|x|$. | | ❌ Memakai metode selang tertutup pada $(0,2)$ atau $[0,\infty)$ | Teorema memerlukan selang tertutup dan terbatas; $x^2$ pada $(0,2)$ tidak memiliki nilai ekstrem. | | ❌ Memakainya pada $\frac1x$ di $[-1,2]$ | $f$ tidak kontinu di sana (bahkan tak terdefinisi di $0$), sehingga ekstrem tidak dijamin. | | ❌ Memberi tempatnya, bukan nilainya, atau sebaliknya | Nilai maksimumnya $4$ dan dicapai di $x=2$: laporkan keduanya. | | ❌ Fungsi hanya punya satu tempat untuk maksimumnya | $\cos x$ pada $\left[-\frac\pi2,\frac\pi2\right]$ mencapai minimum $0$ di kedua ujung. | | ❌ Menghitung titik kritis di luar selang | $V'=0$ di $x=\frac{20}{3}$ untuk kotak, tetapi selangnya $[0,5]$: hanya $x=2$ yang dihitung. | | ❌ Maksimum lokal adalah maksimum mutlak | Untuk $x^3-3x$ pada $[-2,3]$ maksimum lokalnya $2$, maksimum mutlaknya $18$ di $x=3$. | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: nilai ekstrem sekilas - **Ekstrem mutlak:** $f(c)\ge f(x)$ (maksimum) atau $\le$ (minimum) untuk semua $x$ di domain; keduanya bergantung pada domain. - **Teorema Nilai Ekstrem:** $f$ kontinu pada $[a,b]$ yang tertutup dan terbatas memiliki maksimum mutlak dan minimum mutlak di sana. - **Teorema Turunan Pertama:** pada ekstrem lokal di titik dalam tempat $f'$ ada, $f'=0$. - **Titik kritis:** titik dalam tempat $f'=0$ atau $f'$ tidak ada; hanya kandidat ($x^3$ di $0$). - **Metode selang tertutup:** titik kritis di $(a,b)$, nilai di titik itu dan di $a$ serta $b$, lalu yang terbesar dan terkecil. - **Waspadai:** ujung selang, sudut dan titik puncak ($|x|$, $x^{2/3}$), titik kritis di luar selang, putus di dalamnya. - **Kode:** `sp.solveset(df, x, interval)`, `sp.singularities(df, x)`, atau pemindaian perubahan tanda $f'$ dengan bisection. ## Glosarium: istilah penting - **Maksimum dan minimum mutlak**: Nilai terbesar dan terkecil yang dicapai fungsi pada seluruh domainnya; keduanya juga disebut ekstrem global dan bergantung pada domain. - **Teorema Nilai Ekstrem**: Teorema bahwa fungsi kontinu pada selang tertutup dan terbatas mencapai maksimum mutlak dan minimum mutlak di sana. - **Nilai ekstrem lokal**: Nilai yang terbesar atau terkecil hanya di antara nilai pada titik-titik di dekatnya; juga disebut ekstrem relatif. - **Titik kritis**: Titik dalam domain fungsi tempat turunannya nol atau tidak ada; satu-satunya tempat, selain ujung selang, tempat nilai ekstrem dapat terjadi. - **Metode selang tertutup**: Prosedur yang mencari titik kritis fungsi kontinu dalam selang tertutup, menghitungnya di sana dan di ujung selang, lalu mengambil nilai terbesar dan terkecil. - **Titik puncak**: Titik pada grafik tempat kurva memiliki garis singgung tegak dan kedua cabangnya bertemu di satu titik, seperti x pangkat dua per tiga di nol; turunan tidak ada di sana. ## Pertanyaan yang sering diajukan ### Apa itu Teorema Nilai Ekstrem? Teorema ini menyatakan bahwa fungsi yang kontinu pada selang tertutup dan terbatas memiliki maksimum mutlak dan minimum mutlak pada selang itu. Fungsi mencapai nilai terbesar dan terkecilnya setidaknya sekali, di ujung selang atau di dalamnya. ### Bagaimana mencari maksimum dan minimum mutlak pada selang tertutup? Cari titik kritis fungsi di dalam selang, hitung fungsi di titik-titik itu dan di kedua ujung selang, lalu bandingkan. Nilai terbesar adalah maksimum mutlak dan nilai terkecil adalah minimum mutlak. ### Apa itu titik kritis? Titik kritis adalah titik dalam domain fungsi tempat turunannya nol atau tidak ada. Bersama dengan ujung selang, itulah satu-satunya tempat nilai ekstrem dapat terjadi. ### Apakah setiap titik kritis adalah maksimum atau minimum? Tidak. Titik kritis hanyalah kandidat. Fungsi x pangkat tiga memiliki turunan nol di 0, dan akar pangkat tiga tidak memiliki turunan di 0, tetapi keduanya tidak memiliki maksimum atau minimum di sana, karena keduanya terus naik. ### Dapatkah fungsi memiliki nilai ekstrem di tempat ia tidak terdiferensialkan? Ya. Fungsi nilai mutlak memiliki minimum di 0, tempat ia memiliki sudut dan tidak punya turunan, dan x pangkat dua per tiga memiliki minimum di 0, titik puncak. Itu adalah titik kritis jenis kedua. ### Apa beda ekstrem mutlak dan lokal? Ekstrem mutlak adalah nilai terbesar atau terkecil pada seluruh domain, dan ekstrem lokal adalah yang terbesar atau terkecil hanya di antara titik-titik di dekatnya. Maksimum mutlak juga lokal, tetapi maksimum lokal belum tentu mutlak. ### Mengapa selang harus tertutup pada Teorema Nilai Ekstrem? Karena ujung yang tidak disertakan bisa menjadi tempat ekstrem itu berada. Pada selang dari 0 sampai 2 tanpa 0, fungsi x kuadrat bernilai sekecil yang kita mau tetapi tidak punya nilai terkecil, karena 0 tidak diizinkan. ### Apakah ujung selang dihitung sebagai titik kritis? Menurut definisi, tidak: titik kritis adalah titik dalam. Tetapi ujung selang selalu kandidat ekstrem mutlak, jadi dalam metode selang tertutup kamu menghitung fungsi di sana juga. --- # Linearization and Differentials Source: https://nunada.my.id/articles/linearization-and-differentials/ Updated: 2026-10-20 ## Quick answer **The linearization of a differentiable function $f$ at $a$ is the tangent-line function $L(x)=f(a)+f'(a)(x-a)$, and $f(x)\approx L(x)$ for $x$ near $a$; the differential $dy=f'(x)\,dx$ is the amount that this line rises when $x$ changes by $dx$.** So $f(a+dx)\approx f(a)+dy$ estimates a value from a point where $f$ and $f'$ are easy, and the error is small even compared with $dx$. ### Key takeaways - Near a point where $f$ is differentiable the graph looks like its tangent line, whose equation is the linearization $L(x)=f(a)+f'(a)(x-a)$; $a$ is the center of the approximation. - A linearization loses accuracy away from its center: $\sqrt{1+x}\approx1+\frac x2$ is good at $x=0.05$ but gives $2$ for $\sqrt3$, so choose a center near the place you need. - Common linearizations at $0$: $\sin x\approx x$, $\cos x\approx1$, $\tan x\approx x$, $e^x\approx1+x$, $\ln(1+x)\approx x$ and $(1+x)^k\approx1+kx$. - The differential $dx$ is an independent variable and $dy=f'(x)\,dx$ depends on $x$ and $dx$; $dy$ is the change in the linearization, while $\Delta y=f(a+dx)-f(a)$ is the true change. - The true change is $\Delta y=f'(a)\,dx+\varepsilon\,dx$ with $\varepsilon\to0$ as $dx\to0$, so the error $\varepsilon\,dx$ is a product of two small numbers; for smooth $f$ it is about $\frac12f''(a)\,dx^2$. - For $y=cx^n$ the relative error is $\frac{dy}{y}=n\,\frac{dx}{x}$: a $2\%$ error in a radius is a $2\%$ error in the circumference and about $4\%$ in the area. ## What is the linearization of a function? **The linearization of $f$ at $a$ is the linear function $L(x)=f(a)+f'(a)(x-a)$, whose graph is the tangent line to $y=f(x)$ at $(a,f(a))$.** The reason it is useful is that a differentiable curve behaves locally like its tangent line: magnify the graph around the point and it flattens, until the curve and the line cannot be told apart. For $y=x^2$ at $(1,1)$ the tangent line is $y=2x-1$, and in a window about $0.006$ wide the two graphs look the same. The tangent line at $x=a$ passes through $(a,f(a))$ with slope $f'(a)$, so its point-slope equation, from the [tangent line equation](https://nunada.my.id/articles/tangent-lines-and-derivative-at-a-point/#tangent-line-equation), is $y=f(a)+f'(a)(x-a)$. As long as that line stays close to the graph when we move off the point of tangency, $L(x)$ is a good approximation of $f(x)$. **Definitions.** If $f$ is differentiable at $x=a$, then the approximating function $$L(x)=f(a)+f'(a)(x-a)$$ is the linearization of $f$ at $a$. The approximation $f(x)\approx L(x)$ is the standard linear approximation of $f$ at $a$, and the point $x=a$ is the center of the approximation. **Why it works.** The definition of the derivative says that the quotient $\frac{f(x)-f(a)}{x-a}$ is close to $f'(a)$ when $x$ is close to $a$, that is, $f(x)-f(a)\approx f'(a)(x-a)$. Both $f(x)-f(a)$ and $f'(a)(x-a)$ shrink to $0$ as $x\to a$, but the first agrees with the second to better than a multiple of $x-a$, and this is what "close" means here. A function with a corner or a vertical tangent at $a$ has no derivative there, so it has no linearization at $a$. **What it is for.** Nobody would use a linearization to find one particular square root, because a calculator is better. Its use is to replace a complicated formula by a simple one over a whole interval of values, when the small error is tolerable, and to understand how an output reacts to a small change of the input. Zoom in below and read the table: each tenfold magnification makes the gap between the curve and the line about a hundred times smaller. ## How do you find a linearization, and how accurate is it? **To find a linearization, compute $f(a)$ and $f'(a)$ at the center and put them into $L(x)=f(a)+f'(a)(x-a)$; it is accurate for $x$ near $a$ and less and less accurate as $x$ moves away.** **Example 1.** Find the linearization of $f(x)=\sqrt{1+x}$ at $a=0$. Since $f'(x)=\frac{1}{2\sqrt{1+x}}$, we have $f(0)=1$ and $f'(0)=\frac12$, so $$L(x)=1+\frac12(x-0)=1+\frac x2.$$ How good is $\sqrt{1+x}\approx1+\frac x2$? Near $0$ it is very good, and it worsens as $x$ moves away: | $x$ | Approximation $1+\frac x2$ | True value | Error | |---|---|---|---| | $0.005$ | $1.0025$ | $1.002497$ | less than $10^{-5}$ | | $0.05$ | $1.025$ | $1.024695$ | less than $10^{-3}$ | | $0.2$ | $1.10$ | $1.095445$ | less than $10^{-2}$ | For $x=2$ it gives $2$ as the approximation of $\sqrt3$, which is not even accurate to one decimal place. **Example 2: choose a better center.** A linearization normally loses accuracy away from its center, so near $x=3$ we need the linearization at $a=3$. With $f(3)=2$ and $f'(3)=\frac{1}{2\sqrt{4}}=\frac14$, $$L(x)=2+\frac14(x-3)=\frac54+\frac x4.$$ At $x=3.2$ this gives $\sqrt{4.2}\approx\frac54+\frac{3.2}{4}=2.050$, which differs from the true $2.04939$ by less than one thousandth. The linearization at $0$ gives $1+\frac{3.2}{2}=2.6$ there, off by more than $25\%$. So pick a center $a$ where $f(a)$ and $f'(a)$ are easy to find and which is close to the place you need. **Example 3.** For $f(x)=\cos x$ at $a=\frac\pi2$ we have $f\left(\frac\pi2\right)=0$ and $f'\left(\frac\pi2\right)=-\sin\frac\pi2=-1$, so $$L(x)=0-1\cdot\left(x-\frac\pi2\right)=-x+\frac\pi2.$$ **The common linearizations at $x=0$.** Working them out as in Example 1 gives: | Function | Linearization at $0$ | |---|---| | $\sin x$ | $x$ | | $\cos x$ | $1$ | | $\tan x$ | $x$ | | $e^x$ | $1+x$ | | $\ln(1+x)$ | $x$ | | $(1+x)^k$ | $1+kx$, for any number $k$ | The last row is the most useful: it is the linearization of $f(x)=(1+x)^k$, where $f(0)=1$ and $f'(0)=k$. It is good for $x$ close to $0$ and gives, with $x$ replaced by something small, $$\sqrt{1+x}\approx1+\frac x2$$ $$\frac{1}{1-x}\approx1+x$$ $$\frac{1}{\sqrt{1-x^2}}\approx1+\frac{x^2}{2}$$ and, with $k$ a power, $\sqrt[3]{1+5x^4}\approx1+\frac{5x^4}{3}$. It also estimates powers of numbers close to $1$: $1.0002^{50}\approx1+50\cdot0.0002=1.01$ (the true value is $1.010049$) and $\sqrt[3]{1.009}\approx1+\frac{0.009}{3}=1.003$. Try your own function, center and $x$ below. ## What are the differentials dx and dy? **The differential $dx$ is an independent variable, a change of $x$ that you may choose, and the differential of $y=f(x)$ is $dy=f'(x)\,dx$, the amount that the tangent line rises or falls when $x$ changes by $dx$.** The notation $\frac{dy}{dx}$ for the derivative looks like a ratio but is not one by its definition; the differentials make it one, because when $dx\ne0$ $$\frac{dy}{dx}=\frac{f'(x)\,dx}{dx}=f'(x).$$ Unlike $dx$, the variable $dy$ is always dependent: it depends on both $x$ and $dx$. If $dx$ is given a value and $x$ is a number in the domain, these determine the number $dy$. Often $dx$ is chosen to be $\Delta x$, the change in $x$. **Example 4.** (a) Find $dy$ if $y=x^5+37x$. (b) Find $dy$ when $x=1$ and $dx=0.2$. Here $dy=\left(5x^4+37\right)dx$, and with $x=1$ and $dx=0.2$ it is $(5+37)(0.2)=8.4$. **The geometric meaning.** Set $x=a$ and $dx=\Delta x$. The true change of $y=f(x)$ is $\Delta y=f(a+dx)-f(a)$. The corresponding change of the tangent line $L$ is $$\Delta L=L(a+dx)-L(a)=f'(a)\,dx=dy.$$ So $dy$ is the change of the linearization, the rise of the tangent line over the run $dx$, whereas $\Delta y$ is the rise of the curve. They are close when $dx$ is small, and the move of the slider below shows the difference. **Differential forms.** We sometimes write $df=f'(x)\,dx$ and call $df$ the differential of $f$; for $f(x)=3x^2-6$ it is $df=d\left(3x^2-6\right)=6x\,dx$. Every differentiation rule has a differential form: $\frac{d(u+v)}{dx}=\frac{du}{dx}+\frac{dv}{dx}$ becomes $d(u+v)=du+dv$, and $d(\sin u)=\cos u\,du$. **Example 5.** The chain rule and the other rules give differentials: $$d(\tan2x)=\sec^2(2x)\,d(2x)$$ $$d(\tan2x)=2\sec^2(2x)\,dx$$ $$d\left(\frac{x}{x+1}\right)=\frac{(x+1)\,dx-x\,dx}{(x+1)^2}$$ $$d\left(\frac{x}{x+1}\right)=\frac{dx}{(x+1)^2}.$$ The first uses the [chain rule](https://nunada.my.id/articles/the-chain-rule/#chain-rule), with $u=2x$ inside the tangent. ## How do you estimate values and changes with differentials? **To estimate $f(a+dx)$ when $f(a)$ is known and $dx$ is small, use $f(a+dx)\approx f(a)+dy$ with $dy=f'(a)\,dx$; equivalently the change $\Delta f$ is approximately the differential $df$.** The goal is to choose a nearby point $a$ where both $f(a)$ and $f'(a)$ are easy to evaluate. **Example 6: the area of a circle.** The radius $r$ of a circle increases from $a=10$ m to $10.1$ m. Use $dA$ to estimate the increase in the area, and the area of the enlarged circle. Since $A=\pi r^2$, the estimated increase is $$dA=A'(a)\,dr=2\pi a\,dr$$ $$dA=2\pi(10)(0.1)=2\pi\ \text{m}^2.$$ So $$A(10.1)\approx A(10)+dA$$ $$A(10.1)\approx100\pi+2\pi=102\pi\ \text{m}^2.$$ Directly, $A(10.1)=\pi(10.1)^2=102.01\pi\ \text{m}^2$, so the error is $0.01\pi\ \text{m}^2$, the difference $\Delta A-dA$. **Example 7a: a cube root.** To estimate $\sqrt[3]{7.97}$ take $f(x)=x^{1/3}$, where $dy=\frac{1}{3x^{2/3}}\,dx$. The closest number with an easy cube root is $a=8$, and to get $a+dx=7.97$ we choose $dx=-0.03$: $$f(7.97)\approx f(8)+\frac{1}{3\cdot8^{2/3}}(-0.03)$$ $$f(7.97)\approx2+\frac{1}{12}(-0.03)=1.9975.$$ The true value is $1.997497$ to six places. **Example 7b: a sine.** To estimate $\sin\left(\frac\pi6+0.01\right)$ take $a=\frac\pi6$, where $\sin\frac\pi6=\frac12$ and $\cos\frac\pi6=\frac{\sqrt3}{2}$, and $dx=0.01$: $$\sin\left(\frac\pi6+0.01\right)\approx\frac12+\frac{\sqrt3}{2}(0.01)$$ $$\sin\left(\frac\pi6+0.01\right)\approx0.5087.$$ The true value is $0.508635$. Computers can use this method: an algorithm stores a table of sine and cosine values at a grid of angles and fills in the values between with a differential, like Example 7b. **Absolute, relative and percentage change.** When we move from $a$ to $a+dx$, the change in $f$ can be described in three ways: | | True | Estimated | |---|---|---| | Absolute change | $\Delta f=f(a+dx)-f(a)$ | $df=f'(a)\,dx$ | | Relative change | $\frac{\Delta f}{f(a)}$ | $\frac{df}{f(a)}$ | | Percentage change | $\frac{\Delta f}{f(a)}\times100$ | $\frac{df}{f(a)}\times100$ | In Example 6 the area changes by $\frac{2\pi}{100\pi}=2\%$ (estimated) when the radius changes by $\frac{0.1}{10}=1\%$. ## How large is the error, and how does a measuring error spread? **If $f$ is differentiable at $a$ and $x$ changes from $a$ to $a+\Delta x$, the true change is $\Delta f=f'(a)\,\Delta x+\varepsilon\,\Delta x$, where $\varepsilon\to0$ as $\Delta x\to0$, so the error of the differential estimate is $\varepsilon\,\Delta x$, a product of two small quantities.** The reason is the definition of the derivative. The error is $$\Delta f-df=\left(\frac{f(a+\Delta x)-f(a)}{\Delta x}-f'(a)\right)\Delta x$$ $$\Delta f-df=\varepsilon\,\Delta x,$$ and the quantity in parentheses is a difference quotient minus its limit, which tends to $0$. For the circle of Example 6, $\Delta A-dA=0.01\pi=\pi(\Delta r)^2$, so $\varepsilon=\pi\,\Delta r=0.1\pi$. For many common functions the error is much smaller than $\Delta x$: when $f$ has a second derivative it is about $\frac12f''(a)\,\Delta x^2$, a rule of thumb that is proved later with Taylor's theorem and that explains the widget above, where the error curve is flat at $a$ and grows like a parabola. **The linearization is the best linear approximation.** Suppose another linear function $g(x)=m(x-a)+c$ is used to approximate $f$ with error $E(x)=f(x)-g(x)$, and we ask for two things: $E(a)=0$, and $\frac{E(x)}{x-a}\to0$ as $x\to a$ (the error is negligible next to $x-a$). The first gives $c=f(a)$. Then $$\frac{E(x)}{x-a}=\frac{f(x)-f(a)}{x-a}-m\;\longrightarrow\;f'(a)-m,$$ which is $0$ only for $m=f'(a)$. So $L(x)=f(a)+f'(a)(x-a)$ is the only linear approximation whose error is zero at $a$ and negligible compared with $x-a$. Every other line through $(a,f(a))$ leaves an error of the order of $x-a$. **Sensitivity to change.** The equation $df=f'(x)\,dx$ tells how sensitive the output of $f$ is to a change of the input at different values of $x$: the larger $|f'|$, the greater the effect of a given $dx$ (compare the [sensitivity of a function](https://nunada.my.id/articles/the-derivative-as-a-rate-of-change/#sensitivity)). **Example 8.** The depth of a well is $s=4.9t^2$ meters, found by timing a dropped stone. Then $ds=9.8t\,dt$. If the time is read with an error of $dt=0.1$ s, then at $t=2$ s the error is about $ds=(9.8)(2)(0.1)=1.96$ m, but at $t=5$ s it is $(9.8)(5)(0.1)=4.9$ m. For the same error in the time, the depth is more uncertain when the fall is longer. **How a measuring error spreads.** For a quantity $y=cx^n$, such as the area $\pi r^2$ ($n=2$) or the volume $x^3$ of a cube ($n=3$), $dy=ncx^{n-1}dx$, and dividing by $y=cx^n$, $$\frac{dy}{y}=n\,\frac{dx}{x}.$$ So a relative error in $x$ becomes $n$ times as large in $y$. A $2\%$ error in the radius of a circle gives about $2\%$ in the circumference ($n=1$) and $4\%$ in the area; a $0.5\%$ error in the edge of a cube gives $1\%$ in the surface area ($n=2$) and $1.5\%$ in the volume; a $1\%$ error in the diameter of a sphere gives $3\%$ in its volume. Read the other way, it gives a tolerance: to calculate the volume of a cylinder with height equal to radius, $V=\pi h^3$, to within $1\%$, the height must be measured to within about $\frac13\%$. **The estimate is for small changes.** Blood flow through an artery is $V=kr^4$, so a $10\%$ increase of the radius is estimated to raise the flow by $4\cdot10=40\%$. The exact value is $1.1^4-1=46.4\%$. The estimate is first order, and the error grows like the square of the change, so the larger the change, the worse the percentage rule. Move the sliders below to see where the line and the exact curve part. ## What are linearizations used for in science? **Linearizations turn a hard function into a simple one for small changes, and three classic uses are the small-angle approximation, the energy of a moving mass and Newton's method.** **Small angles.** The linearization of $\sin x$ at $0$ is $x$, so for a small angle in radians $\sin\theta\approx\theta$: $\sin0.1=0.0998$, close to $0.1$. The equation of a pendulum becomes linear with this replacement, which is why a pendulum of small swing keeps a steady period. The angle must be in radians; $\sin10^\circ\approx10$ is wrong, while $\sin10^\circ\approx0.1745$ is right. **Mass and energy.** Newton's second law $F=\frac{d}{dt}(mv)=ma$ assumes that the mass is constant, but in Einstein's corrected formula the mass is $m=\frac{m_0}{\sqrt{1-v^2/c^2}}$, where $m_0$ is the rest mass and $c\approx300\,000$ km/s is the speed of light. For $v$ much smaller than $c$ the number $x=\frac{v^2}{c^2}$ is near $0$, and the linearization $(1-x)^{-1/2}\approx1+\frac x2$ gives $$m\approx m_0\left(1+\frac{v^2}{2c^2}\right)$$ $$(m-m_0)c^2\approx\frac12m_0v^2.$$ The right-hand side is the kinetic energy of Newtonian physics. So the change in kinetic energy in going from rest to the speed $v$ is approximately the change in mass times $c^2$, $\Delta(m)c^2\approx\Delta(\text{KE})$, and since $c^2\approx9\times10^{16}\ \text{m}^2/\text{s}^2$, a small change in mass is a large change in energy. At $v=0.1c$ the exact factor is $1.005038$ and the approximation gives $1.005$. **Newton's method.** The linearization of $f$ at $a$ is a line, and a line has an easy zero. Solving $L(x)=0$ gives $x=a-\frac{f(a)}{f'(a)}$, which is usually closer to a zero of $f$ than $a$ is. Repeating this is Newton's method. For $f(x)=x^2-2$ and the start $a=1.5$ the next values are $1.416667$, $1.414216$, $1.414214$: three steps for $\sqrt2$ to six places. ## How do you compute linearizations and differentials in code? **With SymPy a linearization is one line: differentiate, evaluate at the center and build $f(a)+f'(a)(x-a)$.** The function below reproduces the linearizations of this article exactly, and the lines after it check numbers with plain Python: the table of $\sqrt{1+x}\approx1+\frac x2$, the circle of Example 6, the two estimates of Example 7, the percentage rule for $y=x^n$ and the first steps of Newton's method. ```python import math import sympy as sp x = sp.symbols('x') def linearize(f, a): """L(x) = f(a) + f'(a) (x - a)""" return sp.simplify(f.subs(x, a) + sp.diff(f, x).subs(x, a) * (x - a)) for f, a in ((sp.sqrt(1 + x), 0), (sp.sqrt(1 + x), 3), (sp.cos(x), sp.pi / 2), (sp.exp(x), 0), (sp.log(1 + x), 0), (sp.cbrt(x), 8)): print(f, 'at', a, '->', linearize(f, a)) # sqrt(x + 1) at 0 -> x/2 + 1 # sqrt(x + 1) at 3 -> x/4 + 5/4 # cos(x) at pi/2 -> -x + pi/2 # exp(x) at 0 -> x + 1 # log(x + 1) at 0 -> x # x**(1/3) at 8 -> x/12 + 4/3 # how good is sqrt(1 + x) = 1 + x/2 ? (x, approximation, true value, error) for t in (0.005, 0.05, 0.2): print(t, 1 + t / 2, round(math.sqrt(1 + t), 6), f'{abs(1 + t / 2 - math.sqrt(1 + t)):.1e}') # 0.005 1.0025 1.002497 3.1e-06 # 0.05 1.025 1.024695 3.0e-04 # 0.2 1.1 1.095445 4.6e-03 # differentials: the radius of a circle grows from 10 m to 10.1 m dA = 2 * math.pi * 10 * 0.1 true = math.pi * 10.1**2 - math.pi * 10**2 print(round(dA, 4), round(true, 4), round(true - dA, 4), round(math.pi * 0.01, 4)) # 6.2832 6.3146 0.0314 0.0314 # estimates: the cube root of 7.97 and sin(pi/6 + 0.01) print(round(2 + (-0.03) / 12, 4), round(7.97 ** (1 / 3), 6)) # 1.9975 1.997497 print(round(0.5 + math.sqrt(3) / 2 * 0.01, 4), round(math.sin(math.pi / 6 + 0.01), 6)) # 0.5087 0.508635 # a measuring error spreads: y = x^n, p% in x gives about n p% in y (n, p, estimate, exact) for n, p in ((2, 2), (3, 0.5), (4, 10)): print(n, p, n * p, round(((1 + p / 100) ** n - 1) * 100, 4)) # 2 2 4 4.04 # 3 0.5 1.5 1.5075 # 4 10 40 46.41 # Newton's method is the zero of the linearization, again and again (f(x) = x^2 - 2) a = 1.5 for step in range(4): a = a - (a * a - 2) / (2 * a) print(step + 1, a) # 1 1.4166666666666667 # 2 1.4142156862745099 # 3 1.4142135623746899 # 4 1.4142135623730951 ``` ```cpp #include #include #include using namespace std; const double PI = acos(-1.0); int main() { // how good is sqrt(1 + x) = 1 + x/2 ? (x, approximation, true value, error) double xs[3] = {0.005, 0.05, 0.2}; for (int i = 0; i < 3; i++) { double x = xs[i], approx = 1 + x / 2, truth = sqrt(1 + x); printf("%.3f %.4f %.6f %.1e\n", x, approx, truth, fabs(approx - truth)); } // differentials: the radius of a circle grows from 10 m to 10.1 m double dA = 2 * PI * 10 * 0.1; double trueChange = PI * 10.1 * 10.1 - PI * 10 * 10; printf("%.4f %.4f %.4f %.4f\n", dA, trueChange, trueChange - dA, PI * 0.01); // estimates: the cube root of 7.97, and sin(pi/6 + 0.01) printf("%.4f %.6f\n", 2 + (-0.03) / 12, pow(7.97, 1.0 / 3)); printf("%.4f %.6f\n", 0.5 + sqrt(3.0) / 2 * 0.01, sin(PI / 6 + 0.01)); // a measuring error spreads: y = x^n, p% in x gives about n p% in y (n, p, estimate, exact) int ns[3] = {2, 3, 4}; double ps[3] = {2, 0.5, 10}; for (int i = 0; i < 3; i++) printf("%d %.1f %.1f %.4f\n", ns[i], ps[i], ns[i] * ps[i], (pow(1 + ps[i] / 100, ns[i]) - 1) * 100); // Newton's method is the zero of the linearization, again and again (f(x) = x^2 - 2) double a = 1.5; for (int step = 1; step <= 4; step++) { a = a - (a * a - 2) / (2 * a); printf("%d %.13f\n", step, a); } return 0; } /* output: 0.005 1.0025 1.002497 3.1e-06 0.050 1.0250 1.024695 3.0e-04 0.200 1.1000 1.095445 4.6e-03 6.2832 6.3146 0.0314 0.0314 1.9975 1.997497 0.5087 0.508635 2 2.0 4.0 4.0400 3 0.5 1.5 1.5075 4 10.0 40.0 46.4100 1 1.4166666666667 2 1.4142156862745 3 1.4142135623747 4 1.4142135623731 */ ``` ## Where do differentials and linear approximations come from? **Differentials began as infinitely small quantities, and linearization was made precise when they were replaced by limits.** - **Leibniz.** Gottfried Wilhelm Leibniz introduced the symbols $dx$ and $dy$ for infinitely small differences, and published his differential calculus in 1684. For him $\frac{dy}{dx}$ was a true quotient of two such quantities, and the tangent line was the line that the curve follows over an infinitely small step. - **Newton and the first approximation.** Isaac Newton described in 1669 an iteration that improves an approximate root, in which each step solves the linearization of the equation; Joseph Raphson published a simpler form in 1690. Today it is called the Newton-Raphson method. - **Taylor.** Brook Taylor, in 1715, gave the general rule that a function can be approximated near $a$ by a polynomial built from its derivatives. The linearization is the first-degree case, and the quadratic approximation, with $\frac12f''(a)(x-a)^2$ added, is the next. - **Cauchy.** In the 1820s Augustin-Louis Cauchy removed the infinitely small. He defined $dx$ as an ordinary finite increment, an independent variable, and the differential as $dy=f'(x)\,dx$, which is the definition used here. This is why $dy$ is the change in the tangent line, not an infinitely small change in the curve. ## What mistakes do people make with linearization and differentials? **The most common mistakes with linearization and differentials are the nine below, each with the correct statement.** | Mistake | Correct | |---|---| | ❌ $L(x)=f'(a)(x-a)$, leaving out $f(a)$ | The line passes through $(a,f(a))$: $L(x)=f(a)+f'(a)(x-a)$. | | ❌ $L(x)=f(a)+f'(x)(x-a)$ | The slope is the number $f'(a)$ at the center, not a function of $x$. | | ❌ Use $\sqrt{1+x}\approx1+\frac x2$ at $x=3$ and get $2.5$ for $\sqrt4$ | The center is $0$ and $3$ is far from it: use the center $a=3$, $\frac54+\frac x4$. | | ❌ $\sin10^\circ\approx10$ | The approximation $\sin x\approx x$ needs radians: $\sin10^\circ\approx0.1745$. | | ❌ $dy$ is the same as $\Delta y$ | $\Delta y$ is the true change of the curve and $dy=f'(a)\,dx$ the change of the tangent line; they differ by $\varepsilon\,dx$. | | ❌ $dx$ and $dy$ are both fixed small numbers | $dx$ is a variable you choose, and $dy=f'(x)\,dx$ is computed from it. | | ❌ A $2\%$ error in the radius gives a $2\%$ error in the area | The area is $\pi r^2$, so $n=2$: about $4\%$. | | ❌ A $10\%$ larger radius gives exactly $40\%$ more flow in $V=kr^4$ | $40\%$ is the estimate; the exact change is $1.1^4-1=46.4\%$. | | ❌ Linearize $\sqrt[3]{x}$ or $|x|$ at $0$ | There is no derivative at $0$ (a vertical tangent, a corner), so there is no linearization. | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: linearization and differentials at a glance - **Linearization:** $L(x)=f(a)+f'(a)(x-a)$, the tangent line at the center $a$; $f(x)\approx L(x)$ near $a$. - **Accuracy:** best near $a$ and worse away from it; the error is about $\frac12f''(a)(x-a)^2$; choose a center where $f(a)$ and $f'(a)$ are easy. - **Common ones at $0$:** $\sin x\approx x$, $\cos x\approx1$, $e^x\approx1+x$, $\ln(1+x)\approx x$, $(1+x)^k\approx1+kx$. - **Differential:** $dy=f'(x)\,dx$, the change of the tangent line; $\Delta y=dy+\varepsilon\,dx$ with $\varepsilon\to0$. - **Estimating:** $f(a+dx)\approx f(a)+f'(a)\,dx$; relative change $\frac{df}{f}$, percentage change $\frac{df}{f}\times100$. - **Measuring errors:** for $y=cx^n$, $\frac{dy}{y}=n\frac{dx}{x}$; the estimate is for small changes. - **Best linear approximation:** the only line with zero error at $a$ and error negligible next to $x-a$. - **Code:** `sp.diff(f, x).subs(x, a)` for the slope, and $x_{\text{new}}=a-\frac{f(a)}{f'(a)}$ for Newton's method. ## Glossary: key terms - **Linearization**: The linear function f of a plus f prime of a times x minus a, whose graph is the tangent line to the graph of f at a; it approximates f for x near a. - **Standard linear approximation**: The approximation of f of x by its linearization L of x at a, valid when x is close to the center a. - **Center of the approximation**: The point a at which a linearization is built; the approximation is exact there and loses accuracy as x moves away. - **Differential**: For y equal to f of x, the differential dy is f prime of x times dx, where dx is an independent variable; it is the change in the tangent line when x changes by dx. - **Relative and percentage change**: The change in a quantity divided by its original value, and the same multiplied by one hundred; for a differential estimate it is df divided by f of a. - **Approximation error**: The difference between the true change and the differential estimate, equal to epsilon times delta x with epsilon tending to zero, so it is small even compared with delta x. ## Frequently asked questions ### What is linearization in calculus? Linearization replaces a differentiable function near a point by its tangent line. The line, f of a plus f prime of a times x minus a, takes nearly the same values as the function close to the point and is much simpler to work with. ### What is the formula for a linear approximation? The linear approximation of f at a is L of x equal to f of a plus f prime of a times x minus a. It is accurate for x close to the center a, and the error grows roughly like the square of the distance from a. ### What is the difference between dy and delta y? Delta y is the true change of the function when x changes by dx, while dy is f prime of x times dx, the change of the tangent line. They are close for small dx, and their difference is small even compared with dx. ### How do you estimate a value with differentials? Choose a nearby point a where f of a and f prime of a are easy, then use f of a plus dx is about f of a plus f prime of a times dx. For the cube root of 7.97, a is 8 and dx is minus 0.03, giving 1.9975. ### How accurate is a linear approximation? It is accurate near the center and loses accuracy away from it. The error is about one half of the second derivative times the squared distance from the center, so it is tiny close by and can be large far away. ### How do you find the percentage error in a result? For a result y equal to a constant times x to the n, the relative error of y is n times the relative error of x. A 2 percent error in a radius is about a 4 percent error in the area, since n is 2. ### What is the linearization of sin x at 0? It is x itself, because sin 0 is 0 and the slope cos 0 is 1. So for a small angle in radians, sin x is about x. The angle must be in radians; for degrees convert first. ### How is Newton's method related to linearization? Each step of Newton's method replaces the function by its linearization at the current guess and takes the zero of that line as the next guess: a minus f of a over f prime of a. The process repeats until the guesses settle. --- # Linearisasi dan Diferensial Source: https://nunada.my.id/artikel/linearisasi-dan-diferensial/ Updated: 2026-10-20 ## Jawaban singkat **Linearisasi fungsi terdiferensialkan $f$ di $a$ adalah fungsi garis singgung $L(x)=f(a)+f'(a)(x-a)$, dan $f(x)\approx L(x)$ untuk $x$ di dekat $a$; diferensial $dy=f'(x)\,dx$ adalah besar kenaikan garis itu ketika $x$ berubah sebesar $dx$.** Jadi $f(a+dx)\approx f(a)+dy$ memperkirakan sebuah nilai dari titik tempat $f$ dan $f'$ mudah dihitung, dan galatnya kecil bahkan dibandingkan dengan $dx$. ### Poin penting - Di dekat titik tempat $f$ terdiferensialkan, grafik tampak seperti garis singgungnya, yang persamaannya adalah linearisasi $L(x)=f(a)+f'(a)(x-a)$; $a$ adalah pusat hampiran. - Linearisasi kehilangan ketelitian jauh dari pusatnya: $\sqrt{1+x}\approx1+\frac x2$ baik di $x=0{,}05$ tetapi memberi $2$ untuk $\sqrt3$, jadi pilih pusat di dekat tempat yang diperlukan. - Linearisasi umum di $0$: $\sin x\approx x$, $\cos x\approx1$, $\tan x\approx x$, $e^x\approx1+x$, $\ln(1+x)\approx x$, dan $(1+x)^k\approx1+kx$. - Diferensial $dx$ adalah peubah bebas dan $dy=f'(x)\,dx$ bergantung pada $x$ dan $dx$; $dy$ adalah perubahan pada linearisasi, sedangkan $\Delta y=f(a+dx)-f(a)$ adalah perubahan sebenarnya. - Perubahan sebenarnya adalah $\Delta y=f'(a)\,dx+\varepsilon\,dx$ dengan $\varepsilon\to0$ saat $dx\to0$, sehingga galat $\varepsilon\,dx$ adalah hasil kali dua bilangan kecil; untuk $f$ mulus ia sekitar $\frac12f''(a)\,dx^2$. - Untuk $y=cx^n$ galat relatifnya $\frac{dy}{y}=n\,\frac{dx}{x}$: galat $2\%$ pada jari-jari menjadi galat $2\%$ pada keliling dan sekitar $4\%$ pada luas. ## Apa itu linearisasi suatu fungsi? **Linearisasi $f$ di $a$ adalah fungsi linear $L(x)=f(a)+f'(a)(x-a)$, yang grafiknya adalah garis singgung $y=f(x)$ di $(a,f(a))$.** Alasan ia berguna adalah bahwa kurva terdiferensialkan berperilaku secara lokal seperti garis singgungnya: perbesar grafik di sekitar titik itu dan ia mendatar, sampai kurva dan garis tidak dapat dibedakan. Untuk $y=x^2$ di $(1,1)$ garis singgungnya $y=2x-1$, dan pada jendela selebar sekitar $0{,}006$ kedua grafik tampak sama. Garis singgung di $x=a$ melalui $(a,f(a))$ dengan gradien $f'(a)$, sehingga persamaan titik-gradiennya, dari [persamaan garis singgung](https://nunada.my.id/artikel/garis-singgung-dan-turunan-di-suatu-titik/#tangent-line-equation), adalah $y=f(a)+f'(a)(x-a)$. Selama garis itu tetap dekat dengan grafik ketika kita menjauh dari titik singgung, $L(x)$ adalah hampiran yang baik untuk $f(x)$. **Definisi.** Jika $f$ terdiferensialkan di $x=a$, maka fungsi hampiran $$L(x)=f(a)+f'(a)(x-a)$$ adalah linearisasi $f$ di $a$. Hampiran $f(x)\approx L(x)$ adalah hampiran linear baku $f$ di $a$, dan titik $x=a$ adalah pusat hampiran. **Mengapa berhasil.** Definisi turunan mengatakan bahwa hasil bagi $\frac{f(x)-f(a)}{x-a}$ dekat dengan $f'(a)$ ketika $x$ dekat dengan $a$, yaitu $f(x)-f(a)\approx f'(a)(x-a)$. Baik $f(x)-f(a)$ maupun $f'(a)(x-a)$ menyusut ke $0$ saat $x\to a$, tetapi yang pertama sesuai dengan yang kedua dengan ketelitian lebih baik daripada suatu kelipatan $x-a$, dan inilah arti "dekat" di sini. Fungsi dengan sudut atau garis singgung tegak di $a$ tidak memiliki turunan di sana, sehingga tidak memiliki linearisasi di $a$. **Untuk apa.** Tidak ada yang memakai linearisasi untuk mencari satu akar kuadrat tertentu, karena kalkulator lebih baik. Gunanya adalah mengganti rumus rumit dengan yang sederhana pada seluruh selang nilai, ketika galat kecilnya dapat diterima, dan memahami bagaimana keluaran bereaksi terhadap perubahan kecil pada masukan. Perbesar di bawah dan baca tabelnya: setiap pembesaran sepuluh kali membuat selisih antara kurva dan garis sekitar seratus kali lebih kecil. ## Bagaimana mencari linearisasi, dan seberapa teliti ia? **Untuk mencari linearisasi, hitung $f(a)$ dan $f'(a)$ di pusat dan masukkan ke $L(x)=f(a)+f'(a)(x-a)$; ia teliti untuk $x$ dekat $a$ dan makin kurang teliti saat $x$ menjauh.** **Contoh 1.** Tentukan linearisasi $f(x)=\sqrt{1+x}$ di $a=0$. Karena $f'(x)=\frac{1}{2\sqrt{1+x}}$, kita punya $f(0)=1$ dan $f'(0)=\frac12$, sehingga $$L(x)=1+\frac12(x-0)=1+\frac x2.$$ Seberapa baik $\sqrt{1+x}\approx1+\frac x2$? Di dekat $0$ ia sangat baik, dan memburuk saat $x$ menjauh: | $x$ | Hampiran $1+\frac x2$ | Nilai sebenarnya | Galat | |---|---|---|---| | $0{,}005$ | $1{,}0025$ | $1{,}002497$ | kurang dari $10^{-5}$ | | $0{,}05$ | $1{,}025$ | $1{,}024695$ | kurang dari $10^{-3}$ | | $0{,}2$ | $1{,}10$ | $1{,}095445$ | kurang dari $10^{-2}$ | Untuk $x=2$ ia memberi $2$ sebagai hampiran $\sqrt3$, yang bahkan tidak teliti sampai satu angka di belakang koma. **Contoh 2: pilih pusat yang lebih baik.** Linearisasi biasanya kehilangan ketelitian jauh dari pusatnya, jadi di dekat $x=3$ kita memerlukan linearisasi di $a=3$. Dengan $f(3)=2$ dan $f'(3)=\frac{1}{2\sqrt{4}}=\frac14$, $$L(x)=2+\frac14(x-3)=\frac54+\frac x4.$$ Di $x=3{,}2$ ini memberi $\sqrt{4{,}2}\approx\frac54+\frac{3{,}2}{4}=2{,}050$, yang berbeda dari nilai sebenarnya $2{,}04939$ kurang dari satu per seribu. Linearisasi di $0$ memberi $1+\frac{3{,}2}{2}=2{,}6$ di sana, meleset lebih dari $25\%$. Jadi pilih pusat $a$ yang $f(a)$ dan $f'(a)$-nya mudah dicari dan dekat dengan tempat yang diperlukan. **Contoh 3.** Untuk $f(x)=\cos x$ di $a=\frac\pi2$ kita punya $f\left(\frac\pi2\right)=0$ dan $f'\left(\frac\pi2\right)=-\sin\frac\pi2=-1$, sehingga $$L(x)=0-1\cdot\left(x-\frac\pi2\right)=-x+\frac\pi2.$$ **Linearisasi umum di $x=0$.** Menghitungnya seperti pada Contoh 1 memberi: | Fungsi | Linearisasi di $0$ | |---|---| | $\sin x$ | $x$ | | $\cos x$ | $1$ | | $\tan x$ | $x$ | | $e^x$ | $1+x$ | | $\ln(1+x)$ | $x$ | | $(1+x)^k$ | $1+kx$, untuk sebarang bilangan $k$ | Baris terakhir yang paling berguna: ia linearisasi $f(x)=(1+x)^k$, dengan $f(0)=1$ dan $f'(0)=k$. Ia baik untuk $x$ dekat $0$ dan memberi, dengan $x$ diganti sesuatu yang kecil, $$\sqrt{1+x}\approx1+\frac x2$$ $$\frac{1}{1-x}\approx1+x$$ $$\frac{1}{\sqrt{1-x^2}}\approx1+\frac{x^2}{2}$$ dan, dengan $k$ sebuah pangkat, $\sqrt[3]{1+5x^4}\approx1+\frac{5x^4}{3}$. Ia juga memperkirakan pangkat bilangan yang dekat dengan $1$: $1{,}0002^{50}\approx1+50\cdot0{,}0002=1{,}01$ (nilai sebenarnya $1{,}010049$) dan $\sqrt[3]{1{,}009}\approx1+\frac{0{,}009}{3}=1{,}003$. Cobalah fungsi, pusat, dan $x$ buatanmu sendiri di bawah. ## Apa itu diferensial dx dan dy? **Diferensial $dx$ adalah peubah bebas, perubahan $x$ yang boleh kamu pilih, dan diferensial $y=f(x)$ adalah $dy=f'(x)\,dx$, besar naik atau turunnya garis singgung ketika $x$ berubah sebesar $dx$.** Notasi $\frac{dy}{dx}$ untuk turunan tampak seperti rasio tetapi menurut definisinya bukan; diferensial membuatnya menjadi rasio, karena ketika $dx\ne0$ $$\frac{dy}{dx}=\frac{f'(x)\,dx}{dx}=f'(x).$$ Tidak seperti $dx$, peubah $dy$ selalu tak bebas: ia bergantung pada $x$ dan $dx$. Jika $dx$ diberi nilai dan $x$ adalah bilangan dalam domain, keduanya menentukan bilangan $dy$. Sering $dx$ dipilih sebagai $\Delta x$, perubahan $x$. **Contoh 4.** (a) Tentukan $dy$ jika $y=x^5+37x$. (b) Tentukan $dy$ ketika $x=1$ dan $dx=0{,}2$. Di sini $dy=\left(5x^4+37\right)dx$, dan dengan $x=1$ serta $dx=0{,}2$ nilainya $(5+37)(0{,}2)=8{,}4$. **Arti geometris.** Misalkan $x=a$ dan $dx=\Delta x$. Perubahan sebenarnya $y=f(x)$ adalah $\Delta y=f(a+dx)-f(a)$. Perubahan garis singgung $L$ yang bersesuaian adalah $$\Delta L=L(a+dx)-L(a)=f'(a)\,dx=dy.$$ Jadi $dy$ adalah perubahan linearisasi, kenaikan garis singgung pada selang $dx$, sedangkan $\Delta y$ adalah kenaikan kurva. Keduanya dekat ketika $dx$ kecil, dan menggeser penggeser di bawah memperlihatkan selisihnya. **Bentuk diferensial.** Kita kadang menulis $df=f'(x)\,dx$ dan menyebut $df$ diferensial $f$; untuk $f(x)=3x^2-6$ ia $df=d\left(3x^2-6\right)=6x\,dx$. Setiap aturan turunan memiliki bentuk diferensial: $\frac{d(u+v)}{dx}=\frac{du}{dx}+\frac{dv}{dx}$ menjadi $d(u+v)=du+dv$, dan $d(\sin u)=\cos u\,du$. **Contoh 5.** Aturan rantai dan aturan lain memberi diferensial: $$d(\tan2x)=\sec^2(2x)\,d(2x)$$ $$d(\tan2x)=2\sec^2(2x)\,dx$$ $$d\left(\frac{x}{x+1}\right)=\frac{(x+1)\,dx-x\,dx}{(x+1)^2}$$ $$d\left(\frac{x}{x+1}\right)=\frac{dx}{(x+1)^2}.$$ Yang pertama memakai [aturan rantai](https://nunada.my.id/artikel/aturan-rantai/#chain-rule), dengan $u=2x$ di dalam tangen. ## Bagaimana memperkirakan nilai dan perubahan dengan diferensial? **Untuk memperkirakan $f(a+dx)$ ketika $f(a)$ diketahui dan $dx$ kecil, pakai $f(a+dx)\approx f(a)+dy$ dengan $dy=f'(a)\,dx$; setara dengan itu, perubahan $\Delta f$ kira-kira sama dengan diferensial $df$.** Tujuannya adalah memilih titik terdekat $a$ yang $f(a)$ dan $f'(a)$-nya sama-sama mudah dihitung. **Contoh 6: luas lingkaran.** Jari-jari $r$ sebuah lingkaran bertambah dari $a=10$ m menjadi $10{,}1$ m. Pakai $dA$ untuk memperkirakan pertambahan luas, dan luas lingkaran yang membesar itu. Karena $A=\pi r^2$, pertambahan yang diperkirakan adalah $$dA=A'(a)\,dr=2\pi a\,dr$$ $$dA=2\pi(10)(0{,}1)=2\pi\ \text{m}^2.$$ Jadi $$A(10{,}1)\approx A(10)+dA$$ $$A(10{,}1)\approx100\pi+2\pi=102\pi\ \text{m}^2.$$ Secara langsung, $A(10{,}1)=\pi(10{,}1)^2=102{,}01\pi\ \text{m}^2$, sehingga galatnya $0{,}01\pi\ \text{m}^2$, selisih $\Delta A-dA$. **Contoh 7a: akar pangkat tiga.** Untuk memperkirakan $\sqrt[3]{7{,}97}$ ambil $f(x)=x^{1/3}$, dengan $dy=\frac{1}{3x^{2/3}}\,dx$. Bilangan terdekat yang akar pangkat tiganya mudah adalah $a=8$, dan agar $a+dx=7{,}97$ kita pilih $dx=-0{,}03$: $$f(7{,}97)\approx f(8)+\frac{1}{3\cdot8^{2/3}}(-0{,}03)$$ $$f(7{,}97)\approx2+\frac{1}{12}(-0{,}03)=1{,}9975.$$ Nilai sebenarnya $1{,}997497$ sampai enam angka desimal. **Contoh 7b: sebuah sinus.** Untuk memperkirakan $\sin\left(\frac\pi6+0{,}01\right)$ ambil $a=\frac\pi6$, dengan $\sin\frac\pi6=\frac12$ dan $\cos\frac\pi6=\frac{\sqrt3}{2}$, dan $dx=0{,}01$: $$\sin\left(\frac\pi6+0{,}01\right)\approx\frac12+\frac{\sqrt3}{2}(0{,}01)$$ $$\sin\left(\frac\pi6+0{,}01\right)\approx0{,}5087.$$ Nilai sebenarnya $0{,}508635$. Komputer dapat memakai cara ini: algoritma menyimpan tabel nilai sinus dan kosinus pada kisi sudut dan mengisi nilai di antaranya dengan diferensial, seperti Contoh 7b. **Perubahan mutlak, relatif, dan persen.** Ketika kita bergerak dari $a$ ke $a+dx$, perubahan $f$ dapat dinyatakan dengan tiga cara: | | Sebenarnya | Perkiraan | |---|---|---| | Perubahan mutlak | $\Delta f=f(a+dx)-f(a)$ | $df=f'(a)\,dx$ | | Perubahan relatif | $\frac{\Delta f}{f(a)}$ | $\frac{df}{f(a)}$ | | Perubahan persen | $\frac{\Delta f}{f(a)}\times100$ | $\frac{df}{f(a)}\times100$ | Pada Contoh 6 luas berubah $\frac{2\pi}{100\pi}=2\%$ (perkiraan) ketika jari-jari berubah $\frac{0{,}1}{10}=1\%$. ## Seberapa besar galatnya, dan bagaimana galat pengukuran menyebar? **Jika $f$ terdiferensialkan di $a$ dan $x$ berubah dari $a$ ke $a+\Delta x$, perubahan sebenarnya adalah $\Delta f=f'(a)\,\Delta x+\varepsilon\,\Delta x$, dengan $\varepsilon\to0$ saat $\Delta x\to0$, sehingga galat perkiraan diferensial adalah $\varepsilon\,\Delta x$, hasil kali dua besaran kecil.** Alasannya adalah definisi turunan. Galatnya adalah $$\Delta f-df=\left(\frac{f(a+\Delta x)-f(a)}{\Delta x}-f'(a)\right)\Delta x$$ $$\Delta f-df=\varepsilon\,\Delta x,$$ dan besaran dalam kurung adalah hasil bagi selisih dikurangi limitnya, yang menuju $0$. Untuk lingkaran pada Contoh 6, $\Delta A-dA=0{,}01\pi=\pi(\Delta r)^2$, sehingga $\varepsilon=\pi\,\Delta r=0{,}1\pi$. Untuk banyak fungsi umum galatnya jauh lebih kecil daripada $\Delta x$: ketika $f$ memiliki turunan kedua ia sekitar $\frac12f''(a)\,\Delta x^2$, aturan praktis yang dibuktikan nanti dengan teorema Taylor dan yang menjelaskan widget di atas, tempat kurva galat mendatar di $a$ dan tumbuh seperti parabola. **Linearisasi adalah hampiran linear terbaik.** Misalkan fungsi linear lain $g(x)=m(x-a)+c$ dipakai untuk menghampiri $f$ dengan galat $E(x)=f(x)-g(x)$, dan kita meminta dua hal: $E(a)=0$, dan $\frac{E(x)}{x-a}\to0$ saat $x\to a$ (galat dapat diabaikan dibandingkan $x-a$). Yang pertama memberi $c=f(a)$. Maka $$\frac{E(x)}{x-a}=\frac{f(x)-f(a)}{x-a}-m\;\longrightarrow\;f'(a)-m,$$ yang $0$ hanya untuk $m=f'(a)$. Jadi $L(x)=f(a)+f'(a)(x-a)$ adalah satu-satunya hampiran linear yang galatnya nol di $a$ dan dapat diabaikan dibandingkan $x-a$. Setiap garis lain yang melalui $(a,f(a))$ menyisakan galat sebesar orde $x-a$. **Kepekaan terhadap perubahan.** Persamaan $df=f'(x)\,dx$ menyatakan seberapa peka keluaran $f$ terhadap perubahan masukan pada berbagai nilai $x$: makin besar $|f'|$, makin besar pengaruh $dx$ tertentu (bandingkan [kepekaan suatu fungsi](https://nunada.my.id/artikel/turunan-sebagai-laju-perubahan/#sensitivity)). **Contoh 8.** Kedalaman sumur adalah $s=4{,}9t^2$ meter, yang dicari dengan mengukur waktu jatuh sebuah batu. Maka $ds=9{,}8t\,dt$. Jika waktu terbaca dengan galat $dt=0{,}1$ detik, maka pada $t=2$ detik galatnya sekitar $ds=(9{,}8)(2)(0{,}1)=1{,}96$ m, tetapi pada $t=5$ detik galatnya $(9{,}8)(5)(0{,}1)=4{,}9$ m. Untuk galat waktu yang sama, kedalaman lebih tidak pasti ketika jatuhnya lebih lama. **Bagaimana galat pengukuran menyebar.** Untuk besaran $y=cx^n$, seperti luas $\pi r^2$ ($n=2$) atau volume $x^3$ kubus ($n=3$), $dy=ncx^{n-1}dx$, dan membaginya dengan $y=cx^n$, $$\frac{dy}{y}=n\,\frac{dx}{x}.$$ Jadi galat relatif pada $x$ menjadi $n$ kali lebih besar pada $y$. Galat $2\%$ pada jari-jari lingkaran memberi sekitar $2\%$ pada keliling ($n=1$) dan $4\%$ pada luas; galat $0{,}5\%$ pada rusuk kubus memberi $1\%$ pada luas permukaan ($n=2$) dan $1{,}5\%$ pada volume; galat $1\%$ pada diameter bola memberi $3\%$ pada volumenya. Dibaca terbalik, ini memberi toleransi: agar volume tabung dengan tinggi sama dengan jari-jari, $V=\pi h^3$, terhitung dalam $1\%$, tinggi harus diukur dalam sekitar $\frac13\%$. **Perkiraan ini untuk perubahan kecil.** Aliran darah melalui arteri adalah $V=kr^4$, sehingga kenaikan jari-jari $10\%$ diperkirakan menaikkan aliran $4\cdot10=40\%$. Nilai sebenarnya $1{,}1^4-1=46{,}4\%$. Perkiraannya orde pertama, dan galatnya tumbuh seperti kuadrat perubahan, sehingga makin besar perubahannya, makin buruk aturan persen itu. Geser penggeser di bawah untuk melihat di mana garis dan kurva eksak berpisah. ## Untuk apa linearisasi dipakai dalam sains? **Linearisasi mengubah fungsi yang sulit menjadi sederhana untuk perubahan kecil, dan tiga pemakaian klasik adalah hampiran sudut kecil, energi massa yang bergerak, dan metode Newton.** **Sudut kecil.** Linearisasi $\sin x$ di $0$ adalah $x$, sehingga untuk sudut kecil dalam radian $\sin\theta\approx\theta$: $\sin0{,}1=0{,}0998$, dekat dengan $0{,}1$. Persamaan bandul menjadi linear dengan penggantian ini, itulah sebabnya bandul dengan ayunan kecil memiliki periode yang tetap. Sudutnya harus dalam radian; $\sin10^\circ\approx10$ salah, sedangkan $\sin10^\circ\approx0{,}1745$ benar. **Massa dan energi.** Hukum kedua Newton $F=\frac{d}{dt}(mv)=ma$ mengandaikan massa konstan, tetapi dalam rumus Einstein yang dikoreksi massanya $m=\frac{m_0}{\sqrt{1-v^2/c^2}}$, dengan $m_0$ massa diam dan $c\approx300\,000$ km/detik kecepatan cahaya. Untuk $v$ jauh lebih kecil daripada $c$ bilangan $x=\frac{v^2}{c^2}$ dekat $0$, dan linearisasi $(1-x)^{-1/2}\approx1+\frac x2$ memberi $$m\approx m_0\left(1+\frac{v^2}{2c^2}\right)$$ $$(m-m_0)c^2\approx\frac12m_0v^2.$$ Ruas kanan adalah energi kinetik fisika Newton. Jadi perubahan energi kinetik dari diam sampai kecepatan $v$ kira-kira sama dengan perubahan massa kali $c^2$, $\Delta(m)c^2\approx\Delta(\text{EK})$, dan karena $c^2\approx9\times10^{16}\ \text{m}^2/\text{detik}^2$, perubahan massa yang kecil adalah perubahan energi yang besar. Pada $v=0{,}1c$ faktor eksaknya $1{,}005038$ dan hampirannya memberi $1{,}005$. **Metode Newton.** Linearisasi $f$ di $a$ adalah sebuah garis, dan garis memiliki nol yang mudah. Menyelesaikan $L(x)=0$ memberi $x=a-\frac{f(a)}{f'(a)}$, yang biasanya lebih dekat ke nol $f$ daripada $a$. Mengulanginya adalah metode Newton. Untuk $f(x)=x^2-2$ dan awal $a=1{,}5$ nilai berikutnya adalah $1{,}416667$, $1{,}414216$, $1{,}414214$: tiga langkah untuk $\sqrt2$ sampai enam angka desimal. ## Bagaimana menghitung linearisasi dan diferensial dengan kode? **Dengan SymPy linearisasi cukup satu baris: turunkan, hitung di pusat, dan bentuk $f(a)+f'(a)(x-a)$.** Fungsi di bawah mereproduksi linearisasi dalam artikel ini secara eksak, dan baris sesudahnya memeriksa bilangan dengan Python biasa: tabel $\sqrt{1+x}\approx1+\frac x2$, lingkaran pada Contoh 6, dua perkiraan pada Contoh 7, aturan persen untuk $y=x^n$, dan langkah pertama metode Newton. ```python import math import sympy as sp x = sp.symbols('x') def linearize(f, a): """L(x) = f(a) + f'(a) (x - a)""" return sp.simplify(f.subs(x, a) + sp.diff(f, x).subs(x, a) * (x - a)) for f, a in ((sp.sqrt(1 + x), 0), (sp.sqrt(1 + x), 3), (sp.cos(x), sp.pi / 2), (sp.exp(x), 0), (sp.log(1 + x), 0), (sp.cbrt(x), 8)): print(f, 'at', a, '->', linearize(f, a)) # sqrt(x + 1) at 0 -> x/2 + 1 # sqrt(x + 1) at 3 -> x/4 + 5/4 # cos(x) at pi/2 -> -x + pi/2 # exp(x) at 0 -> x + 1 # log(x + 1) at 0 -> x # x**(1/3) at 8 -> x/12 + 4/3 # how good is sqrt(1 + x) = 1 + x/2 ? (x, approximation, true value, error) for t in (0.005, 0.05, 0.2): print(t, 1 + t / 2, round(math.sqrt(1 + t), 6), f'{abs(1 + t / 2 - math.sqrt(1 + t)):.1e}') # 0.005 1.0025 1.002497 3.1e-06 # 0.05 1.025 1.024695 3.0e-04 # 0.2 1.1 1.095445 4.6e-03 # differentials: the radius of a circle grows from 10 m to 10.1 m dA = 2 * math.pi * 10 * 0.1 true = math.pi * 10.1**2 - math.pi * 10**2 print(round(dA, 4), round(true, 4), round(true - dA, 4), round(math.pi * 0.01, 4)) # 6.2832 6.3146 0.0314 0.0314 # estimates: the cube root of 7.97 and sin(pi/6 + 0.01) print(round(2 + (-0.03) / 12, 4), round(7.97 ** (1 / 3), 6)) # 1.9975 1.997497 print(round(0.5 + math.sqrt(3) / 2 * 0.01, 4), round(math.sin(math.pi / 6 + 0.01), 6)) # 0.5087 0.508635 # a measuring error spreads: y = x^n, p% in x gives about n p% in y (n, p, estimate, exact) for n, p in ((2, 2), (3, 0.5), (4, 10)): print(n, p, n * p, round(((1 + p / 100) ** n - 1) * 100, 4)) # 2 2 4 4.04 # 3 0.5 1.5 1.5075 # 4 10 40 46.41 # Newton's method is the zero of the linearization, again and again (f(x) = x^2 - 2) a = 1.5 for step in range(4): a = a - (a * a - 2) / (2 * a) print(step + 1, a) # 1 1.4166666666666667 # 2 1.4142156862745099 # 3 1.4142135623746899 # 4 1.4142135623730951 ``` ```cpp #include #include #include using namespace std; const double PI = acos(-1.0); int main() { // how good is sqrt(1 + x) = 1 + x/2 ? (x, approximation, true value, error) double xs[3] = {0.005, 0.05, 0.2}; for (int i = 0; i < 3; i++) { double x = xs[i], approx = 1 + x / 2, truth = sqrt(1 + x); printf("%.3f %.4f %.6f %.1e\n", x, approx, truth, fabs(approx - truth)); } // differentials: the radius of a circle grows from 10 m to 10.1 m double dA = 2 * PI * 10 * 0.1; double trueChange = PI * 10.1 * 10.1 - PI * 10 * 10; printf("%.4f %.4f %.4f %.4f\n", dA, trueChange, trueChange - dA, PI * 0.01); // estimates: the cube root of 7.97, and sin(pi/6 + 0.01) printf("%.4f %.6f\n", 2 + (-0.03) / 12, pow(7.97, 1.0 / 3)); printf("%.4f %.6f\n", 0.5 + sqrt(3.0) / 2 * 0.01, sin(PI / 6 + 0.01)); // a measuring error spreads: y = x^n, p% in x gives about n p% in y (n, p, estimate, exact) int ns[3] = {2, 3, 4}; double ps[3] = {2, 0.5, 10}; for (int i = 0; i < 3; i++) printf("%d %.1f %.1f %.4f\n", ns[i], ps[i], ns[i] * ps[i], (pow(1 + ps[i] / 100, ns[i]) - 1) * 100); // Newton's method is the zero of the linearization, again and again (f(x) = x^2 - 2) double a = 1.5; for (int step = 1; step <= 4; step++) { a = a - (a * a - 2) / (2 * a); printf("%d %.13f\n", step, a); } return 0; } /* output: 0.005 1.0025 1.002497 3.1e-06 0.050 1.0250 1.024695 3.0e-04 0.200 1.1000 1.095445 4.6e-03 6.2832 6.3146 0.0314 0.0314 1.9975 1.997497 0.5087 0.508635 2 2.0 4.0 4.0400 3 0.5 1.5 1.5075 4 10.0 40.0 46.4100 1 1.4166666666667 2 1.4142156862745 3 1.4142135623747 4 1.4142135623731 */ ``` ## Dari mana asal diferensial dan hampiran linear? **Diferensial dimulai sebagai besaran yang sangat kecil tak terhingga, dan linearisasi dibuat tepat ketika besaran itu diganti dengan limit.** - **Leibniz.** Gottfried Wilhelm Leibniz memperkenalkan lambang $dx$ dan $dy$ untuk selisih yang sangat kecil tak terhingga, dan menerbitkan kalkulus diferensialnya pada 1684. Baginya $\frac{dy}{dx}$ adalah hasil bagi sejati dua besaran seperti itu, dan garis singgung adalah garis yang diikuti kurva pada langkah yang sangat kecil tak terhingga. - **Newton dan hampiran pertama.** Isaac Newton pada 1669 menjelaskan iterasi yang memperbaiki akar hampiran, yang tiap langkahnya menyelesaikan linearisasi persamaan; Joseph Raphson menerbitkan bentuk yang lebih sederhana pada 1690. Kini ia disebut metode Newton-Raphson. - **Taylor.** Brook Taylor, pada 1715, memberi aturan umum bahwa fungsi dapat dihampiri di dekat $a$ oleh polinomial yang dibentuk dari turunannya. Linearisasi adalah kasus derajat pertama, dan hampiran kuadrat, dengan $\frac12f''(a)(x-a)^2$ ditambahkan, adalah berikutnya. - **Cauchy.** Pada 1820-an Augustin-Louis Cauchy menyingkirkan yang sangat kecil tak terhingga. Ia mendefinisikan $dx$ sebagai pertambahan terhingga biasa, sebuah peubah bebas, dan diferensial sebagai $dy=f'(x)\,dx$, yaitu definisi yang dipakai di sini. Itulah sebabnya $dy$ adalah perubahan garis singgung, bukan perubahan sangat kecil tak terhingga pada kurva. ## Kesalahan apa yang sering terjadi pada linearisasi dan diferensial? **Kesalahan paling umum pada linearisasi dan diferensial adalah sembilan hal berikut, masing-masing dengan pernyataan yang benar.** | Kesalahan | Yang benar | |---|---| | ❌ $L(x)=f'(a)(x-a)$, tanpa $f(a)$ | Garis melalui $(a,f(a))$: $L(x)=f(a)+f'(a)(x-a)$. | | ❌ $L(x)=f(a)+f'(x)(x-a)$ | Gradiennya adalah bilangan $f'(a)$ di pusat, bukan fungsi $x$. | | ❌ Memakai $\sqrt{1+x}\approx1+\frac x2$ di $x=3$ dan mendapat $2{,}5$ untuk $\sqrt4$ | Pusatnya $0$ dan $3$ jauh darinya: pakai pusat $a=3$, $\frac54+\frac x4$. | | ❌ $\sin10^\circ\approx10$ | Hampiran $\sin x\approx x$ memerlukan radian: $\sin10^\circ\approx0{,}1745$. | | ❌ $dy$ sama dengan $\Delta y$ | $\Delta y$ perubahan sebenarnya kurva dan $dy=f'(a)\,dx$ perubahan garis singgung; keduanya berbeda sebesar $\varepsilon\,dx$. | | ❌ $dx$ dan $dy$ sama-sama bilangan kecil yang tetap | $dx$ adalah peubah yang kamu pilih, dan $dy=f'(x)\,dx$ dihitung darinya. | | ❌ Galat $2\%$ pada jari-jari memberi galat $2\%$ pada luas | Luasnya $\pi r^2$, jadi $n=2$: sekitar $4\%$. | | ❌ Jari-jari $10\%$ lebih besar memberi aliran tepat $40\%$ lebih banyak pada $V=kr^4$ | $40\%$ adalah perkiraan; perubahan eksaknya $1{,}1^4-1=46{,}4\%$. | | ❌ Melinearisasi $\sqrt[3]{x}$ atau $|x|$ di $0$ | Tidak ada turunan di $0$ (garis singgung tegak, sudut), sehingga tidak ada linearisasi. | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: linearisasi dan diferensial sekilas - **Linearisasi:** $L(x)=f(a)+f'(a)(x-a)$, garis singgung di pusat $a$; $f(x)\approx L(x)$ di dekat $a$. - **Ketelitian:** terbaik di dekat $a$ dan lebih buruk menjauh; galatnya sekitar $\frac12f''(a)(x-a)^2$; pilih pusat yang $f(a)$ dan $f'(a)$-nya mudah. - **Yang umum di $0$:** $\sin x\approx x$, $\cos x\approx1$, $e^x\approx1+x$, $\ln(1+x)\approx x$, $(1+x)^k\approx1+kx$. - **Diferensial:** $dy=f'(x)\,dx$, perubahan garis singgung; $\Delta y=dy+\varepsilon\,dx$ dengan $\varepsilon\to0$. - **Memperkirakan:** $f(a+dx)\approx f(a)+f'(a)\,dx$; perubahan relatif $\frac{df}{f}$, perubahan persen $\frac{df}{f}\times100$. - **Galat pengukuran:** untuk $y=cx^n$, $\frac{dy}{y}=n\frac{dx}{x}$; perkiraan ini untuk perubahan kecil. - **Hampiran linear terbaik:** satu-satunya garis dengan galat nol di $a$ dan galat dapat diabaikan dibandingkan $x-a$. - **Kode:** `sp.diff(f, x).subs(x, a)` untuk gradien, dan $x_{\text{baru}}=a-\frac{f(a)}{f'(a)}$ untuk metode Newton. ## Glosarium: istilah penting - **Linearisasi**: Fungsi linear f dari a ditambah f aksen dari a kali x dikurangi a, yang grafiknya adalah garis singgung grafik f di a; ia menghampiri f untuk x dekat a. - **Hampiran linear baku**: Hampiran f dari x oleh linearisasinya L dari x di a, berlaku ketika x dekat dengan pusat a. - **Pusat hampiran**: Titik a tempat linearisasi dibuat; hampiran itu tepat di sana dan kehilangan ketelitian saat x menjauh. - **Diferensial**: Untuk y sama dengan f dari x, diferensial dy adalah f aksen dari x kali dx, dengan dx peubah bebas; ia adalah perubahan garis singgung ketika x berubah sebesar dx. - **Perubahan relatif dan persen**: Perubahan suatu besaran dibagi nilai awalnya, dan hasil yang sama dikalikan seratus; untuk perkiraan diferensial ia adalah df dibagi f dari a. - **Galat hampiran**: Selisih antara perubahan sebenarnya dan perkiraan diferensial, sama dengan epsilon kali delta x dengan epsilon menuju nol, sehingga ia kecil bahkan dibandingkan delta x. ## Pertanyaan yang sering diajukan ### Apa itu linearisasi dalam kalkulus? Linearisasi mengganti fungsi terdiferensialkan di dekat suatu titik dengan garis singgungnya. Garis itu, f dari a ditambah f aksen dari a kali x dikurangi a, bernilai hampir sama dengan fungsi di dekat titik itu dan jauh lebih sederhana dipakai. ### Apa rumus hampiran linear? Hampiran linear f di a adalah L dari x sama dengan f dari a ditambah f aksen dari a kali x dikurangi a. Ia teliti untuk x dekat dengan pusat a, dan galatnya tumbuh kira-kira seperti kuadrat jarak dari a. ### Apa beda dy dan delta y? Delta y adalah perubahan sebenarnya fungsi ketika x berubah sebesar dx, sedangkan dy adalah f aksen dari x kali dx, perubahan garis singgung. Keduanya dekat untuk dx kecil, dan selisihnya kecil bahkan dibandingkan dx. ### Bagaimana memperkirakan nilai dengan diferensial? Pilih titik terdekat a yang f dari a dan f aksen dari a-nya mudah, lalu pakai f dari a ditambah dx kira-kira f dari a ditambah f aksen dari a kali dx. Untuk akar pangkat tiga 7,97, a adalah 8 dan dx minus 0,03, memberi 1,9975. ### Seberapa teliti hampiran linear? Ia teliti di dekat pusat dan kehilangan ketelitian menjauhinya. Galatnya sekitar setengah turunan kedua kali kuadrat jarak dari pusat, sehingga sangat kecil di dekatnya dan dapat besar di tempat yang jauh. ### Bagaimana mencari galat persen pada suatu hasil? Untuk hasil y sama dengan konstanta kali x pangkat n, galat relatif y adalah n kali galat relatif x. Galat 2 persen pada jari-jari menjadi sekitar galat 4 persen pada luas, karena n adalah 2. ### Berapa linearisasi sin x di 0? Hasilnya x itu sendiri, karena sin 0 adalah 0 dan gradien cos 0 adalah 1. Jadi untuk sudut kecil dalam radian, sin x kira-kira x. Sudutnya harus dalam radian; untuk derajat ubah dahulu. ### Apa hubungan metode Newton dengan linearisasi? Setiap langkah metode Newton mengganti fungsi dengan linearisasinya di tebakan saat ini dan mengambil nol garis itu sebagai tebakan berikutnya: a dikurangi f dari a per f aksen dari a. Prosesnya diulang sampai tebakannya menetap. --- # Related Rates Source: https://nunada.my.id/articles/related-rates/ Updated: 2026-10-19 ## Quick answer **A related rates problem asks how fast one quantity changes at one moment, given the rates of other quantities tied to it by an equation; you solve it by differentiating that equation with respect to time $t$ and then putting in the numbers of that moment.** For a sphere, $V=\frac43\pi r^3$ gives $\frac{dV}{dt}=4\pi r^2\frac{dr}{dt}$. The tool is the chain rule: every quantity is a function of $t$, so each variable brings a factor of its own rate. ### Key takeaways - Treat every changing quantity as a function of time, write one equation between them, and differentiate both sides with respect to $t$; each variable $q$ contributes a factor $\frac{dq}{dt}$ by the chain rule. - Put the numbers in after differentiating, never before: a quantity replaced by a number early becomes a constant whose rate is $0$. - The strategy has four steps: name the variables and draw a picture, write an equation between them, differentiate in $t$, then substitute the values of the moment and solve for the unknown rate. - A quantity that is decreasing has a negative rate, and angles must be in radians: $\frac13$ degree per second is $\frac{20\pi}{3}$ radians per hour. - If a second variable has no given rate, remove it first with a relation that always holds, such as similar triangles ($x=\frac y2$ in the cone) or Pythagoras. - For a ladder with $x^2+y^2=L^2$, the top moves at $\frac{dy}{dt}=-\frac xy\frac{dx}{dt}$, faster than the foot once $x>y$, and without bound as the top nears the floor. ## What are related rates? **Related rates are the rates of change, with respect to time, of several quantities that are tied together by an equation, so that knowing how fast some of them change tells you how fast another one does.** The process of finding one of them from the others is a related rates problem. Suppose air is pumped into a spherical balloon. The volume $V$ and the radius $r$ both grow with time $t$, and always $V=\frac43\pi r^3$. Because $r$ is a function of $t$, the [chain rule](https://nunada.my.id/articles/the-chain-rule/#chain-rule) differentiates the equation: $$\frac{dV}{dt}=\frac{dV}{dr}\cdot\frac{dr}{dt}=4\pi r^2\frac{dr}{dt}.$$ This is a related rates equation. It is useful because the rate of the volume is easy to measure, by metering the air, while the rate of the radius is not. If air goes in at $100\ \text{cm}^3/\text{s}$, then when $r=5$ cm $$\frac{dr}{dt}=\frac{100}{4\pi\cdot5^2}=\frac1\pi\approx0.318\ \text{cm/s}.$$ **Why it is the chain rule.** A formula such as $A=\pi r^2$ is true at every moment, so it really says $A(t)=\pi\,r(t)^2$. The derivative of $r(t)^2$ is $2\,r(t)\,r'(t)$: an outside function, the square, and an inside function, $r(t)$. Every related rates equation is made this way. Differentiate each term of the equation, and each variable $q$ that depends on time brings the factor $\frac{dq}{dt}$, which is its [rate of change](https://nunada.my.id/articles/the-derivative-as-a-rate-of-change/#rates-and-units). **The related rates equations of common formulas.** | Formula | Related rates equation | |---|---| | Area of a circle, $A=\pi r^2$ | $\frac{dA}{dt}=2\pi r\frac{dr}{dt}$ | | Volume of a sphere, $V=\frac43\pi r^3$ | $\frac{dV}{dt}=4\pi r^2\frac{dr}{dt}$ | | Surface of a sphere, $S=4\pi r^2$ | $\frac{dS}{dt}=8\pi r\frac{dr}{dt}$ | | Volume of a cube, $V=x^3$ | $\frac{dV}{dt}=3x^2\frac{dx}{dt}$ | | Volume of a cylinder, $V=\pi r^2h$ | $\frac{dV}{dt}=2\pi rh\frac{dr}{dt}+\pi r^2\frac{dh}{dt}$ | | Distance, $s^2=x^2+y^2$ | $s\frac{ds}{dt}=x\frac{dx}{dt}+y\frac{dy}{dt}$ | The cylinder row uses the product rule, because $r$ and $h$ both change. The last row divides by $2$ after differentiating, and it is the equation of the cruiser in Example 3 below. ## How do you solve a related rates problem? **Solve a related rates problem in four steps: name the variables and draw a picture, write an equation that relates them, differentiate it with respect to $t$, and only then substitute the numbers of the moment and solve for the unknown rate.** 1. **Name and draw.** Let $t$ be time and give a letter to every quantity that changes with it, assuming each is a differentiable function of $t$. Quantities that stay fixed, such as a distance of $150$ m, need no name. A picture showing the geometry is usually the key. 2. **Relate.** Write an equation between the variables, using geometry (Pythagoras, similar triangles, trigonometry) or a formula for area or volume. Combine equations until only the variables you know something about, and the one you want, are left. 3. **Differentiate.** Differentiate both sides with respect to $t$, using the chain rule on every variable. This is the related rates equation. 4. **Substitute and solve.** Put in the values and rates of the moment. You may need the equation from step 2 to find a missing value. Then solve for the unknown rate, with its sign and its units. **Example 1: water filling a cone.** Water runs into a conical tank at $0.25\ \text{m}^3/\text{min}$. The tank stands point down, is $3$ m high and has a base radius of $1.5$ m. How fast is the water level rising when the water is $1.8$ m deep? Let $V$ be the volume of the water, $x$ the radius of its surface and $y$ its depth. The water is a cone, $V=\frac13\pi x^2y$, but nothing is known about $x$ or $\frac{dx}{dt}$, so eliminate $x$. Similar [triangles](https://nunada.my.id/articles/triangles/#congruence-similarity) give $\frac x y=\frac{1.5}{3}$, that is $x=\frac y2$, and so $$V=\frac13\pi\left(\frac y2\right)^2y=\frac{\pi y^3}{12}.$$ Differentiate with respect to $t$: $$\frac{dV}{dt}=\frac{\pi y^2}{4}\frac{dy}{dt}.$$ Now put in $y=1.8$ and $\frac{dV}{dt}=0.25$: $$0.25=\frac{\pi(1.8)^2}{4}\frac{dy}{dt}$$ $$\frac{dy}{dt}=\frac{1}{3.24\pi}\approx0.098\ \text{m/min}.$$ The level is rising at about $0.098$ m per minute. Move the depth below: the same inflow raises the level more and more slowly, because the surface keeps widening. ## What do worked related rates examples look like? **Five more problems show the four steps with a tangent, a distance, a moving tangent line, a fast jet and a rope over a pulley, and each answer comes from differentiating one equation.** **Example 2: a balloon and a range finder.** A balloon rises straight up from a level field and is tracked by a range finder $150$ m from the liftoff point. When the elevation angle is $\frac\pi4$, the angle is increasing at $0.14$ rad/min. How fast is the balloon rising? Let $\theta$ be the angle and $y$ the height. Then $y=150\tan\theta$, and with the [derivative of the tangent](https://nunada.my.id/articles/derivatives-of-trigonometric-functions/#other-four) $$\frac{dy}{dt}=150\sec^2\theta\,\frac{d\theta}{dt}$$ $$\frac{dy}{dt}=150\cdot2\cdot0.14=42\ \text{m/min},$$ because $\sec^2\frac\pi4=2$. **Example 3: a cruiser chasing a car.** A police cruiser approaches a right-angled intersection from the north, chasing a car that has turned the corner and is moving east. When the cruiser is $0.6$ km north of the intersection and the car is $0.8$ km east of it, the distance between them is increasing at $30$ km/h. The cruiser is moving at $100$ km/h. How fast is the car going? Let $x$ be the car's position, $y$ the cruiser's and $s$ the distance between them, so $s^2=x^2+y^2$ and, at that moment, $s=\sqrt{0.8^2+0.6^2}=1$ km. Differentiating, $$s\frac{ds}{dt}=x\frac{dx}{dt}+y\frac{dy}{dt}$$ $$1\cdot30=0.8\frac{dx}{dt}+0.6\cdot(-100).$$ The cruiser is coming closer, so $\frac{dy}{dt}=-100$, and $\frac{dx}{dt}=\frac{30+60}{0.8}=112.5$ km/h. **Example 4: a sliding tangent line.** A particle moves clockwise at a constant rate around a circle of radius $10$ m centered at the origin, from $(0,10)$ to $(10,0)$ in $30$ s. The tangent at the particle meets the $x$-axis at $Q$, a distance $x$ from the origin. How fast is $Q$ moving when $x=20$ m? Let $\theta$ be the angle from the $x$-axis to the radius through the particle. Then $x\cos\theta=10$, and a quarter turn in half a minute makes $\frac{d\theta}{dt}=-\pi$ rad/min, negative because $\theta$ is decreasing. The product rule gives $$\frac{dx}{dt}\cos\theta-x\sin\theta\,\frac{d\theta}{dt}=0.$$ At $x=20$ we have $\cos\theta=\frac12$ and $\sin\theta=\frac{\sqrt3}{2}$, so $\frac12\frac{dx}{dt}=20\cdot\frac{\sqrt3}{2}\cdot(-\pi)$ and $\frac{dx}{dt}=-20\sqrt3\,\pi\approx-108.8$ m/min. The minus sign says that $Q$ moves toward the origin. **Example 5: a jet and a radar station.** A jet flies at a constant altitude of $10$ km toward a radar station on an island. When first detected, the line of sight makes an angle of $30^\circ$ with sea level and is turning upward at $\frac13$ degree per second. How fast is the jet approaching? With $x$ in kilometers, $x=10\cot\theta$, so $\frac{dx}{dt}=-10\csc^2\theta\,\frac{d\theta}{dt}$. Here the units need care. Angles in derivatives are in radians, and the answer is wanted in km/h, so $$\frac{d\theta}{dt}=\frac13\cdot\frac{\pi}{180}\cdot3600=\frac{20\pi}{3}\ \text{rad/h}.$$ With $\csc^2\frac\pi6=4$, $$\frac{dx}{dt}=-10\cdot4\cdot\frac{20\pi}{3}$$ $$\frac{dx}{dt}=-\frac{800\pi}{3}\approx-837.8\ \text{km/h}.$$ **Example 6: a weight on a rope.** A rope runs over a pulley $P$ that is $6$ m above a point $O$ and lifts a weight $W$; the worker holds the other end at the height of $O$ and walks away from the line under the pulley at $1.2$ m/s. The rope is $13.5$ m long. How fast is the weight rising when the worker is $x=6.3$ m from the line? Let $h$ be the height of $W$ above $O$. The rope has $6-h$ m from $W$ to $P$ and $z$ m from $P$ to the hand, so $z=7.5+h$, and Pythagoras gives $z^2=6^2+x^2$: $$x^2+36=(7.5+h)^2$$ $$2x\frac{dx}{dt}=2(7.5+h)\frac{dh}{dt}.$$ When $x=6.3$ the equation gives $(7.5+h)^2=36+39.69=75.69$, so $7.5+h=8.7$, and $$\frac{dh}{dt}=\frac{x}{7.5+h}\frac{dx}{dt}$$ $$\frac{dh}{dt}=\frac{6.3}{8.7}\cdot1.2\approx0.869\ \text{m/s}.$$ The tool below does the same steps for these problems, or for an equation of your own. Leave one value empty and it is worked out from the equation, as the angle was in Example 4. ## Why does a sliding ladder speed up as it falls? **A ladder whose foot is pulled away from a wall at a steady speed has a top that falls at $\frac xy$ times the speed of the foot, a ratio that grows as the top comes down.** Let the ladder have the length $L$, its foot $x$ from the wall and its top $y$ above the floor. The ladder, the wall and the floor make a right triangle, so for all $t$ $$x^2+y^2=L^2,$$ and $L$ is constant. Differentiating with respect to $t$, $$2x\frac{dx}{dt}+2y\frac{dy}{dt}=0\quad\Rightarrow\quad\frac{dy}{dt}=-\frac xy\,\frac{dx}{dt}.$$ For a $5$ m ladder with the foot $3$ m from the wall (so the top is $y=\sqrt{25-9}=4$ m high) pulled at $2$ m/s, the top falls at $\frac34\cdot2=1.5$ m/s. Because $\frac xy$ is small near the wall and large near the floor, the top is slow at first and fast at the end. The two speeds are equal when $x=y$, that is at $x=\frac{L}{\sqrt2}$, where the ladder is at $45^\circ$. Beyond that the top moves faster than the foot, and as $y\to0$ the ratio $\frac xy$ grows without bound. A real ladder cannot do this: it leaves the wall before the top reaches the floor, and the equation describes only a ladder that stays in contact with it. Try the sliders below; the dashed line marks $x=\frac{L}{\sqrt2}$. ## When do you put the numbers in? **Differentiate first and substitute afterwards: until the very end every changing quantity is a function of time, and a number put in too early is a constant, whose rate of change is $0$.** Take the balloon again. If you set $r=5$ in $V=\frac43\pi r^3$ at the start, you get $V=\frac{500\pi}{3}$, a constant, and differentiating gives $\frac{dV}{dt}=0$, which says that the balloon does not grow. The numbers you are given belong to one moment, while the equation holds at every moment. Differentiate the equation that holds at every moment, then read it at the one moment you care about. **What you may put in before differentiating** is only what never changes or always holds: - the constants of the problem: the $150$ m to the range finder, the $10$ km altitude of the jet, the length of the ladder, the $6$ m height of the pulley; - relations between the variables, which you use to remove a variable you have no information about, as the similar triangles removed $x$ in Example 1. **Three checks on the answer.** - Sign. A quantity that is decreasing has a negative rate. The cruiser's $y$ falls, so $\frac{dy}{dt}=-100$ and not $100$; a negative answer, like $-108.8$ m/min for $Q$, says that the quantity is decreasing, and its speed is the absolute value. - Units. The unit of the answer is the unit of the quantity per unit of time: m/min, km/h, $\text{cm}^3/\text{s}$. If the data mix minutes with hours, or degrees with radians, convert first, as in Example 5. - Radians. The derivative formulas for $\sin$, $\cos$, $\tan$ and the others hold only for angles in radians. A rate in degrees per second must be converted before it is used in $\sec^2\theta\,\frac{d\theta}{dt}$. ## How do you solve related rates problems in code? **With SymPy, declare each quantity as a function of `t`, differentiate the equation with `sp.diff`, put in the numbers of the moment and solve for the unknown rate.** The function below does the four steps of this article and reproduces Examples 1, 2, 3 and 5 with exact answers: $\frac{25}{81\pi}\approx0.0982$, $42$, $\frac{225}{2}$ and $-\frac{800\pi}{3}$. The last lines check the ladder without differentiating anything: they move the foot at $2$ m/s, time the top over a tiny step, and get the $-1.5$ m/s of the formula. ```python import math import sympy as sp t = sp.symbols('t') def solve_rate(relation, quantities, values, rates, unknown): """Differentiate relation (left - right = 0) in time, put in one moment's numbers, solve for d(unknown)/dt.""" d = {q: sp.Symbol('d' + q.func.__name__) for q in quantities} dF = sp.diff(relation, t) # step 3: the related rates equation for q in quantities: dF = dF.subs(sp.Derivative(q, t), d[q]) # dq/dt becomes a plain symbol dF = dF.subs(values).subs({d[q]: r for q, r in rates.items()}) # step 4: put in the moment return sp.simplify(sp.solve(dF, d[unknown])[0]) y, V, theta, x, s = (sp.Function(n)(t) for n in ('y', 'V', 'theta', 'x', 's')) # Example 1: V = pi y^3 / 12, dV/dt = 1/4, y = 9/5 print(solve_rate(V - sp.pi * y**3 / 12, [V, y], {y: sp.Rational(9, 5)}, {V: sp.Rational(1, 4)}, y)) # 25/(81*pi) (0.0982) # Example 2: y = 150 tan(theta), theta = pi/4, dtheta/dt = 0.14 print(solve_rate(y - 150 * sp.tan(theta), [y, theta], {theta: sp.pi / 4}, {theta: sp.Rational(14, 100)}, y)) # 42 # Example 3: s^2 = x^2 + y^2 with x = 0.8, y = 0.6, s = 1, dy/dt = -100, ds/dt = 30 print(solve_rate(s**2 - x**2 - y**2, [s, x, y], {s: 1, x: sp.Rational(4, 5), y: sp.Rational(3, 5)}, {y: -100, s: 30}, x)) # 225/2 (112.5) # Example 5: x = 10 cot(theta), theta = pi/6, dtheta/dt = 20 pi / 3 rad per hour print(solve_rate(x - 10 * sp.cot(theta), [x, theta], {theta: sp.pi / 6}, {theta: 20 * sp.pi / 3}, x)) # -800*pi/3 (-837.76) # the ladder, timed without any derivative: L = 5, foot at 3 m moving at 2 m/s L = 5.0 foot = lambda time: 3 + 2 * time top = lambda time: math.sqrt(L**2 - foot(time) ** 2) dt = 1e-6 print(round((top(dt) - top(0)) / dt, 4), -(3 / 4) * 2) # -1.5 -1.5 ``` ```cpp #include #include #include using namespace std; const double PI = acos(-1.0); // The related rates answers by really moving the quantities in time and timing the unknown. // Example 1: water fills a cone, V = pi y^3 / 12, dV/dt = 0.25, at y = 1.8 double yCone(double t) { double v = PI * 1.8 * 1.8 * 1.8 / 12 + 0.25 * t; // the volume at time t return pow(12 * v / PI, 1.0 / 3); // the depth that holds it } // Example 2: y = 150 tan(theta), theta = pi/4 + 0.14 t double yBalloon(double t) { return 150 * tan(PI / 4 + 0.14 * t); } // Example 5: x = 10 cot(theta), theta = pi/6 + (20 pi / 3) t (t in hours) double xJet(double t) { return 10 / tan(PI / 6 + 20 * PI / 3 * t); } // the ladder: L = 5, the foot at 3 m moving at 2 m/s double top(double t) { return sqrt(25 - (3 + 2 * t) * (3 + 2 * t)); } int main() { double h = 1e-6; printf("%.4f\n", (yCone(h) - yCone(-h)) / (2 * h)); // 0.0982 (25 / (81 pi)) printf("%.4f\n", (yBalloon(h) - yBalloon(-h)) / (2 * h)); // 42 printf("%.2f\n", (xJet(h / 1000) - xJet(-h / 1000)) / (2 * h / 1000)); // -837.76 (-800 pi / 3) printf("%.4f %.4f\n", (top(h) - top(-h)) / (2 * h), -(3.0 / 4) * 2); // -1.5 -1.5 return 0; } /* output: 0.0982 42.0000 -837.76 -1.5000 -1.5000 */ ``` ## Where do related rates come from? **Related rates are the original problem of Newton's calculus: given a relation between quantities that flow with time, find the relation between their rates of flow.** - **Fluents and fluxions.** In his Method of Fluxions, written in 1671 and published in 1736, Isaac Newton called a quantity that changes with time a fluent and its rate of change a fluxion, written with a dot, $\dot x$. His first problem is the one of this article: the relation of the fluents to each other is given, and the relation of their fluxions is wanted. - **Two notations.** Leibniz published his differential notation $\frac{dx}{dt}$ in 1684, and it prevailed in textbooks, because it shows which quantity is differentiated with respect to which and makes the chain rule look like a cancelation of fractions. Newton's dot survives in physics and engineering, where $\dot x$ is the derivative of a position with respect to time. - **Time as the variable.** Newton thought of time as the quantity that flows evenly and of everything else as depending on it. This is the reason why in a related rates problem there is no $x$-axis with a function on it: all the quantities are functions of $t$, and the equation between them is a constraint that holds at every moment. ## What mistakes do people make in related rates problems? **The most common mistakes in related rates problems are the nine below, each with the correct statement.** | Mistake | Correct | |---|---| | ❌ Put $r=5$ into $V=\frac43\pi r^3$ and then differentiate, getting $\frac{dV}{dt}=0$ | Differentiate first, $\frac{dV}{dt}=4\pi r^2\frac{dr}{dt}$, and put $r=5$ afterwards. | | ❌ $\frac{d}{dt}\left(r^2\right)=2r$ | $r$ depends on $t$, so the chain rule gives $2r\frac{dr}{dt}$. | | ❌ $\frac{dA}{dt}=2\pi r$ for $A=\pi r^2$ | That is $\frac{dA}{dr}$. The rate in time is $2\pi r\frac{dr}{dt}$. | | ❌ Write $\frac{dy}{dt}=100$ for a cruiser that is approaching the intersection at $100$ km/h | $y$ is decreasing, so $\frac{dy}{dt}=-100$. | | ❌ Use $\frac13$ degree per second with an answer in km/h, unchanged | Convert to radians per hour first: $\frac{20\pi}{3}$ rad/h. | | ❌ Take the distance between the car and the cruiser as $0.8+0.6=1.4$ | Pythagoras: $s=\sqrt{0.8^2+0.6^2}=1$ km. | | ❌ Differentiate $V=\frac13\pi x^2y$ with $\frac{dx}{dt}$ unknown and leave it | Remove $x$ first with similar triangles, $x=\frac y2$, so $V=\frac{\pi y^3}{12}$. | | ❌ Give a fixed length, such as the $150$ m to the range finder, a rate | A constant has $\frac{d}{dt}(150)=0$; it needs no name and does not appear. | | ❌ Read $-108.8$ m/min as "$Q$ moves away at $108.8$" | The minus sign says that $x$ is decreasing: $Q$ moves toward the origin at $108.8$ m/min. | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: related rates at a glance - **Idea:** quantities tied by an equation have rates that are tied too; differentiate the equation with respect to $t$ and each variable $q$ brings $\frac{dq}{dt}$. - **Strategy:** name the variables and draw, relate them by an equation, differentiate in $t$, then substitute the values of the moment and solve. - **Order:** differentiate first, substitute second; only constants and relations that always hold may go in earlier. - **Removing a variable:** use similar triangles, Pythagoras or trigonometry, as $x=\frac y2$ for the cone. - **Sign, units, radians:** a decreasing quantity has a negative rate; convert units; angles in radians. - **Ladder:** $x^2+y^2=L^2$ gives $\frac{dy}{dt}=-\frac xy\frac{dx}{dt}$, faster than the foot once $x>y$. - **Code:** `sp.diff(relation, t)` and `sp.solve` for the unknown rate. ## Glossary: key terms - **Related rates problem**: A problem in which several quantities change with time and are tied by an equation, and the rate of one of them is found from the rates of the others at a given moment. - **Related rates equation**: The equation obtained by differentiating an equation between changing quantities with respect to time, so that it contains their rates of change. - **Rate of change with respect to time**: The derivative of a quantity with respect to time t, written dq over dt, which says how fast the quantity changes at one moment. - **Similar triangles**: Triangles with equal angles, whose sides are in the same ratio; used in related rates to remove a variable, as the radius of the water surface in a cone. - **Fluent and fluxion**: Newton's names for a quantity that changes with time and for its rate of change; a fluxion is what we now call a time derivative and write with a dot. - **Constant of the problem**: A quantity that does not change with time, such as the length of a ladder, whose rate is zero and which may be put into the equation before differentiating. ## Frequently asked questions ### What is a related rates problem? A related rates problem has several quantities that change with time and are tied together by an equation. Given the rates of some of them at one moment, you find the rate of another by differentiating the equation with respect to time. ### How do you solve a related rates problem step by step? Name the changing quantities and draw a picture, write an equation relating them, differentiate both sides with respect to time using the chain rule, then substitute the numbers of the moment and solve for the unknown rate. ### Why do you differentiate with respect to time in related rates? Because the question is about how fast quantities change as time passes. Each quantity is a function of time, so differentiating the equation between them with respect to time gives an equation between their rates of change. ### When do you substitute the numbers in a related rates problem? After differentiating. A number put in earlier is a constant with rate zero, so it would hide the very rate you want. Only constants of the problem and relations that always hold may be used before differentiating. ### Why is the rate negative in a related rates problem? A negative rate means that the quantity is decreasing at that moment. A cruiser approaching an intersection has a negative rate for its distance from it, and a negative answer means the quantity falls; its speed is the absolute value. ### What is the related rates equation for the volume of a sphere? From the volume 4 over 3 pi r cubed you get the rate of the volume equal to 4 pi r squared times the rate of the radius. The factor 4 pi r squared is the surface area of the sphere. ### How fast does a sliding ladder fall? The top falls at x over y times the speed of the foot, where x is the distance of the foot from the wall and y the height of the top. It is slow at first and grows without bound as the top nears the floor. ### Do angles in related rates have to be in radians? Yes. The derivatives of sine, cosine and tangent are only valid for radians, so a rate given in degrees per second must be converted first. One third of a degree per second is 20 pi over 3 radians per hour. --- # Laju Terkait Source: https://nunada.my.id/artikel/laju-terkait/ Updated: 2026-10-19 ## Jawaban singkat **Soal laju terkait menanyakan seberapa cepat suatu besaran berubah pada satu saat, ketika besaran lain yang terkait dengannya lewat suatu persamaan berubah dengan laju yang diketahui; soal ini diselesaikan dengan menurunkan persamaan itu terhadap waktu $t$ lalu memasukkan bilangan pada saat tersebut.** Untuk bola, $V=\frac43\pi r^3$ memberi $\frac{dV}{dt}=4\pi r^2\frac{dr}{dt}$, sehingga laju memompa udara yang diketahui menentukan seberapa cepat jari-jarinya bertambah. Alatnya adalah aturan rantai: setiap besaran adalah fungsi dari $t$, sehingga tiap peubah membawa faktor lajunya sendiri. ### Poin penting - Perlakukan setiap besaran yang berubah sebagai fungsi waktu, tulis satu persamaan di antaranya, dan turunkan kedua ruas terhadap $t$; tiap peubah $q$ menyumbang faktor $\frac{dq}{dt}$ lewat aturan rantai. - Masukkan bilangan setelah menurunkan, jangan sebelumnya: besaran yang diganti bilangan terlalu dini menjadi konstanta yang lajunya $0$. - Strateginya empat langkah: beri nama peubah dan gambar, tulis persamaan di antaranya, turunkan terhadap $t$, lalu substitusikan nilai pada saat itu dan selesaikan untuk laju yang dicari. - Besaran yang berkurang memiliki laju negatif, dan sudut harus dalam radian: $\frac13$ derajat per detik adalah $\frac{20\pi}{3}$ radian per jam. - Jika peubah kedua tidak punya laju yang diberikan, hilangkan lebih dulu dengan hubungan yang selalu berlaku, seperti segitiga sebangun ($x=\frac y2$ pada kerucut) atau Pythagoras. - Untuk tangga dengan $x^2+y^2=L^2$, ujung atas bergerak dengan $\frac{dy}{dt}=-\frac xy\frac{dx}{dt}$, lebih cepat daripada kaki begitu $x>y$, dan tanpa batas saat ujung atas mendekati lantai. ## Apa itu laju terkait? **Laju terkait adalah laju perubahan, terhadap waktu, dari beberapa besaran yang diikat oleh suatu persamaan, sehingga mengetahui seberapa cepat sebagian di antaranya berubah memberi tahu seberapa cepat besaran lain berubah.** Proses mencari salah satunya dari yang lain disebut soal laju terkait. Misalkan udara dipompa ke balon berbentuk bola. Volume $V$ dan jari-jari $r$ sama-sama bertambah terhadap waktu $t$, dan selalu berlaku $V=\frac43\pi r^3$. Karena $r$ adalah fungsi dari $t$, [aturan rantai](https://nunada.my.id/artikel/aturan-rantai/#chain-rule) menurunkan persamaan itu: $$\frac{dV}{dt}=\frac{dV}{dr}\cdot\frac{dr}{dt}=4\pi r^2\frac{dr}{dt}.$$ Ini adalah persamaan laju terkait. Persamaan ini berguna karena laju volume mudah diukur, dengan menakar udara yang masuk, sedangkan laju jari-jari tidak. Jika udara masuk $100\ \text{cm}^3/\text{detik}$, maka ketika $r=5$ cm $$\frac{dr}{dt}=\frac{100}{4\pi\cdot5^2}=\frac1\pi\approx0{,}318\ \text{cm/detik}.$$ **Mengapa ini aturan rantai.** Rumus seperti $A=\pi r^2$ benar pada setiap saat, jadi sebenarnya ia berbunyi $A(t)=\pi\,r(t)^2$. Turunan $r(t)^2$ adalah $2\,r(t)\,r'(t)$: fungsi luar berupa kuadrat, dan fungsi dalam $r(t)$. Setiap persamaan laju terkait dibuat dengan cara ini. Turunkan tiap suku persamaan, dan tiap peubah $q$ yang bergantung pada waktu membawa faktor $\frac{dq}{dt}$, yaitu [laju perubahannya](https://nunada.my.id/artikel/turunan-sebagai-laju-perubahan/#rates-and-units). **Persamaan laju terkait dari rumus-rumus umum.** | Rumus | Persamaan laju terkait | |---|---| | Luas lingkaran, $A=\pi r^2$ | $\frac{dA}{dt}=2\pi r\frac{dr}{dt}$ | | Volume bola, $V=\frac43\pi r^3$ | $\frac{dV}{dt}=4\pi r^2\frac{dr}{dt}$ | | Luas permukaan bola, $S=4\pi r^2$ | $\frac{dS}{dt}=8\pi r\frac{dr}{dt}$ | | Volume kubus, $V=x^3$ | $\frac{dV}{dt}=3x^2\frac{dx}{dt}$ | | Volume tabung, $V=\pi r^2h$ | $\frac{dV}{dt}=2\pi rh\frac{dr}{dt}+\pi r^2\frac{dh}{dt}$ | | Jarak, $s^2=x^2+y^2$ | $s\frac{ds}{dt}=x\frac{dx}{dt}+y\frac{dy}{dt}$ | Baris tabung memakai aturan hasil kali, karena $r$ dan $h$ sama-sama berubah. Baris terakhir dibagi $2$ setelah menurunkan, dan itulah persamaan mobil polisi pada Contoh 3 di bawah. ## Bagaimana menyelesaikan soal laju terkait? **Selesaikan soal laju terkait dalam empat langkah: beri nama peubah dan gambar, tulis persamaan yang menghubungkannya, turunkan terhadap $t$, dan baru kemudian substitusikan bilangan pada saat itu dan selesaikan untuk laju yang dicari.** 1. **Beri nama dan gambar.** Misalkan $t$ adalah waktu dan beri huruf pada setiap besaran yang berubah terhadapnya, dengan anggapan masing-masing fungsi terdiferensialkan dari $t$. Besaran yang tetap, seperti jarak $150$ m, tidak perlu diberi nama. Gambar yang menunjukkan geometrinya biasanya kuncinya. 2. **Hubungkan.** Tulis persamaan antarpeubah, memakai geometri (Pythagoras, segitiga sebangun, trigonometri) atau rumus luas atau volume. Gabungkan persamaan sampai hanya peubah yang diketahui dan yang dicari yang tersisa. 3. **Turunkan.** Turunkan kedua ruas terhadap $t$, dengan aturan rantai pada setiap peubah. Inilah persamaan laju terkait. 4. **Substitusi dan selesaikan.** Masukkan nilai dan laju pada saat itu. Kamu mungkin memerlukan persamaan dari langkah 2 untuk mencari nilai yang belum ada. Lalu selesaikan untuk laju yang dicari, lengkap dengan tanda dan satuannya. **Contoh 1: air mengisi kerucut.** Air mengalir ke tangki berbentuk kerucut dengan laju $0{,}25\ \text{m}^3/\text{menit}$. Tangki berdiri dengan ujung di bawah, tingginya $3$ m dan jari-jari alasnya $1{,}5$ m. Seberapa cepat permukaan air naik ketika kedalaman air $1{,}8$ m? Misalkan $V$ volume air, $x$ jari-jari permukaannya, dan $y$ kedalamannya. Air membentuk kerucut, $V=\frac13\pi x^2y$, tetapi tidak ada informasi tentang $x$ atau $\frac{dx}{dt}$, jadi hilangkan $x$. [Segitiga](https://nunada.my.id/artikel/segitiga/#congruence-similarity) sebangun memberi $\frac x y=\frac{1{,}5}{3}$, yaitu $x=\frac y2$, sehingga $$V=\frac13\pi\left(\frac y2\right)^2y=\frac{\pi y^3}{12}.$$ Turunkan terhadap $t$: $$\frac{dV}{dt}=\frac{\pi y^2}{4}\frac{dy}{dt}.$$ Sekarang masukkan $y=1{,}8$ dan $\frac{dV}{dt}=0{,}25$: $$0{,}25=\frac{\pi(1{,}8)^2}{4}\frac{dy}{dt}$$ $$\frac{dy}{dt}=\frac{1}{3{,}24\pi}\approx0{,}098\ \text{m/menit}.$$ Permukaan air naik sekitar $0{,}098$ m per menit. Geser kedalaman di bawah: aliran yang sama menaikkan permukaan makin lambat, karena permukaannya terus melebar. ## Seperti apa contoh soal laju terkait yang dikerjakan? **Lima soal lagi menunjukkan empat langkah itu dengan tangen, jarak, garis singgung yang bergerak, jet yang cepat, dan tali pada katrol, dan setiap jawaban berasal dari menurunkan satu persamaan.** **Contoh 2: balon dan pengukur jarak.** Sebuah balon naik tegak lurus dari lapangan datar dan diamati oleh pengukur jarak yang berada $150$ m dari titik lepas landas. Ketika sudut elevasinya $\frac\pi4$, sudut itu bertambah dengan laju $0{,}14$ rad/menit. Seberapa cepat balon naik? Misalkan $\theta$ sudutnya dan $y$ tingginya. Maka $y=150\tan\theta$, dan dengan [turunan tangen](https://nunada.my.id/artikel/turunan-fungsi-trigonometri/#other-four) $$\frac{dy}{dt}=150\sec^2\theta\,\frac{d\theta}{dt}$$ $$\frac{dy}{dt}=150\cdot2\cdot0{,}14=42\ \text{m/menit},$$ karena $\sec^2\frac\pi4=2$. **Contoh 3: mobil polisi mengejar mobil.** Sebuah mobil polisi mendekati persimpangan siku-siku dari utara, mengejar mobil yang telah berbelok dan melaju ke timur. Ketika mobil polisi $0{,}6$ km di utara persimpangan dan mobil buruan $0{,}8$ km di timurnya, jarak keduanya bertambah $30$ km/jam. Mobil polisi melaju $100$ km/jam. Seberapa cepat mobil buruan itu melaju? Misalkan $x$ posisi mobil buruan, $y$ posisi mobil polisi, dan $s$ jarak keduanya, sehingga $s^2=x^2+y^2$ dan, pada saat itu, $s=\sqrt{0{,}8^2+0{,}6^2}=1$ km. Menurunkan, $$s\frac{ds}{dt}=x\frac{dx}{dt}+y\frac{dy}{dt}$$ $$1\cdot30=0{,}8\frac{dx}{dt}+0{,}6\cdot(-100).$$ Mobil polisi makin dekat, jadi $\frac{dy}{dt}=-100$, dan $\frac{dx}{dt}=\frac{30+60}{0{,}8}=112{,}5$ km/jam. **Contoh 4: garis singgung yang bergeser.** Sebuah partikel bergerak searah jarum jam dengan laju tetap mengelilingi lingkaran berjari-jari $10$ m berpusat di titik asal, dari $(0,10)$ ke $(10,0)$ dalam $30$ detik. Garis singgung di partikel memotong sumbu-$x$ di $Q$, berjarak $x$ dari titik asal. Seberapa cepat $Q$ bergerak ketika $x=20$ m? Misalkan $\theta$ sudut dari sumbu-$x$ ke jari-jari yang melalui partikel. Maka $x\cos\theta=10$, dan seperempat putaran dalam setengah menit membuat $\frac{d\theta}{dt}=-\pi$ rad/menit, negatif karena $\theta$ berkurang. Aturan hasil kali memberi $$\frac{dx}{dt}\cos\theta-x\sin\theta\,\frac{d\theta}{dt}=0.$$ Pada $x=20$ berlaku $\cos\theta=\frac12$ dan $\sin\theta=\frac{\sqrt3}{2}$, sehingga $\frac12\frac{dx}{dt}=20\cdot\frac{\sqrt3}{2}\cdot(-\pi)$ dan $\frac{dx}{dt}=-20\sqrt3\,\pi\approx-108{,}8$ m/menit. Tanda minus berarti $Q$ bergerak menuju titik asal. **Contoh 5: jet dan stasiun radar.** Sebuah jet terbang pada ketinggian tetap $10$ km menuju stasiun radar di sebuah pulau. Ketika pertama terdeteksi, garis pandang membentuk sudut $30^\circ$ dengan permukaan laut dan naik dengan laju $\frac13$ derajat per detik. Seberapa cepat jet itu mendekat? Dengan $x$ dalam kilometer, $x=10\cot\theta$, sehingga $\frac{dx}{dt}=-10\csc^2\theta\,\frac{d\theta}{dt}$. Di sini satuan perlu diperhatikan. Sudut dalam turunan dinyatakan dalam radian, dan jawaban diminta dalam km/jam, sehingga $$\frac{d\theta}{dt}=\frac13\cdot\frac{\pi}{180}\cdot3600=\frac{20\pi}{3}\ \text{rad/jam}.$$ Dengan $\csc^2\frac\pi6=4$, $$\frac{dx}{dt}=-10\cdot4\cdot\frac{20\pi}{3}$$ $$\frac{dx}{dt}=-\frac{800\pi}{3}\approx-837{,}8\ \text{km/jam}.$$ **Contoh 6: beban pada tali.** Sebuah tali melewati katrol $P$ yang berada $6$ m di atas titik $O$ dan mengangkat beban $W$; pekerja memegang ujung lainnya setinggi $O$ dan berjalan menjauhi garis di bawah katrol dengan kecepatan $1{,}2$ m/detik. Panjang tali $13{,}5$ m. Seberapa cepat beban naik ketika pekerja berjarak $x=6{,}3$ m dari garis itu? Misalkan $h$ tinggi $W$ di atas $O$. Tali memiliki panjang $6-h$ m dari $W$ ke $P$ dan $z$ m dari $P$ ke tangan, sehingga $z=7{,}5+h$, dan Pythagoras memberi $z^2=6^2+x^2$: $$x^2+36=(7{,}5+h)^2$$ $$2x\frac{dx}{dt}=2(7{,}5+h)\frac{dh}{dt}.$$ Ketika $x=6{,}3$ persamaan itu memberi $(7{,}5+h)^2=36+39{,}69=75{,}69$, sehingga $7{,}5+h=8{,}7$, dan $$\frac{dh}{dt}=\frac{x}{7{,}5+h}\frac{dx}{dt}$$ $$\frac{dh}{dt}=\frac{6{,}3}{8{,}7}\cdot1{,}2\approx0{,}869\ \text{m/detik}.$$ Alat di bawah melakukan langkah yang sama untuk soal-soal ini, atau untuk persamaan buatanmu sendiri. Kosongkan satu nilai dan ia dihitung dari persamaan, seperti sudut pada Contoh 4. ## Mengapa tangga yang meluncur makin cepat saat turun? **Tangga yang kakinya ditarik menjauhi dinding dengan kecepatan tetap memiliki ujung atas yang jatuh dengan kecepatan $\frac xy$ kali kecepatan kaki, rasio yang membesar saat ujung atas turun.** Misalkan panjang tangga $L$, kakinya berjarak $x$ dari dinding, dan ujung atasnya setinggi $y$ dari lantai. Tangga, dinding, dan lantai membentuk segitiga siku-siku, sehingga untuk semua $t$ $$x^2+y^2=L^2,$$ dan $L$ konstan. Menurunkan terhadap $t$, $$2x\frac{dx}{dt}+2y\frac{dy}{dt}=0\quad\Rightarrow\quad\frac{dy}{dt}=-\frac xy\,\frac{dx}{dt}.$$ Untuk tangga $5$ m dengan kaki $3$ m dari dinding (sehingga ujung atas setinggi $y=\sqrt{25-9}=4$ m) yang ditarik $2$ m/detik, ujung atas jatuh dengan kecepatan $\frac34\cdot2=1{,}5$ m/detik. Karena $\frac xy$ kecil di dekat dinding dan besar di dekat lantai, ujung atas lambat pada awalnya dan cepat pada akhirnya. Kedua kecepatan sama besar ketika $x=y$, yaitu di $x=\frac{L}{\sqrt2}$, tempat tangga membentuk sudut $45^\circ$. Setelah itu ujung atas bergerak lebih cepat daripada kaki, dan saat $y\to0$ rasio $\frac xy$ membesar tanpa batas. Tangga nyata tidak dapat melakukannya: ia terlepas dari dinding sebelum ujung atas mencapai lantai, dan persamaan itu hanya menggambarkan tangga yang tetap menempel pada dinding. Coba penggeser di bawah; garis putus-putus menandai $x=\frac{L}{\sqrt2}$. ## Kapan bilangan dimasukkan? **Turunkan dahulu dan substitusikan sesudahnya: sampai tahap akhir setiap besaran yang berubah adalah fungsi waktu, dan bilangan yang dimasukkan terlalu dini adalah konstanta, yang laju perubahannya $0$.** Ambil balon tadi. Jika kamu menetapkan $r=5$ dalam $V=\frac43\pi r^3$ di awal, kamu mendapat $V=\frac{500\pi}{3}$, sebuah konstanta, dan menurunkannya memberi $\frac{dV}{dt}=0$, yang berarti balon tidak membesar. Bilangan yang diberikan berlaku untuk satu saat, sedangkan persamaannya berlaku pada setiap saat. Turunkan persamaan yang berlaku pada setiap saat, lalu bacalah pada satu saat yang kamu minati. **Yang boleh dimasukkan sebelum menurunkan** hanyalah yang tidak pernah berubah atau selalu berlaku: - konstanta soal: $150$ m ke pengukur jarak, ketinggian jet $10$ km, panjang tangga, tinggi katrol $6$ m; - hubungan antarpeubah, yang dipakai untuk menghilangkan peubah yang tidak ada informasinya, seperti segitiga sebangun menghilangkan $x$ pada Contoh 1. **Tiga pemeriksaan jawaban.** - Tanda. Besaran yang berkurang memiliki laju negatif. $y$ milik mobil polisi berkurang, jadi $\frac{dy}{dt}=-100$ dan bukan $100$; jawaban negatif, seperti $-108{,}8$ m/menit untuk $Q$, berarti besaran itu berkurang, dan kelajuannya adalah nilai mutlaknya. - Satuan. Satuan jawaban adalah satuan besaran per satuan waktu: m/menit, km/jam, $\text{cm}^3/\text{detik}$. Jika data mencampur menit dengan jam, atau derajat dengan radian, ubah dahulu, seperti pada Contoh 5. - Radian. Rumus turunan $\sin$, $\cos$, $\tan$, dan yang lain hanya berlaku untuk sudut dalam radian. Laju dalam derajat per detik harus diubah sebelum dipakai dalam $\sec^2\theta\,\frac{d\theta}{dt}$. ## Bagaimana menyelesaikan soal laju terkait dengan kode? **Dengan SymPy, deklarasikan tiap besaran sebagai fungsi dari `t`, turunkan persamaan dengan `sp.diff`, masukkan bilangan pada saat itu, dan selesaikan untuk laju yang dicari.** Fungsi di bawah melakukan empat langkah artikel ini dan mereproduksi Contoh 1, 2, 3, dan 5 dengan jawaban eksak: $\frac{25}{81\pi}\approx0{,}0982$, $42$, $\frac{225}{2}$, dan $-\frac{800\pi}{3}$. Baris terakhir memeriksa tangga tanpa menurunkan apa pun: kaki digeser $2$ m/detik, ujung atas diukur selama langkah waktu yang sangat kecil, dan hasilnya $-1{,}5$ m/detik seperti pada rumus. ```python import math import sympy as sp t = sp.symbols('t') def solve_rate(relation, quantities, values, rates, unknown): """Differentiate relation (left - right = 0) in time, put in one moment's numbers, solve for d(unknown)/dt.""" d = {q: sp.Symbol('d' + q.func.__name__) for q in quantities} dF = sp.diff(relation, t) # step 3: the related rates equation for q in quantities: dF = dF.subs(sp.Derivative(q, t), d[q]) # dq/dt becomes a plain symbol dF = dF.subs(values).subs({d[q]: r for q, r in rates.items()}) # step 4: put in the moment return sp.simplify(sp.solve(dF, d[unknown])[0]) y, V, theta, x, s = (sp.Function(n)(t) for n in ('y', 'V', 'theta', 'x', 's')) # Example 1: V = pi y^3 / 12, dV/dt = 1/4, y = 9/5 print(solve_rate(V - sp.pi * y**3 / 12, [V, y], {y: sp.Rational(9, 5)}, {V: sp.Rational(1, 4)}, y)) # 25/(81*pi) (0.0982) # Example 2: y = 150 tan(theta), theta = pi/4, dtheta/dt = 0.14 print(solve_rate(y - 150 * sp.tan(theta), [y, theta], {theta: sp.pi / 4}, {theta: sp.Rational(14, 100)}, y)) # 42 # Example 3: s^2 = x^2 + y^2 with x = 0.8, y = 0.6, s = 1, dy/dt = -100, ds/dt = 30 print(solve_rate(s**2 - x**2 - y**2, [s, x, y], {s: 1, x: sp.Rational(4, 5), y: sp.Rational(3, 5)}, {y: -100, s: 30}, x)) # 225/2 (112.5) # Example 5: x = 10 cot(theta), theta = pi/6, dtheta/dt = 20 pi / 3 rad per hour print(solve_rate(x - 10 * sp.cot(theta), [x, theta], {theta: sp.pi / 6}, {theta: 20 * sp.pi / 3}, x)) # -800*pi/3 (-837.76) # the ladder, timed without any derivative: L = 5, foot at 3 m moving at 2 m/s L = 5.0 foot = lambda time: 3 + 2 * time top = lambda time: math.sqrt(L**2 - foot(time) ** 2) dt = 1e-6 print(round((top(dt) - top(0)) / dt, 4), -(3 / 4) * 2) # -1.5 -1.5 ``` ```cpp #include #include #include using namespace std; const double PI = acos(-1.0); // The related rates answers by really moving the quantities in time and timing the unknown. // Example 1: water fills a cone, V = pi y^3 / 12, dV/dt = 0.25, at y = 1.8 double yCone(double t) { double v = PI * 1.8 * 1.8 * 1.8 / 12 + 0.25 * t; // the volume at time t return pow(12 * v / PI, 1.0 / 3); // the depth that holds it } // Example 2: y = 150 tan(theta), theta = pi/4 + 0.14 t double yBalloon(double t) { return 150 * tan(PI / 4 + 0.14 * t); } // Example 5: x = 10 cot(theta), theta = pi/6 + (20 pi / 3) t (t in hours) double xJet(double t) { return 10 / tan(PI / 6 + 20 * PI / 3 * t); } // the ladder: L = 5, the foot at 3 m moving at 2 m/s double top(double t) { return sqrt(25 - (3 + 2 * t) * (3 + 2 * t)); } int main() { double h = 1e-6; printf("%.4f\n", (yCone(h) - yCone(-h)) / (2 * h)); // 0.0982 (25 / (81 pi)) printf("%.4f\n", (yBalloon(h) - yBalloon(-h)) / (2 * h)); // 42 printf("%.2f\n", (xJet(h / 1000) - xJet(-h / 1000)) / (2 * h / 1000)); // -837.76 (-800 pi / 3) printf("%.4f %.4f\n", (top(h) - top(-h)) / (2 * h), -(3.0 / 4) * 2); // -1.5 -1.5 return 0; } /* output: 0.0982 42.0000 -837.76 -1.5000 -1.5000 */ ``` ## Dari mana asal laju terkait? **Laju terkait adalah masalah asli kalkulus Newton: diberikan hubungan antarbesaran yang mengalir terhadap waktu, carilah hubungan antara laju aliran mereka.** - **Fluen dan fluksi.** Dalam Method of Fluxions, yang ditulis pada 1671 dan terbit pada 1736, Isaac Newton menyebut besaran yang berubah terhadap waktu fluen dan laju perubahannya fluksi, ditulis dengan titik, $\dot x$. Masalah pertamanya adalah masalah artikel ini: hubungan antarfluen diberikan, dan hubungan antarfluksinya dicari. - **Dua notasi.** Leibniz menerbitkan notasi diferensialnya $\frac{dx}{dt}$ pada 1684, dan notasi itu unggul di buku teks, karena menunjukkan besaran mana yang diturunkan terhadap besaran mana dan membuat aturan rantai tampak seperti mencoret pecahan. Titik Newton bertahan dalam fisika dan teknik, tempat $\dot x$ adalah turunan posisi terhadap waktu. - **Waktu sebagai peubah.** Newton memandang waktu sebagai besaran yang mengalir merata dan segala hal lain bergantung padanya. Inilah alasan mengapa dalam soal laju terkait tidak ada sumbu-$x$ dengan suatu fungsi di atasnya: semua besaran adalah fungsi dari $t$, dan persamaan di antaranya adalah kendala yang berlaku pada setiap saat. ## Kesalahan apa yang sering terjadi pada soal laju terkait? **Kesalahan paling umum pada soal laju terkait adalah sembilan hal berikut, masing-masing dengan pernyataan yang benar.** | Kesalahan | Yang benar | |---|---| | ❌ Memasukkan $r=5$ ke $V=\frac43\pi r^3$ lalu menurunkan, sehingga mendapat $\frac{dV}{dt}=0$ | Turunkan dahulu, $\frac{dV}{dt}=4\pi r^2\frac{dr}{dt}$, dan masukkan $r=5$ sesudahnya. | | ❌ $\frac{d}{dt}\left(r^2\right)=2r$ | $r$ bergantung pada $t$, sehingga aturan rantai memberi $2r\frac{dr}{dt}$. | | ❌ $\frac{dA}{dt}=2\pi r$ untuk $A=\pi r^2$ | Itu $\frac{dA}{dr}$. Laju terhadap waktu adalah $2\pi r\frac{dr}{dt}$. | | ❌ Menulis $\frac{dy}{dt}=100$ untuk mobil polisi yang mendekati persimpangan dengan $100$ km/jam | $y$ berkurang, sehingga $\frac{dy}{dt}=-100$. | | ❌ Memakai $\frac13$ derajat per detik dengan jawaban dalam km/jam, tanpa diubah | Ubah dahulu ke radian per jam: $\frac{20\pi}{3}$ rad/jam. | | ❌ Mengambil jarak mobil buruan dan mobil polisi sebagai $0{,}8+0{,}6=1{,}4$ | Pythagoras: $s=\sqrt{0{,}8^2+0{,}6^2}=1$ km. | | ❌ Menurunkan $V=\frac13\pi x^2y$ dengan $\frac{dx}{dt}$ tidak diketahui dan membiarkannya | Hilangkan $x$ dahulu dengan segitiga sebangun, $x=\frac y2$, sehingga $V=\frac{\pi y^3}{12}$. | | ❌ Memberi laju pada panjang tetap, seperti $150$ m ke pengukur jarak | Konstanta memiliki $\frac{d}{dt}(150)=0$; ia tidak perlu diberi nama dan tidak muncul. | | ❌ Membaca $-108{,}8$ m/menit sebagai "$Q$ menjauh dengan $108{,}8$" | Tanda minus berarti $x$ berkurang: $Q$ bergerak menuju titik asal dengan $108{,}8$ m/menit. | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: laju terkait sekilas - **Gagasan:** besaran yang diikat oleh persamaan memiliki laju yang juga terikat; turunkan persamaan terhadap $t$ dan tiap peubah $q$ membawa $\frac{dq}{dt}$. - **Strategi:** beri nama peubah dan gambar, hubungkan dengan persamaan, turunkan terhadap $t$, lalu substitusikan nilai pada saat itu dan selesaikan. - **Urutan:** turunkan dulu, substitusi kemudian; hanya konstanta dan hubungan yang selalu berlaku yang boleh dimasukkan lebih awal. - **Menghilangkan peubah:** pakai segitiga sebangun, Pythagoras, atau trigonometri, seperti $x=\frac y2$ untuk kerucut. - **Tanda, satuan, radian:** besaran yang berkurang memiliki laju negatif; ubah satuan; sudut dalam radian. - **Tangga:** $x^2+y^2=L^2$ memberi $\frac{dy}{dt}=-\frac xy\frac{dx}{dt}$, lebih cepat daripada kaki begitu $x>y$. - **Kode:** `sp.diff(relation, t)` dan `sp.solve` untuk laju yang dicari. ## Glosarium: istilah penting - **Soal laju terkait**: Soal ketika beberapa besaran berubah terhadap waktu dan diikat oleh suatu persamaan, dan laju salah satunya dicari dari laju yang lain pada saat tertentu. - **Persamaan laju terkait**: Persamaan yang diperoleh dengan menurunkan persamaan antarbesaran yang berubah terhadap waktu, sehingga memuat laju perubahan mereka. - **Laju perubahan terhadap waktu**: Turunan suatu besaran terhadap waktu t, ditulis dq per dt, yang menyatakan seberapa cepat besaran itu berubah pada satu saat. - **Segitiga sebangun**: Segitiga dengan sudut-sudut sama, yang sisi-sisinya berbanding sama; dipakai dalam laju terkait untuk menghilangkan peubah, seperti jari-jari permukaan air dalam kerucut. - **Fluen dan fluksi**: Nama Newton untuk besaran yang berubah terhadap waktu dan untuk laju perubahannya; fluksi adalah yang sekarang kita sebut turunan waktu dan kita tulis dengan titik. - **Konstanta soal**: Besaran yang tidak berubah terhadap waktu, seperti panjang tangga, yang lajunya nol dan boleh dimasukkan ke persamaan sebelum menurunkan. ## Pertanyaan yang sering diajukan ### Apa itu soal laju terkait? Soal laju terkait memiliki beberapa besaran yang berubah terhadap waktu dan diikat oleh suatu persamaan. Dengan laju sebagian di antaranya pada satu saat, kamu mencari laju yang lain dengan menurunkan persamaan itu terhadap waktu. ### Bagaimana menyelesaikan soal laju terkait langkah demi langkah? Beri nama besaran yang berubah dan gambar, tulis persamaan yang menghubungkannya, turunkan kedua ruas terhadap waktu dengan aturan rantai, lalu substitusikan bilangan pada saat itu dan selesaikan untuk laju yang dicari. ### Mengapa menurunkan terhadap waktu pada laju terkait? Karena pertanyaannya tentang seberapa cepat besaran berubah seiring waktu. Setiap besaran adalah fungsi waktu, sehingga menurunkan persamaan di antaranya terhadap waktu memberi persamaan antara laju perubahan mereka. ### Kapan bilangan disubstitusikan pada soal laju terkait? Setelah menurunkan. Bilangan yang dimasukkan lebih awal adalah konstanta dengan laju nol, sehingga menyembunyikan laju yang justru dicari. Hanya konstanta soal dan hubungan yang selalu berlaku yang boleh dipakai sebelum menurunkan. ### Mengapa lajunya negatif pada soal laju terkait? Laju negatif berarti besaran itu berkurang pada saat tersebut. Mobil polisi yang mendekati persimpangan memiliki laju negatif untuk jaraknya, dan jawaban negatif berarti besaran itu turun; kelajuannya adalah nilai mutlaknya. ### Apa persamaan laju terkait untuk volume bola? Dari volume 4 per 3 pi r pangkat tiga diperoleh laju volume sama dengan 4 pi r kuadrat kali laju jari-jari. Faktor 4 pi r kuadrat adalah luas permukaan bola. ### Seberapa cepat tangga yang meluncur jatuh? Ujung atas jatuh dengan kecepatan x per y kali kecepatan kaki, dengan x jarak kaki dari dinding dan y tinggi ujung atas. Awalnya lambat dan membesar tanpa batas saat ujung atas mendekati lantai. ### Apakah sudut pada laju terkait harus dalam radian? Ya. Turunan sinus, kosinus, dan tangen hanya berlaku untuk radian, sehingga laju dalam derajat per detik harus diubah lebih dulu. Sepertiga derajat per detik adalah 20 pi per 3 radian per jam. --- # Inverse Trigonometric Functions Source: https://nunada.my.id/articles/inverse-trigonometric-functions/ Updated: 2026-10-18 ## Quick answer **The inverse trigonometric functions give the angle that has a given trigonometric value, and their derivatives are algebraic: $\frac{d}{dx}\arcsin x=\frac{1}{\sqrt{1-x^2}}$, $\frac{d}{dx}\arctan x=\frac{1}{1+x^2}$ and $\frac{d}{dx}\arcsec x=\frac{1}{|x|\sqrt{x^2-1}}$.** Each comes from the rule for the derivative of an inverse, read off a reference triangle. The three "co" functions have the negatives of these derivatives, because $\arccos x=\frac\pi2-\arcsin x$ and likewise for the others. ### Key takeaways - Each trigonometric function is made one-to-one on an interval, and its inverse is the angle on that interval with the given value: $\arcsin$ and $\arctan$ give angles in $\left(-\frac\pi2,\frac\pi2\right)$, $\arccos$ and $\arccot$ in $(0,\pi)$. - $\sin(\arcsin x)=x$ for $-1\le x\le1$, but $\arcsin(\sin y)=y$ only for $-\frac\pi2\le y\le\frac\pi2$; for example $\arcsin(\sin\pi)=0$. - A right triangle with the angle $\theta=\arcsin x$ has sides $x$, $\sqrt{1-x^2}$ and $1$, which gives $\cos(\arcsin x)=\sqrt{1-x^2}$ and the derivative $\frac{1}{\cos\theta}=\frac{1}{\sqrt{1-x^2}}$. - $\arcsin$ has vertical tangents at $x=\pm1$; $\arctan$ is differentiable everywhere, with a slope at most $1$ that tends to $0$; $\arcsec$ has a positive slope on both pieces, so its formula needs $|x|$. - With the chain rule, $\frac{d}{dx}\arctan u=\frac{u'}{1+u^2}$ and $\frac{d}{dx}\arcsin u=\frac{u'}{\sqrt{1-u^2}}$; for instance $\frac{d}{dx}\arcsin\left(x^2\right)=\frac{2x}{\sqrt{1-x^4}}$. - A picture hanging $p$ to $q$ above your eye is seen at the angle $\arctan\frac qx-\arctan\frac px$, which is largest at the distance $x=\sqrt{pq}$, where its derivative is $0$. ## What are the inverse trigonometric functions? **An inverse trigonometric function gives the angle, in radians, whose sine, cosine, tangent, cotangent, secant or cosecant is a given number, chosen from one fixed interval so that it is a function.** Each trigonometric function repeats, so it is not one-to-one and has no inverse; restricting it to an interval where it is one-to-one fixes that, and reflecting the restricted graph in the line $y=x$ draws the inverse. | Function | Domain | Range | |---|---|---| | $y=\arcsin x$ | $-1\le x\le1$ | $-\frac\pi2\le y\le\frac\pi2$ | | $y=\arccos x$ | $-1\le x\le1$ | $0\le y\le\pi$ | | $y=\arctan x$ | all real $x$ | $-\frac\pi20$ take the opposite side $x$ and the adjacent side $1$, so the hypotenuse is $\sqrt{1+x^2}$ and $\sec(\arctan x)=\sqrt{1+x^2}$, $\sin(\arctan x)=\frac{x}{\sqrt{1+x^2}}$. For $\theta=\arcsec x$ with $x>1$ take the hypotenuse $x$ and the adjacent side $1$, so the opposite side is $\sqrt{x^2-1}$ and $\tan(\arcsec x)=\sqrt{x^2-1}$. For example $\cos\left(\arcsin\frac35\right)=\sqrt{1-\frac{9}{25}}=\frac45$ and $\tan\left(\arcsin\frac35\right)=\frac34$. These are the very expressions that appear in the derivatives, which is no accident: the derivative of an inverse is the reciprocal of the derivative of the trigonometric function, written in terms of the triangle. Move $x$ below and watch the triangle change: its third side comes from Pythagoras, and the derivative is read straight from it. ## What are the derivatives of arcsin and arctan? **$\frac{d}{dx}\arcsin x=\frac{1}{\sqrt{1-x^2}}$ for $-10$ on $-\frac\pi20$ on $-\frac\pi20$. **An antiderivative in disguise.** The two formulas say that $\arcsin x$ and $\arctan x$ are functions whose slopes are the algebraic expressions $\frac{1}{\sqrt{1-x^2}}$ and $\frac{1}{1+x^2}$. Reading them backwards is what a later chapter of integration does. ## What are the derivatives of arcsec, arccos, arccot and arccsc? **$\frac{d}{dx}\arcsec x=\frac{1}{|x|\sqrt{x^2-1}}$ for $|x|>1$, and the derivatives of $\arccos$, $\arccot$ and $\arccsc$ are the negatives of those of $\arcsin$, $\arctan$ and $\arcsec$.** **Arcsecant, by implicit differentiation.** The rule for inverses does not apply to $\sec$ directly, because its domain is not connected, but it applies on each piece. Let $y=\arcsec x$, so $\sec y=x$. Differentiate both sides with respect to $x$, using the [chain rule](https://nunada.my.id/articles/the-chain-rule/#chain-rule): $$\sec y\tan y\cdot\frac{dy}{dx}=1,\qquad\frac{dy}{dx}=\frac{1}{\sec y\tan y}.$$ For $|x|>1$ the angle $y$ lies in $\left(0,\frac\pi2\right)\cup\left(\frac\pi2,\pi\right)$, where $\sec y\tan y>0$. Since $\sec y=x$ and $\tan y=\pm\sqrt{\sec^2y-1}=\pm\sqrt{x^2-1}$, we get $\frac{dy}{dx}=\frac{1}{\pm x\sqrt{x^2-1}}$. The slope of the graph is positive everywhere, so the sign is the one that makes the denominator positive: $x\sqrt{x^2-1}$ for $x>1$ and $-x\sqrt{x^2-1}$ for $x<-1$. One expression covers both: $$\frac{d}{dx}\arcsec x=\frac{1}{|x|\sqrt{x^2-1}}.$$ **The co-functions.** Because $\arccos x=\frac\pi2-\arcsin x$, differentiating gives $$\frac{d}{dx}\arccos x=-\frac{d}{dx}\arcsin x$$ $$=-\frac{1}{\sqrt{1-x^2}}.$$ The same works for the others: $\arccot x=\frac\pi2-\arctan x$ and $\arccsc x=\frac\pi2-\arcsec x$. | Function | Derivative | |---|---| | $\arcsin x$ | $\frac{1}{\sqrt{1-x^2}}$ | | $\arccos x$ | $-\frac{1}{\sqrt{1-x^2}}$ | | $\arctan x$ | $\frac{1}{1+x^2}$ | | $\arccot x$ | $-\frac{1}{1+x^2}$ | | $\arcsec x$ | $\frac{1}{\left|x\right|\sqrt{x^2-1}}$ | | $\arccsc x$ | $-\frac{1}{\left|x\right|\sqrt{x^2-1}}$ | With a function $u(x)$ inside, each formula gets the factor $\frac{du}{dx}$, and the one for arcsec needs $|u|>1$: $\frac{d}{dx}\arcsec u=\frac{1}{|u|\sqrt{u^2-1}}\cdot\frac{du}{dx}$. **Example 4.** $\frac{d}{dx}\arcsec\left(5x^4\right)=\frac{1}{5x^4\sqrt{25x^8-1}}\cdot20x^3=\frac{4}{x\sqrt{25x^8-1}}$ for $5x^4>1$. The absolute value $\left|5x^4\right|=5x^4$ is just $5x^4$ because it is never negative, and the $x$ left in the denominator keeps its sign. Type any function below, built from these and the earlier functions, and see each rule applied. ## Where should you stand to see a picture best? **A picture whose lower edge hangs $p$ and whose upper edge hangs $q$ above your eye is seen at the angle $\theta(x)=\arctan\frac qx-\arctan\frac px$ when you stand $x$ away from the wall, and the angle is largest at $x=\sqrt{pq}$, the geometric mean of the two heights.** The angle between the line of sight to the top and the line of sight to the bottom is the difference of two angles of elevation, each the arctangent of a height over a distance. **The derivative.** By the chain rule, $\frac{d}{dx}\arctan\frac qx=\frac{1}{1+\frac{q^2}{x^2}}\cdot\left(-\frac{q}{x^2}\right)=-\frac{q}{x^2+q^2}$, and the same with $p$, so $$\theta'(x)=-\frac{q}{x^2+q^2}+\frac{p}{x^2+p^2}.$$ This is zero when $q\left(x^2+p^2\right)=p\left(x^2+q^2\right)$, that is $(q-p)x^2=pq(q-p)$, so $x^2=pq$ and $x=\sqrt{pq}$. For $x$ a little smaller $\theta'>0$ and for $x$ a little larger $\theta'<0$: the angle grows as you step back from very close, and shrinks as you move far away, so $x=\sqrt{pq}$ is the top of the curve. **Example.** A picture hangs from $1$ m to $3$ m above your eye. The best distance is $x=\sqrt{1\cdot3}=\sqrt3\approx1.73$ m, and the angle there is $$\theta=\arctan\frac{3}{\sqrt3}-\arctan\frac{1}{\sqrt3}$$ $$=\arctan\sqrt3-\arctan\frac{1}{\sqrt3}$$ $$=\frac\pi3-\frac\pi6=\frac\pi6,$$ which is $30^\circ$. In general the largest angle is $\arctan\frac{q-p}{2\sqrt{pq}}$. Standing very close, the picture is above you and squeezed into a narrow angle; far away it is small. The best view is in between. Choose the two heights and walk back and forth below. ## How do you compute inverse trigonometric functions and their derivatives in code? **Programming languages name them `asin`, `acos`, `atan` and `atan2`: `math.asin(x)` returns an angle in radians in $\left[-\frac\pi2,\frac\pi2\right]$, and SymPy's `sp.asin`, `sp.atan` and `sp.asec` differentiate to the formulas of this article.** There is no `asec` in Python's `math`; use `math.acos(1/x)`, which is the branch chosen here. Remember that `math.asin(math.sin(x))` is `x` only for $x$ in $\left[-\frac\pi2,\frac\pi2\right]$. The last lines scan the viewing angle of the picture from $1$ m to $3$ m and find the best distance and the largest angle without using the derivative: $\sqrt3\approx1.732$ and $30^\circ$. ```python import math import sympy as sp x = sp.symbols('x', positive=True) for f in (sp.asin(x), sp.acos(x), sp.atan(x), sp.acot(x), sp.asec(x), sp.acsc(x), sp.asin(x**2), sp.atan(1 / x), sp.asec(5 * x**4)): print(f, '->', sp.simplify(sp.diff(f, x))) # asin(x) -> 1/sqrt(1 - x**2) # acos(x) -> -1/sqrt(1 - x**2) # atan(x) -> 1/(x**2 + 1) # acot(x) -> -1/(x**2 + 1) # asec(x) -> 1/(x*sqrt(x**2 - 1)) # acsc(x) -> -1/(x*sqrt(x**2 - 1)) # asin(x**2) -> 2*x/sqrt(1 - x**4) # atan(1/x) -> -1/(x**2 + 1) # asec(5*x**4) -> 4/(x*sqrt(25*x**8 - 1)) print(round(math.asin(math.sin(math.pi)), 6), round(math.asin(math.sin(2)), 6), round(math.pi - 2, 6)) # 0.0 1.141593 1.141593 print(round(math.cos(math.asin(0.6)), 6), round(math.tan(math.asin(0.6)), 6)) # 0.8 0.75 print(round(math.degrees(math.atan(1)), 6), round(math.degrees(math.acos(-0.5)), 6)) # 45.0 120.0 angle = lambda t, p=1, q=3: math.atan(q / t) - math.atan(p / t) # the viewing angle best = max((k / 1000 for k in range(1, 20001)), key=angle) # a scan, no derivative print(best, round(math.degrees(angle(best)), 4)) # 1.732 30.0 print(round(math.sqrt(1 * 3), 4), round(math.degrees(math.atan((3 - 1) / (2 * math.sqrt(1 * 3)))), 4)) # 1.7321 30.0 ``` ```cpp #include #include #include using namespace std; const double PI = acos(-1.0); double angle(double t, double p, double q) { // the viewing angle of a picture from p to q above the eye return atan(q / t) - atan(p / t); } int main() { printf("%.6f %.6f %.6f\n", asin(sin(PI)), asin(sin(2.0)), PI - 2); // 0 1.141593 1.141593 printf("%.6f %.6f\n", cos(asin(0.6)), tan(asin(0.6))); // 0.8 0.75 printf("%.6f %.6f\n", atan(1.0) * 180 / PI, acos(-0.5) * 180 / PI); // 45 120 double best = 1, top = 0; // a scan, no derivative for (int k = 1; k <= 20000; k++) { double t = k / 1000.0; if (angle(t, 1, 3) > top) { top = angle(t, 1, 3); best = t; } } printf("%.3f %.4f\n", best, top * 180 / PI); // 1.732 30 printf("%.4f %.4f\n", sqrt(1.0 * 3), atan((3 - 1) / (2 * sqrt(1.0 * 3))) * 180 / PI); // 1.7321 30 return 0; } /* output: 0.000000 1.141593 1.141593 0.800000 0.750000 45.000000 120.000000 1.732 30.0000 1.7321 30.0000 */ ``` ## Who named the inverse trigonometric functions, and who found their series? **The arctangent had its series long before it had its derivative, and its notation settled only in the 19th century.** - **Series.** The series $\arctan x=x-\frac{x^3}{3}+\frac{x^5}{5}-\cdots$ was found by Madhava of Sangamagrama in India around the 14th century, and again by James Gregory in 1671, and by Leibniz soon after. Putting $x=1$ gives $\frac\pi4=1-\frac13+\frac15-\cdots$, the Leibniz series for $\pi$. - **Derivative.** With the calculus of Newton and Leibniz, the slope $\frac{1}{1+x^2}$ of the arctangent explains that series: the series of $\frac{1}{1+x^2}$ is a geometric series, and integrating it term by term gives the series of $\arctan x$. - **Names.** The prefix arc for the inverse trigonometric functions, because the angle measures an arc of the unit circle, is credited to Karl Scherffer in the 18th century. The exponent notation $\sin^{-1}x$ was introduced by John Herschel in 1813, which is why $\sin^{-1}$ and $\frac{1}{\sin}$ are so often confused. - **Euler.** Leonhard Euler treated the inverse trigonometric functions together with the exponential and the logarithm, and found their remarkable connection through complex numbers, $\arctan x=\frac{1}{2i}\ln\frac{1+ix}{1-ix}$. ## What mistakes do people make with inverse trigonometric functions? **The most common mistakes with inverse trigonometric functions are the nine below, each with the correct statement.** | Mistake | Correct | |---|---| | ❌ $\sin^{-1}x=\frac{1}{\sin x}$ | The $-1$ means the inverse function, $\arcsin x$; the reciprocal $\frac{1}{\sin x}$ is $\csc x$. | | ❌ $\arcsin(\sin y)=y$ for every $y$ | Only for $-\frac\pi2\le y\le\frac\pi2$: $\arcsin(\sin\pi)=0$. | | ❌ $\arccos\left(-\frac12\right)=-\frac\pi3$ | The range of $\arccos$ is $[0,\pi]$, so the answer is $\frac{2\pi}{3}$. | | ❌ $\frac{d}{dx}\arcsin x=\frac{1}{1+x^2}$ | That is the arctangent. The arcsine has $\frac{1}{\sqrt{1-x^2}}$. | | ❌ $\frac{d}{dx}\arctan x=\frac{1}{1-x^2}$ | The sign is plus: $\frac{1}{1+x^2}$, defined for every $x$. | | ❌ $\frac{d}{dx}\arccos x=\frac{1}{\sqrt{1-x^2}}$ | The arccosine falls: $-\frac{1}{\sqrt{1-x^2}}$. | | ❌ $\frac{d}{dx}\arcsin(2x)=\frac{2}{\sqrt{1-x^2}}$ | The inside is $2x$, so $\frac{2}{\sqrt{1-4x^2}}$ by the chain rule. | | ❌ $\frac{d}{dx}\arcsec x=\frac{1}{x\sqrt{x^2-1}}$ for all $x$ | The slope is positive on both pieces: use $|x|$, as $\frac{1}{|x|\sqrt{x^2-1}}$. | | ❌ $\frac{d}{dx}\frac{1}{\arctan x}=\frac{1}{1+x^2}$ | The reciprocal is a power $-1$: $-\frac{1}{\left(1+x^2\right)\arctan^2x}$. | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: inverse trigonometric functions at a glance - **Definition:** the angle with a given trigonometric value, in one fixed range: $\arcsin$ and $\arctan$ in $\left(-\frac\pi2,\frac\pi2\right)$ (closed for arcsin), $\arccos$ in $[0,\pi]$, $\arccot$ in $(0,\pi)$. - **Compositions:** $\sin(\arcsin x)=x$ but $\arcsin(\sin y)=y$ only on $\left[-\frac\pi2,\frac\pi2\right]$; $\cos(\arcsin x)=\sqrt{1-x^2}$ from the reference triangle. - **Derivatives:** $\frac{1}{\sqrt{1-x^2}}$ for arcsin, $\frac{1}{1+x^2}$ for arctan, $\frac{1}{|x|\sqrt{x^2-1}}$ for arcsec; the co-functions have the negatives. - **Chain rule:** put $u$ for $x$ and multiply by $u'$; $\frac{d}{dx}\arcsin\left(x^2\right)=\frac{2x}{\sqrt{1-x^4}}$. - **Identities:** $\arccos x=\frac\pi2-\arcsin x$, $\arcsec x=\arccos\frac1x$; the arctangent is odd with asymptotes $\pm\frac\pi2$. - **Viewing angle:** $\arctan\frac qx-\arctan\frac px$ is largest at $x=\sqrt{pq}$. - **Code:** `math.asin`, `math.acos(1/x)` for arcsec, `sp.diff(sp.asin(x), x)`. ## Glossary: key terms - **Inverse trigonometric function**: A function that gives the angle with a given sine, cosine, tangent, cotangent, secant or cosecant, chosen from one fixed interval so that it is single-valued. - **Arcsine**: The angle in the interval from minus pi over 2 to pi over 2 whose sine is x, defined for x from minus 1 to 1; it is written arcsin x or sin to the minus 1 of x. - **Arctangent**: The angle strictly between minus pi over 2 and pi over 2 whose tangent is x, defined for every real x, with horizontal asymptotes at plus and minus pi over 2. - **Reference triangle**: The right triangle drawn for an angle such as arcsin x, with sides chosen so that the right ratio equals x, used to read off the other trigonometric values. - **Cofunction identity**: The relation that an inverse cofunction is pi over 2 minus the inverse function, such as arccos x equals pi over 2 minus arcsin x, so their derivatives are negatives of each other. - **Angle of elevation**: The angle between the horizontal and the line of sight to a point above it; for a height h at distance x it is arctan of h over x. ## Frequently asked questions ### What is the derivative of arcsin x? The derivative of arcsin x is 1 over the square root of 1 minus x squared, for x between minus 1 and 1. The slope is at least 1 and grows without bound near plus and minus 1, where the graph has vertical tangent lines. ### What is the derivative of arctan x? The derivative of arctan x is 1 over 1 plus x squared, for every real x. It is largest, equal to 1, at the origin and tends to zero for large x, which is why the graph flattens towards its asymptotes at plus and minus pi over 2. ### What is the derivative of arcsec x? It is 1 over the absolute value of x times the square root of x squared minus 1, for absolute x greater than 1. The absolute value is there because the arcsecant is increasing on both pieces of its graph, so its slope is positive also for x below minus 1. ### What is the derivative of arccos x? It is minus 1 over the square root of 1 minus x squared, the negative of the derivative of arcsin x. This follows from arccos x equal to pi over 2 minus arcsin x. The same pattern gives the derivatives of arccot and arccsc. ### What is the difference between sin inverse x and 1 over sin x? The exponent minus 1 in sin inverse x means the inverse function, written arcsin x, which gives an angle. The reciprocal 1 over sin x is the cosecant of x, which is a number computed from an angle. They are unrelated functions. ### Why is arcsin of sin x not always x? Because the sine repeats, many angles share the same sine, and the arcsine returns only the one between minus pi over 2 and pi over 2. So arcsin of sin x equals x only on that interval; for x equal to pi it gives 0. ### What is cos of arcsin x? It is the square root of 1 minus x squared. Draw a right triangle with the opposite side x and the hypotenuse 1; the adjacent side is the square root of 1 minus x squared, and the cosine is adjacent over hypotenuse. ### How do you differentiate arctan of a function? Use the chain rule: the derivative of arctan u is the derivative of u divided by 1 plus u squared. For arctan of 2x that is 2 over 1 plus 4x squared. The same pattern works for arcsin, with the square root of 1 minus u squared. ### What are the limits of arctan x at infinity? As x tends to plus infinity, arctan x tends to pi over 2, and as x tends to minus infinity it tends to minus pi over 2. The graph therefore has the two horizontal asymptotes y equal to plus and minus pi over 2. --- # Fungsi Trigonometri Invers Source: https://nunada.my.id/artikel/fungsi-trigonometri-invers/ Updated: 2026-10-18 ## Jawaban singkat **Fungsi trigonometri invers memberi sudut yang memiliki nilai trigonometri tertentu, dan turunannya aljabar: $\frac{d}{dx}\arcsin x=\frac{1}{\sqrt{1-x^2}}$, $\frac{d}{dx}\arctan x=\frac{1}{1+x^2}$, dan $\frac{d}{dx}\arcsec x=\frac{1}{|x|\sqrt{x^2-1}}$.** Masing-masing berasal dari aturan turunan invers, dibaca dari segitiga acuan. Ketiga fungsi "ko" memiliki turunan yang negatif dari ini, karena $\arccos x=\frac\pi2-\arcsin x$ dan begitu pula yang lain. ### Poin penting - Setiap fungsi trigonometri dibuat satu-satu pada suatu selang, dan inversnya adalah sudut pada selang itu dengan nilai yang diberikan: $\arcsin$ dan $\arctan$ memberi sudut di $\left(-\frac\pi2,\frac\pi2\right)$, $\arccos$ dan $\arccot$ di $(0,\pi)$. - $\sin(\arcsin x)=x$ untuk $-1\le x\le1$, tetapi $\arcsin(\sin y)=y$ hanya untuk $-\frac\pi2\le y\le\frac\pi2$; misalnya $\arcsin(\sin\pi)=0$. - Segitiga siku-siku dengan sudut $\theta=\arcsin x$ memiliki sisi $x$, $\sqrt{1-x^2}$, dan $1$, yang memberi $\cos(\arcsin x)=\sqrt{1-x^2}$ dan turunan $\frac{1}{\cos\theta}=\frac{1}{\sqrt{1-x^2}}$. - $\arcsin$ memiliki garis singgung tegak di $x=\pm1$; $\arctan$ terdiferensialkan di mana-mana, dengan gradien paling besar $1$ yang menuju $0$; $\arcsec$ memiliki gradien positif pada kedua bagian, sehingga rumusnya memerlukan $|x|$. - Dengan aturan rantai, $\frac{d}{dx}\arctan u=\frac{u'}{1+u^2}$ dan $\frac{d}{dx}\arcsin u=\frac{u'}{\sqrt{1-u^2}}$; misalnya $\frac{d}{dx}\arcsin\left(x^2\right)=\frac{2x}{\sqrt{1-x^4}}$. - Lukisan yang tergantung $p$ sampai $q$ di atas matamu terlihat pada sudut $\arctan\frac qx-\arctan\frac px$, yang terbesar pada jarak $x=\sqrt{pq}$, tempat turunannya $0$. ## Apa itu fungsi trigonometri invers? **Fungsi trigonometri invers memberi sudut, dalam radian, yang sinus, kosinus, tangen, kotangen, sekan, atau kosekannya adalah bilangan tertentu, dipilih dari satu selang tetap sehingga ia menjadi fungsi.** Setiap fungsi trigonometri berulang, sehingga ia tidak satu-satu dan tidak memiliki invers; membatasinya pada selang tempat ia satu-satu memperbaikinya, dan mencerminkan grafik terbatas itu dalam garis $y=x$ menggambar inversnya. | Fungsi | Domain | Jangkauan | |---|---|---| | $y=\arcsin x$ | $-1\le x\le1$ | $-\frac\pi2\le y\le\frac\pi2$ | | $y=\arccos x$ | $-1\le x\le1$ | $0\le y\le\pi$ | | $y=\arctan x$ | semua $x$ real | $-\frac\pi20$ ambil sisi depan $x$ dan sisi samping $1$, sehingga sisi miringnya $\sqrt{1+x^2}$ dan $\sec(\arctan x)=\sqrt{1+x^2}$, $\sin(\arctan x)=\frac{x}{\sqrt{1+x^2}}$. Untuk $\theta=\arcsec x$ dengan $x>1$ ambil sisi miring $x$ dan sisi samping $1$, sehingga sisi depannya $\sqrt{x^2-1}$ dan $\tan(\arcsec x)=\sqrt{x^2-1}$. Misalnya $\cos\left(\arcsin\frac35\right)=\sqrt{1-\frac{9}{25}}=\frac45$ dan $\tan\left(\arcsin\frac35\right)=\frac34$. Inilah ekspresi yang muncul dalam turunannya, yang bukan kebetulan: turunan suatu invers adalah kebalikan turunan fungsi trigonometri, ditulis dengan segitiga. Geser $x$ di bawah dan lihat segitiga berubah: sisi ketiganya dari Pythagoras, dan turunannya dibaca langsung darinya. ## Berapa turunan arcsin dan arctan? **$\frac{d}{dx}\arcsin x=\frac{1}{\sqrt{1-x^2}}$ untuk $-10$ pada $-\frac\pi20$ pada $-\frac\pi20$. **Antiturunan yang menyamar.** Kedua rumus itu menyatakan bahwa $\arcsin x$ dan $\arctan x$ adalah fungsi yang gradiennya ekspresi aljabar $\frac{1}{\sqrt{1-x^2}}$ dan $\frac{1}{1+x^2}$. Membacanya mundur adalah yang dilakukan bab integrasi kemudian. ## Berapa turunan arcsec, arccos, arccot, dan arccsc? **$\frac{d}{dx}\arcsec x=\frac{1}{|x|\sqrt{x^2-1}}$ untuk $|x|>1$, dan turunan $\arccos$, $\arccot$, dan $\arccsc$ adalah negatif dari turunan $\arcsin$, $\arctan$, dan $\arcsec$.** **Arkus sekan, dengan diferensiasi implisit.** Aturan untuk invers tidak berlaku langsung pada $\sec$, karena domainnya tidak terhubung, tetapi ia berlaku pada tiap bagian. Misalkan $y=\arcsec x$, sehingga $\sec y=x$. Turunkan kedua ruas terhadap $x$, dengan [aturan rantai](https://nunada.my.id/artikel/aturan-rantai/#chain-rule): $$\sec y\tan y\cdot\frac{dy}{dx}=1,\qquad\frac{dy}{dx}=\frac{1}{\sec y\tan y}.$$ Untuk $|x|>1$ sudut $y$ terletak di $\left(0,\frac\pi2\right)\cup\left(\frac\pi2,\pi\right)$, tempat $\sec y\tan y>0$. Karena $\sec y=x$ dan $\tan y=\pm\sqrt{\sec^2y-1}=\pm\sqrt{x^2-1}$, kita dapatkan $\frac{dy}{dx}=\frac{1}{\pm x\sqrt{x^2-1}}$. Gradien grafik positif di mana-mana, sehingga tandanya adalah yang membuat penyebut positif: $x\sqrt{x^2-1}$ untuk $x>1$ dan $-x\sqrt{x^2-1}$ untuk $x<-1$. Satu ekspresi mencakup keduanya: $$\frac{d}{dx}\arcsec x=\frac{1}{|x|\sqrt{x^2-1}}.$$ **Fungsi-fungsi ko.** Karena $\arccos x=\frac\pi2-\arcsin x$, menurunkannya memberi $$\frac{d}{dx}\arccos x=-\frac{d}{dx}\arcsin x$$ $$=-\frac{1}{\sqrt{1-x^2}}.$$ Hal yang sama berlaku untuk yang lain: $\arccot x=\frac\pi2-\arctan x$ dan $\arccsc x=\frac\pi2-\arcsec x$. | Fungsi | Turunan | |---|---| | $\arcsin x$ | $\frac{1}{\sqrt{1-x^2}}$ | | $\arccos x$ | $-\frac{1}{\sqrt{1-x^2}}$ | | $\arctan x$ | $\frac{1}{1+x^2}$ | | $\arccot x$ | $-\frac{1}{1+x^2}$ | | $\arcsec x$ | $\frac{1}{\left|x\right|\sqrt{x^2-1}}$ | | $\arccsc x$ | $-\frac{1}{\left|x\right|\sqrt{x^2-1}}$ | Dengan fungsi $u(x)$ di dalam, tiap rumus mendapat faktor $\frac{du}{dx}$, dan yang untuk arcsec memerlukan $|u|>1$: $\frac{d}{dx}\arcsec u=\frac{1}{|u|\sqrt{u^2-1}}\cdot\frac{du}{dx}$. **Contoh 4.** $\frac{d}{dx}\arcsec\left(5x^4\right)=\frac{1}{5x^4\sqrt{25x^8-1}}\cdot20x^3=\frac{4}{x\sqrt{25x^8-1}}$ untuk $5x^4>1$. Nilai mutlak $\left|5x^4\right|=5x^4$ hanyalah $5x^4$ karena ia tidak pernah negatif, dan $x$ yang tersisa di penyebut mempertahankan tandanya. Ketik fungsi apa saja di bawah, yang dibangun dari ini dan fungsi-fungsi terdahulu, dan lihat tiap aturan yang dipakai. ## Di mana sebaiknya berdiri agar melihat lukisan dengan paling baik? **Lukisan yang tepi bawahnya tergantung $p$ dan tepi atasnya $q$ di atas matamu terlihat pada sudut $\theta(x)=\arctan\frac qx-\arctan\frac px$ ketika kamu berdiri $x$ dari dinding, dan sudut itu terbesar di $x=\sqrt{pq}$, rata-rata geometri kedua tinggi.** Sudut antara garis pandang ke atas dan garis pandang ke bawah adalah selisih dua sudut elevasi, masing-masing arkus tangen dari tinggi per jarak. **Turunannya.** Dengan aturan rantai, $\frac{d}{dx}\arctan\frac qx=\frac{1}{1+\frac{q^2}{x^2}}\cdot\left(-\frac{q}{x^2}\right)=-\frac{q}{x^2+q^2}$, dan sama dengan $p$, sehingga $$\theta'(x)=-\frac{q}{x^2+q^2}+\frac{p}{x^2+p^2}.$$ Ini nol bila $q\left(x^2+p^2\right)=p\left(x^2+q^2\right)$, yaitu $(q-p)x^2=pq(q-p)$, sehingga $x^2=pq$ dan $x=\sqrt{pq}$. Untuk $x$ sedikit lebih kecil $\theta'>0$ dan untuk $x$ sedikit lebih besar $\theta'<0$: sudut membesar saat kamu mundur dari sangat dekat, dan mengecil saat kamu menjauh, sehingga $x=\sqrt{pq}$ adalah puncak kurva. **Contoh.** Sebuah lukisan tergantung dari $1$ m sampai $3$ m di atas matamu. Jarak terbaiknya $x=\sqrt{1\cdot3}=\sqrt3\approx1{,}73$ m, dan sudut di sana $$\theta=\arctan\frac{3}{\sqrt3}-\arctan\frac{1}{\sqrt3}$$ $$=\arctan\sqrt3-\arctan\frac{1}{\sqrt3}$$ $$=\frac\pi3-\frac\pi6=\frac\pi6,$$ yaitu $30^\circ$. Secara umum sudut terbesar adalah $\arctan\frac{q-p}{2\sqrt{pq}}$. Berdiri sangat dekat, lukisan berada di atasmu dan terjepit pada sudut sempit; di kejauhan ia kecil. Pandangan terbaik ada di antaranya. Pilih kedua tinggi dan berjalanlah maju mundur di bawah. ## Bagaimana menghitung fungsi trigonometri invers dan turunannya dalam kode? **Bahasa pemrograman menamainya `asin`, `acos`, `atan`, dan `atan2`: `math.asin(x)` mengembalikan sudut dalam radian di $\left[-\frac\pi2,\frac\pi2\right]$, dan `sp.asin`, `sp.atan`, serta `sp.asec` milik SymPy menurunkan ke rumus-rumus artikel ini.** Tidak ada `asec` di `math` Python; pakai `math.acos(1/x)`, yaitu cabang yang dipilih di sini. Ingat bahwa `math.asin(math.sin(x))` adalah `x` hanya untuk $x$ di $\left[-\frac\pi2,\frac\pi2\right]$. Baris terakhir memindai sudut pandang lukisan dari $1$ m sampai $3$ m dan mencari jarak terbaik dan sudut terbesar tanpa memakai turunan: $\sqrt3\approx1{,}732$ dan $30^\circ$. ```python import math import sympy as sp x = sp.symbols('x', positive=True) for f in (sp.asin(x), sp.acos(x), sp.atan(x), sp.acot(x), sp.asec(x), sp.acsc(x), sp.asin(x**2), sp.atan(1 / x), sp.asec(5 * x**4)): print(f, '->', sp.simplify(sp.diff(f, x))) # asin(x) -> 1/sqrt(1 - x**2) # acos(x) -> -1/sqrt(1 - x**2) # atan(x) -> 1/(x**2 + 1) # acot(x) -> -1/(x**2 + 1) # asec(x) -> 1/(x*sqrt(x**2 - 1)) # acsc(x) -> -1/(x*sqrt(x**2 - 1)) # asin(x**2) -> 2*x/sqrt(1 - x**4) # atan(1/x) -> -1/(x**2 + 1) # asec(5*x**4) -> 4/(x*sqrt(25*x**8 - 1)) print(round(math.asin(math.sin(math.pi)), 6), round(math.asin(math.sin(2)), 6), round(math.pi - 2, 6)) # 0.0 1.141593 1.141593 print(round(math.cos(math.asin(0.6)), 6), round(math.tan(math.asin(0.6)), 6)) # 0.8 0.75 print(round(math.degrees(math.atan(1)), 6), round(math.degrees(math.acos(-0.5)), 6)) # 45.0 120.0 angle = lambda t, p=1, q=3: math.atan(q / t) - math.atan(p / t) # the viewing angle best = max((k / 1000 for k in range(1, 20001)), key=angle) # a scan, no derivative print(best, round(math.degrees(angle(best)), 4)) # 1.732 30.0 print(round(math.sqrt(1 * 3), 4), round(math.degrees(math.atan((3 - 1) / (2 * math.sqrt(1 * 3)))), 4)) # 1.7321 30.0 ``` ```cpp #include #include #include using namespace std; const double PI = acos(-1.0); double angle(double t, double p, double q) { // the viewing angle of a picture from p to q above the eye return atan(q / t) - atan(p / t); } int main() { printf("%.6f %.6f %.6f\n", asin(sin(PI)), asin(sin(2.0)), PI - 2); // 0 1.141593 1.141593 printf("%.6f %.6f\n", cos(asin(0.6)), tan(asin(0.6))); // 0.8 0.75 printf("%.6f %.6f\n", atan(1.0) * 180 / PI, acos(-0.5) * 180 / PI); // 45 120 double best = 1, top = 0; // a scan, no derivative for (int k = 1; k <= 20000; k++) { double t = k / 1000.0; if (angle(t, 1, 3) > top) { top = angle(t, 1, 3); best = t; } } printf("%.3f %.4f\n", best, top * 180 / PI); // 1.732 30 printf("%.4f %.4f\n", sqrt(1.0 * 3), atan((3 - 1) / (2 * sqrt(1.0 * 3))) * 180 / PI); // 1.7321 30 return 0; } /* output: 0.000000 1.141593 1.141593 0.800000 0.750000 45.000000 120.000000 1.732 30.0000 1.7321 30.0000 */ ``` ## Siapa yang menamai fungsi trigonometri invers, dan siapa yang menemukan derenya? **Arkus tangen memiliki deretnya jauh sebelum memiliki turunannya, dan notasinya baru mapan pada abad ke-19.** - **Deret.** Deret $\arctan x=x-\frac{x^3}{3}+\frac{x^5}{5}-\cdots$ ditemukan oleh Madhava dari Sangamagrama di India sekitar abad ke-14, dan lagi oleh James Gregory pada 1671, dan oleh Leibniz tak lama kemudian. Memasukkan $x=1$ memberi $\frac\pi4=1-\frac13+\frac15-\cdots$, deret Leibniz untuk $\pi$. - **Turunan.** Dengan kalkulus Newton dan Leibniz, gradien $\frac{1}{1+x^2}$ dari arkus tangen menjelaskan deret itu: deret $\frac{1}{1+x^2}$ adalah deret geometri, dan mengintegralkannya suku demi suku memberi deret $\arctan x$. - **Nama.** Awalan arc untuk fungsi trigonometri invers, karena sudut mengukur busur lingkaran satuan, dikreditkan kepada Karl Scherffer pada abad ke-18. Notasi pangkat $\sin^{-1}x$ diperkenalkan oleh John Herschel pada 1813, itulah sebabnya $\sin^{-1}$ dan $\frac{1}{\sin}$ begitu sering tertukar. - **Euler.** Leonhard Euler memperlakukan fungsi trigonometri invers bersama eksponensial dan logaritma, dan menemukan hubungan menakjubkan mereka lewat bilangan kompleks, $\arctan x=\frac{1}{2i}\ln\frac{1+ix}{1-ix}$. ## Kesalahan apa yang sering terjadi pada fungsi trigonometri invers? **Kesalahan paling umum pada fungsi trigonometri invers adalah sembilan hal berikut, masing-masing dengan pernyataan yang benar.** | Kesalahan | Yang benar | |---|---| | ❌ $\sin^{-1}x=\frac{1}{\sin x}$ | $-1$ berarti fungsi invers, $\arcsin x$; kebalikan $\frac{1}{\sin x}$ adalah $\csc x$. | | ❌ $\arcsin(\sin y)=y$ untuk setiap $y$ | Hanya untuk $-\frac\pi2\le y\le\frac\pi2$: $\arcsin(\sin\pi)=0$. | | ❌ $\arccos\left(-\frac12\right)=-\frac\pi3$ | Jangkauan $\arccos$ adalah $[0,\pi]$, sehingga jawabannya $\frac{2\pi}{3}$. | | ❌ $\frac{d}{dx}\arcsin x=\frac{1}{1+x^2}$ | Itu arkus tangen. Arkus sinus memiliki $\frac{1}{\sqrt{1-x^2}}$. | | ❌ $\frac{d}{dx}\arctan x=\frac{1}{1-x^2}$ | Tandanya plus: $\frac{1}{1+x^2}$, terdefinisi untuk setiap $x$. | | ❌ $\frac{d}{dx}\arccos x=\frac{1}{\sqrt{1-x^2}}$ | Arkus kosinus turun: $-\frac{1}{\sqrt{1-x^2}}$. | | ❌ $\frac{d}{dx}\arcsin(2x)=\frac{2}{\sqrt{1-x^2}}$ | Fungsi dalamnya $2x$, sehingga $\frac{2}{\sqrt{1-4x^2}}$ dengan aturan rantai. | | ❌ $\frac{d}{dx}\arcsec x=\frac{1}{x\sqrt{x^2-1}}$ untuk semua $x$ | Gradien positif pada kedua bagian: pakai $|x|$, sebagai $\frac{1}{|x|\sqrt{x^2-1}}$. | | ❌ $\frac{d}{dx}\frac{1}{\arctan x}=\frac{1}{1+x^2}$ | Kebalikan adalah pangkat $-1$: $-\frac{1}{\left(1+x^2\right)\arctan^2x}$. | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: fungsi trigonometri invers sekilas - **Definisi:** sudut dengan nilai trigonometri tertentu, dalam satu jangkauan tetap: $\arcsin$ dan $\arctan$ di $\left(-\frac\pi2,\frac\pi2\right)$ (tertutup untuk arcsin), $\arccos$ di $[0,\pi]$, $\arccot$ di $(0,\pi)$. - **Komposisi:** $\sin(\arcsin x)=x$ tetapi $\arcsin(\sin y)=y$ hanya pada $\left[-\frac\pi2,\frac\pi2\right]$; $\cos(\arcsin x)=\sqrt{1-x^2}$ dari segitiga acuan. - **Turunan:** $\frac{1}{\sqrt{1-x^2}}$ untuk arcsin, $\frac{1}{1+x^2}$ untuk arctan, $\frac{1}{|x|\sqrt{x^2-1}}$ untuk arcsec; fungsi ko memiliki negatifnya. - **Aturan rantai:** ganti $x$ dengan $u$ dan kalikan dengan $u'$; $\frac{d}{dx}\arcsin\left(x^2\right)=\frac{2x}{\sqrt{1-x^4}}$. - **Identitas:** $\arccos x=\frac\pi2-\arcsin x$, $\arcsec x=\arccos\frac1x$; arkus tangen ganjil dengan asimtot $\pm\frac\pi2$. - **Sudut pandang:** $\arctan\frac qx-\arctan\frac px$ terbesar di $x=\sqrt{pq}$. - **Kode:** `math.asin`, `math.acos(1/x)` untuk arcsec, `sp.diff(sp.asin(x), x)`. ## Glosarium: istilah penting - **Fungsi trigonometri invers**: Fungsi yang memberi sudut dengan sinus, kosinus, tangen, kotangen, sekan, atau kosekan tertentu, dipilih dari satu selang tetap sehingga bernilai tunggal. - **Arkus sinus**: Sudut pada selang dari minus pi per 2 sampai pi per 2 yang sinusnya x, terdefinisi untuk x dari minus 1 sampai 1; ditulis arcsin x atau sin pangkat minus 1 dari x. - **Arkus tangen**: Sudut yang tepat di antara minus pi per 2 dan pi per 2 yang tangennya x, terdefinisi untuk setiap x real, dengan asimtot mendatar di plus dan minus pi per 2. - **Segitiga acuan**: Segitiga siku-siku yang digambar untuk suatu sudut seperti arcsin x, dengan sisi dipilih sehingga rasio yang tepat sama dengan x, dipakai untuk membaca nilai trigonometri lainnya. - **Identitas kofungsi**: Hubungan bahwa kofungsi invers adalah pi per 2 dikurangi fungsi invers, seperti arccos x sama dengan pi per 2 dikurangi arcsin x, sehingga turunannya saling negatif. - **Sudut elevasi**: Sudut antara garis mendatar dan garis pandang ke suatu titik di atasnya; untuk tinggi h pada jarak x nilainya arctan dari h per x. ## Pertanyaan yang sering diajukan ### Berapa turunan arcsin x? Turunan arcsin x adalah 1 per akar 1 dikurangi x kuadrat, untuk x di antara minus 1 dan 1. Gradiennya paling sedikit 1 dan membesar tanpa batas di dekat plus dan minus 1, tempat grafik memiliki garis singgung tegak. ### Berapa turunan arctan x? Turunan arctan x adalah 1 per 1 ditambah x kuadrat, untuk setiap x real. Ia terbesar, sama dengan 1, di titik asal dan menuju nol untuk x besar, itulah sebabnya grafik melandai menuju asimtotnya di plus dan minus pi per 2. ### Berapa turunan arcsec x? Turunannya adalah 1 per nilai mutlak x kali akar x kuadrat dikurangi 1, untuk nilai mutlak x lebih besar dari 1. Nilai mutlak ada karena arkus sekan naik pada kedua bagian grafiknya, sehingga gradiennya positif juga untuk x di bawah minus 1. ### Berapa turunan arccos x? Turunannya adalah minus 1 per akar 1 dikurangi x kuadrat, negatif dari turunan arcsin x. Ini mengikuti dari arccos x sama dengan pi per 2 dikurangi arcsin x. Pola yang sama memberi turunan arccot dan arccsc. ### Apa beda sin invers x dan 1 per sin x? Pangkat minus 1 pada sin invers x berarti fungsi invers, ditulis arcsin x, yang memberi sudut. Kebalikan 1 per sin x adalah kosekan x, yaitu bilangan yang dihitung dari sudut. Keduanya fungsi yang tidak berkaitan. ### Mengapa arcsin dari sin x tidak selalu x? Karena sinus berulang, banyak sudut memiliki sinus yang sama, dan arkus sinus hanya mengembalikan yang di antara minus pi per 2 dan pi per 2. Jadi arcsin dari sin x sama dengan x hanya pada selang itu; untuk x sama dengan pi hasilnya 0. ### Berapa cos dari arcsin x? Hasilnya akar 1 dikurangi x kuadrat. Gambar segitiga siku-siku dengan sisi depan x dan sisi miring 1; sisi sampingnya akar 1 dikurangi x kuadrat, dan kosinus adalah samping per miring. ### Bagaimana menurunkan arctan dari suatu fungsi? Pakai aturan rantai: turunan arctan u adalah turunan u dibagi 1 ditambah u kuadrat. Untuk arctan dari 2x itu 2 per 1 ditambah 4x kuadrat. Pola yang sama berlaku untuk arcsin, dengan akar 1 dikurangi u kuadrat. ### Berapa limit arctan x di tak hingga? Saat x menuju plus tak hingga, arctan x menuju pi per 2, dan saat x menuju minus tak hingga ia menuju minus pi per 2. Karena itu grafik memiliki dua asimtot mendatar y sama dengan plus dan minus pi per 2. --- # Derivatives of Inverse Functions and Logarithms Source: https://nunada.my.id/articles/derivatives-of-inverse-functions-and-logarithms/ Updated: 2026-10-17 ## Quick answer **The derivative of an inverse function at a point is the reciprocal of the derivative of the function at the corresponding point: $\left(f^{-1}\right)'(b)=\frac{1}{f'\left(f^{-1}(b)\right)}$, and this gives $\frac{d}{dx}\ln x=\frac1x$.** With the chain rule, $\frac{d}{dx}\ln u=\frac{u'}{u}$. Exponentials with other bases follow: $\frac{d}{dx}a^x=a^x\ln a$ and $\frac{d}{dx}\log_a x=\frac{1}{x\ln a}$. When a function is a product, a quotient or has a variable exponent, taking $\ln$ first, logarithmic differentiation, is the quick way. ### Key takeaways - If $f$ is differentiable with $f'\ne0$ on an interval, then $f^{-1}$ is differentiable and $\left(f^{-1}\right)'(b)=\frac{1}{f'(a)}$ where $a=f^{-1}(b)$: the two slopes are reciprocals at corresponding points, like a line and its mirror image in $y=x$. - Applied to $e^x$ the rule gives $\frac{d}{dx}\ln x=\frac1x$ for $x>0$; with the chain rule $\frac{d}{dx}\ln u=\frac{u'}{u}$, and $\frac{d}{dx}\ln|x|=\frac1x$ for every $x\ne0$. - $\frac{d}{dx}a^x=a^x\ln a$ and $\frac{d}{dx}\log_a x=\frac{1}{x\ln a}$; only for $a=e$ is $\ln a=1$, which is why $e$ is the base calculus prefers. - The number $e$ is the limit of $(1+h)^{1/h}$ as $h\to0$, because the logarithm of that expression is the difference quotient $\frac{\ln(1+h)}{h}$ of $\ln$ at $1$, which tends to $\frac11=1$. - Logarithmic differentiation: take $\ln$ of $y$, split with the laws of logarithms, differentiate, and multiply by $y$; for $y=x^x$ it gives $y'=x^x(\ln x+1)$. - With $x^n=e^{n\ln x}$ the power rule $\frac{d}{dx}x^n=nx^{n-1}$ holds for every real $n$, irrational ones included; $x^\pi$, $\pi^x$ and $x^x$ are three different cases. ## What is the derivative of an inverse function? **If $f$ has an interval as domain and $f'$ exists and is never zero there, then $f^{-1}$ is differentiable at every point of its domain and $\left(f^{-1}\right)'(b)=\frac{1}{f'\left(f^{-1}(b)\right)}$.** In words: the slope of $f^{-1}$ at $x=b$ is the reciprocal of the slope of $f$ at $x=f^{-1}(b)$. The inverse of $f$ undoes it, so its graph is the mirror image of the graph of $f$ in the line $y=x$, and a mirror turns a slope $m$ into $\frac1m$. **A line first.** The function $f(x)=\frac12x+1$ has inverse $f^{-1}(x)=2x-2$. Their derivatives are $\frac12$ and $2$, reciprocals of each other. Reflecting any line that is neither horizontal nor vertical in $y=x$ inverts its slope. **Other functions: compare at corresponding points.** If the slope of $y=f(x)$ at the point $(a,b)$ is $f'(a)$, with $b=f(a)$, then the slope of $y=f^{-1}(x)$ at the mirror point $(b,a)$ is $\frac{1}{f'(a)}$. The derivative of $f$ is read at $a$ and the derivative of $f^{-1}$ at $b=f(a)$. If $f$ has a horizontal tangent at $(a,b)$, its inverse has a vertical tangent at $(b,a)$ and no derivative there, which is why $f'\ne0$ is part of the condition. **Why the formula holds.** Start from $f\left(f^{-1}(x)\right)=x$ and differentiate both sides, using the [chain rule](https://nunada.my.id/articles/the-chain-rule/#chain-rule) on the left: $$f'\left(f^{-1}(x)\right)\cdot\left(f^{-1}\right)'(x)=1.$$ Solve for $\left(f^{-1}\right)'(x)$ and the rule appears. The proof assumes that $f^{-1}$ is differentiable; that it is, when $f'\ne0$, is the first half of the theorem, which this article takes on trust. **Example 1.** The function $f(x)=x^2$ for $x>0$ has the inverse $f^{-1}(x)=\sqrt x$. The rule says $\left(f^{-1}\right)'(x)=\frac{1}{f'\left(\sqrt x\right)}=\frac{1}{2\sqrt x}$, the known derivative of the square root. At $a=2$ and $b=f(2)=4$: $f'(2)=4$ and $\left(f^{-1}\right)'(4)=\frac14$. **Example 2.** Let $f(x)=x^3-2$ for $x>0$. Find $\left(f^{-1}\right)'(6)$ without a formula for $f^{-1}$. First find $a$ with $f(a)=6$: $a^3-2=6$, so $a=2$. Then $f'(2)=3\cdot2^2=12$, and $$\left(f^{-1}\right)'(6)=\frac{1}{f'(2)}=\frac{1}{12}.$$ Here it is the equation $f(a)=6$ that does the work of the missing formula. Choose a function below and slide $a$: the mirror-image graph and the two tangent lines are drawn, and the slope of the inverse is checked against a numerical inverse. ## What is the derivative of ln x? **The derivative of the natural logarithm is $\frac{d}{dx}\ln x=\frac1x$ for $x>0$, and with the [chain rule](https://nunada.my.id/articles/the-chain-rule/#outside-inside), $\frac{d}{dx}\ln u=\frac{1}{u}\cdot\frac{du}{dx}$ for a positive differentiable $u(x)$.** The function $\ln x$ is the inverse of $e^x$, whose derivative is $e^x$ itself. By the rule for inverses, with $f(x)=e^x$ and $f^{-1}(x)=\ln x$: $$\left(f^{-1}\right)'(x)=\frac{1}{f'\left(\ln x\right)}=\frac{1}{e^{\ln x}}=\frac1x.$$ **A second derivation, by implicit differentiation.** Let $y=\ln x$, so that $e^y=x$. Differentiate both sides with respect to $x$, using the chain rule on $e^y$: $$e^y\,\frac{dy}{dx}=1,\qquad\frac{dy}{dx}=\frac{1}{e^y}=\frac1x.$$ This is the [implicit differentiation](https://nunada.my.id/articles/implicit-differentiation/#method) of an equation that cannot be solved for $y$ without the very function being differentiated. **Example 3.** Four derivatives with $\ln$. - $\frac{d}{dx}\ln2x=\frac{1}{2x}\cdot2=\frac1x$. The constant disappears: $\ln2x=\ln2+\ln x$. - $\frac{d}{dx}\ln\left(x^2+3\right)=\frac{1}{x^2+3}\cdot2x=\frac{2x}{x^2+3}$. - $\frac{d}{dx}\ln^3x=3\ln^2x\cdot\frac1x=\frac{3\ln^2x}{x}$, since the outside is a cube and the inside is $\ln x$. - $\frac{d}{dx}\ln|x|=\frac{1}{|x|}\cdot\frac{x}{|x|}=\frac1x$ for $x\ne0$, by $\frac{d}{dx}|x|=\frac{x}{|x|}$. So $\frac1x$ is the derivative of $\ln x$ on $x>0$ and of $\ln(-x)$ on $x<0$. **Logarithms of products and powers first.** The laws of logarithms make many derivatives shorter. For instance $\ln\sqrt{x^2+1}=\frac12\ln\left(x^2+1\right)$ has the derivative $\frac12\cdot\frac{2x}{x^2+1}=\frac{x}{x^2+1}$, with no square-root derivative at all. **Example 4.** A line of slope $m$ through the origin is tangent to the graph of $y=\ln x$. What is $m$? Let the point of tangency be $(a,\ln a)$. The slope there is $\frac1a$, and a line through the origin and $(a,\ln a)$ has slope $\frac{\ln a}{a}$. Setting them equal, $$\frac1a=\frac{\ln a}{a},\qquad\ln a=1,\qquad a=e,\qquad m=\frac1e.$$ The tangent line is $y=\frac{x}{e}$, and it touches the graph at $(e,1)$. The curve $\ln x$ climbs ever more slowly, and the slope $\frac1x$ falls from large values near $0$ to small ones. *y = ln x (green), its slope 1/x (orange) and the tangent line y = x/e through the origin (blue), which touches at (e, 1).* ## What are the derivatives of a^x and log base a, and where does e come from? **For $a>0$, $\frac{d}{dx}a^x=a^x\ln a$, and for $a>0$ with $a\ne1$, $\frac{d}{dx}\log_ax=\frac{1}{x\ln a}$.** Both follow from the natural logarithm. By definition $a^x=e^{x\ln a}$, so by the [chain rule](https://nunada.my.id/articles/the-chain-rule/#outside-inside) the derivative of the exponential $e^{u}$ with $u=x\ln a$ is $e^{x\ln a}\cdot\ln a=a^x\ln a$. With a function $u(x)$ in the exponent, $$\frac{d}{dx}a^u=a^u\ln a\cdot\frac{du}{dx}.$$ For a logarithm, the change-of-base formula $\log_ax=\frac{\ln x}{\ln a}$ shows a constant $\frac{1}{\ln a}$ in front of $\ln x$, so $$\frac{d}{dx}\log_au=\frac{1}{u\ln a}\cdot\frac{du}{dx}.$$ **Example 5.** Derivatives of general exponentials. - $\frac{d}{dx}3^x=3^x\ln3$. - $\frac{d}{dx}3^{-x}=3^{-x}\ln3\cdot(-1)=-3^{-x}\ln3$. - $\frac{d}{dx}3^{\sin x}=3^{\sin x}\ln3\cdot\cos x$. - $\frac{d}{dx}\sin\left(3^x\right)=\cos\left(3^x\right)\cdot3^x\ln3$, with two layers, the sine and the exponential. **Example 6.** Derivatives of logarithms to other bases: $\frac{d}{dx}\log_{10}x=\frac{1}{x\ln10}$, and $\frac{d}{dx}\log_2\left(x^2+1\right)=\frac{2x}{\left(x^2+1\right)\ln2}$. **Why $e$ is the preferred base.** If $a=e$ then $\ln a=1$ and the factor disappears: $\frac{d}{dx}e^x=e^x$, and $\frac{d}{dx}\log_ex=\frac1x$. For any other base a constant $\ln a$ follows every derivative. The slope of $a^x$ where its graph crosses the $y$-axis is $a^0\ln a=\ln a$, and by the definition of the derivative it is the limit $$\lim_{h\to0}\frac{a^h-1}{h}=\ln a.$$ For $a=e$ that limit is $1$: $e$ is the base for which the curve $a^x$ leaves the $y$-axis with slope exactly $1$. **The number $e$ as a limit.** The derivative of $\ln$ at $1$ is $\frac11=1$, and by the definition of the derivative it is $\lim_{h\to0}\frac{\ln(1+h)-\ln1}{h}=\lim_{h\to0}\frac{\ln(1+h)}{h}$. So $\frac{\ln(1+h)}{h}\to1$. Since $\frac{\ln(1+h)}{h}=\ln\left((1+h)^{1/h}\right)$ and $e^x$ is continuous, $$\lim_{h\to0}(1+h)^{1/h}=e^1=e.$$ This is the limit behind compound interest. With $h=\frac1n$ it reads $\left(1+\frac1n\right)^n\to e$: money that earns interest $12$ times a year grows by a factor $\left(1+\frac{1}{12}\right)^{12}\approx2.613$ over a year at a nominal rate of $100\%$, $365$ times a year by $2.7146$, and continuously by $e\approx2.71828$. **An honest remark.** The derivations above assume that the limits $\frac{a^h-1}{h}$ exist. They do, and a later chapter of the book defines $\ln$ and $e^x$ in a way that proves it; here they are taken as known. Shrink $h$ below and watch the three limits settle. ## What is logarithmic differentiation, and when does it help? **Logarithmic differentiation takes the natural logarithm of both sides of $y=f(x)$, simplifies with the laws of logarithms, differentiates implicitly, and multiplies by $y$.** It is quickest for products, quotients and powers of many factors, and it is the only method for a function with a variable exponent. 1. Take $\ln$ of both sides and simplify: $\ln(ab)=\ln a+\ln b$, $\ln\frac ab=\ln a-\ln b$, $\ln a^n=n\ln a$. 2. Differentiate both sides with respect to $x$, which gives $\frac{y'}{y}$ on the left (see [implicit differentiation](https://nunada.my.id/articles/implicit-differentiation/#method)). 3. Solve for $y'$, and substitute $y$. **Example 7.** Find $y'$ for $y=\frac{x^2(x+1)^3}{x-2}$, with $x>2$. Take logarithms: $$\ln y=2\ln x+3\ln(x+1)-\ln(x-2).$$ Differentiate both sides: $$\frac{y'}{y}=\frac2x+\frac{3}{x+1}-\frac{1}{x-2}.$$ Multiply by $y$: $$y'=\frac{x^2(x+1)^3}{x-2}\left(\frac2x+\frac{3}{x+1}-\frac{1}{x-2}\right).$$ At $x=3$: $y=\frac{9\cdot64}{1}=576$ and the bracket is $\frac23+\frac34-1=\frac{5}{12}$, so $y'(3)=576\cdot\frac{5}{12}=240$. The product and quotient rules would reach the same number, with a longer road. **Example 8: a variable exponent.** For $y=x^x$ with $x>0$ neither the power rule (the exponent is not constant) nor the rule for $a^x$ (the base is not constant) applies. Take logarithms: $\ln y=x\ln x$. Differentiate with the product rule: $$\frac{y'}{y}=\ln x+x\cdot\frac1x=\ln x+1$$ $$y'=x^x(\ln x+1).$$ **Example 9.** For $y=x^{\sin x}$: $\ln y=\sin x\ln x$ and $\frac{y'}{y}=\cos x\ln x+\frac{\sin x}{x}$, so $$y'=x^{\sin x}\left(\cos x\ln x+\frac{\sin x}{x}\right).$$ **Negative values.** The logarithm needs positive numbers. If a factor of $y$ is negative, or $y$ itself is, write $\ln|y|$ instead: $\frac{d}{dx}\ln|y|=\frac{y'}{y}$ as well, so the same steps work. Type a function below: the tool applies the rules, shows logarithmic differentiation for a product, a quotient or a power, and checks the result with a difference quotient. ## Why does the power rule hold for irrational exponents? **For $x>0$ and any real number $n$, $\frac{d}{dx}x^n=nx^{n-1}$, because $x^n$ is defined as $e^{n\ln x}$.** Until now powers were defined by repeated multiplication and roots, which cannot raise a number to the power $\pi$ or $\sqrt2$. The exponential and the logarithm can: for $x>0$ and every real $n$, $x^n=e^{n\ln x}$, so $\ln x^n=n\ln x$ for all real $n$, the law of logarithms that was only proved for rational exponents. **Proof.** Differentiate $e^{n\ln x}$ with the chain rule: the outside is the exponential, which stays $e^{n\ln x}=x^n$, and the inside is $n\ln x$, with derivative $\frac nx$: $$\frac{d}{dx}x^n=x^n\cdot\frac nx=nx^{n-1}.$$ **Examples.** $\frac{d}{dx}x^\pi=\pi x^{\pi-1}$ and $\frac{d}{dx}x^{\sqrt2}=\sqrt2\,x^{\sqrt2-1}$. **Three different cases.** The look of an expression with an exponent tells which rule to reach for. | Form | What is constant | Rule | Derivative | |---|---|---|---| | $x^\pi$ | the exponent | power rule | $\pi x^{\pi-1}$ | | $\pi^x$ | the base | $a^x$ rule | $\pi^x\ln\pi$ | | $x^x$ | nothing | logarithmic differentiation | $x^x(\ln x+1)$ | The first two are single rules; the third is the case that needs the logarithm. A common error is to treat $x^x$ with the power rule, as $x\cdot x^{x-1}$, or with the exponential rule, as $x^x\ln x$: each gives only one of the two terms of $x^x\ln x+x^x$. ## How do you differentiate logarithms and inverses in code? **SymPy differentiates `sp.log` and general powers directly: `sp.diff(sp.log(x), x)` is `1/x` and `sp.diff(x**x, x)` is `x**x*(log(x) + 1)`.** In SymPy `log` is the natural logarithm, and `sp.log(x, 10)` is the base-10 one, `log(x)/log(10)`. Declaring `x` positive lets it simplify logarithms of powers. The second program checks the rule for inverses without a formula for $f^{-1}$: it finds $f^{-1}(6)$ for $f(x)=x^3-2$ by bisection, then compares $\frac{1}{f'(a)}$ with a difference quotient of the numerical inverse. Both give $\frac{1}{12}\approx0.083333$. ```python import sympy as sp x = sp.symbols('x', positive=True) for f in (sp.log(x), sp.log(2 * x), sp.log(x**2 + 3), sp.log(x, 10), 3**x, 3 ** sp.sin(x), x**x, x ** sp.sin(x), x**sp.pi): print(f, '->', sp.simplify(sp.diff(f, x))) # log(x) -> 1/x # log(2*x) -> 1/x # log(x**2 + 3) -> 2*x/(x**2 + 3) # log(x)/log(10) -> 1/(x*log(10)) # 3**x -> 3**x*log(3) # 3**sin(x) -> 3**sin(x)*log(3)*cos(x) # x**x -> x**x*(log(x) + 1) # x**sin(x) -> x**(sin(x) - 1)*(x*log(x)*cos(x) + sin(x)) # x**pi -> pi*x**(-1 + pi) y = x**2 * (x + 1) ** 3 / (x - 2) # Example 7 print(sp.diff(y, x).subs(x, 3), y.subs(x, 3), sp.diff(sp.log(y), x).subs(x, 3)) # 240 576 5/12 ``` ```python import math def inverse(f, b, lo, hi): """f is increasing on [lo, hi]: find f^-1(b) by bisection.""" for _ in range(200): mid = (lo + hi) / 2 if f(mid) < b: lo = mid else: hi = mid return (lo + hi) / 2 f = lambda t: t**3 - 2 df = lambda t: 3 * t**2 h = 1e-6 a = inverse(f, 6, 0, 3) print(round(a, 6), round(1 / df(a), 6)) # 2.0 0.083333 print(round((inverse(f, 6 + h, 0, 3) - inverse(f, 6 - h, 0, 3)) / (2 * h), 6)) # 0.083333 for h in (0.1, 0.01, 0.001, 0.0001, 0.000001): print(h, round((1 + h) ** (1 / h), 6), round(math.log(1 + h) / h, 6), round((2**h - 1) / h, 6)) # 0.1 2.593742 0.953102 0.717735 # 0.01 2.704814 0.995033 0.695555 # 0.001 2.716924 0.9995 0.693387 # 0.0001 2.718146 0.99995 0.693171 # 1e-06 2.71828 0.999999 0.693147 print(round(math.e, 6), round(math.log(2), 6)) # 2.718282 0.693147 ``` ```cpp #include #include #include using namespace std; double f(double t) { return t * t * t - 2; } // f is increasing on [lo, hi]: find f^-1(b) by bisection double inverse(double b, double lo, double hi) { for (int i = 0; i < 200; i++) { double mid = (lo + hi) / 2; if (f(mid) < b) lo = mid; else hi = mid; } return (lo + hi) / 2; } int main() { double h = 1e-6, a = inverse(6, 0, 3); printf("%.6f %.6f\n", a, 1 / (3 * a * a)); // f^-1(6) = 2 and 1 / f'(2) printf("%.6f\n", (inverse(6 + h, 0, 3) - inverse(6 - h, 0, 3)) / (2 * h)); // the slope of the inverse double hs[5] = {0.1, 0.01, 0.001, 0.0001, 0.000001}; for (int i = 0; i < 5; i++) { double x = hs[i]; printf("%.6f %.6f %.6f %.6f\n", x, pow(1 + x, 1 / x), log(1 + x) / x, (pow(2, x) - 1) / x); } printf("%.6f %.6f\n", exp(1.0), log(2.0)); // e and ln 2 return 0; } /* output: 2.000000 0.083333 0.083333 0.100000 2.593742 0.953102 0.717735 0.010000 2.704814 0.995033 0.695555 0.001000 2.716924 0.999500 0.693387 0.000100 2.718146 0.999950 0.693171 0.000001 2.718280 0.999999 0.693147 2.718282 0.693147 */ ``` ## Who invented logarithms, and when did e and the derivative of ln appear? **Logarithms came first as a way to multiply large numbers by adding, and the calculus of $\ln$ was found when the area under the hyperbola was recognized as a logarithm.** - **Napier and Briggs.** The Scottish mathematician John Napier published his table of logarithms in 1614, to turn the long multiplications of astronomy into additions. Henry Briggs, working with Napier, made tables of base-$10$ logarithms, published from 1617. - **The hyperbola.** In the 1640s Gregory of Saint-Vincent and his pupil de Sarasa showed that the area under $y=\frac1x$ grows by equal steps when $x$ grows by equal factors: the area is a logarithm. That is $\ln x=\int_1^x\frac{dt}{t}$, and it is why its derivative is $\frac1x$. - **Mercator.** Nicolaus Mercator named the natural logarithm and published its series $\ln(1+x)=x-\frac{x^2}{2}+\frac{x^3}{3}-\cdots$ in 1668. - **The number $e$.** In 1683 Jacob Bernoulli studied the limit of $\left(1+\frac1n\right)^n$ in a problem about compound interest. In the 1730s Leonhard Euler gave the number the letter $e$ and developed the exponential and the logarithm as inverses of each other. ## What mistakes do people make with inverses and logarithms? **The most common mistakes with derivatives of inverses and logarithms are the nine below, each with the correct statement.** | Mistake | Correct | |---|---| | ❌ $\frac{d}{dx}\ln2x=\frac{1}{2x}$ | The inside $2x$ has derivative $2$: $\frac{1}{2x}\cdot2=\frac1x$. | | ❌ $\frac{d}{dx}\ln\left(x^2+3\right)=\frac{1}{x^2+3}$ | Multiply by the derivative of the inside: $\frac{2x}{x^2+3}$. | | ❌ $\frac{d}{dx}\ln|x|=\frac{1}{|x|}$ | It is $\frac1x$ for every $x\ne0$, negative values included. | | ❌ $\frac{d}{dx}3^x=x\cdot3^{x-1}$ | The exponent contains $x$, so the power rule does not apply: $3^x\ln3$. | | ❌ $\frac{d}{dx}3^x=3^x$ | Only $e^x$ is its own derivative; $3^x$ has the factor $\ln3$. | | ❌ $\frac{d}{dx}x^x=x\cdot x^{x-1}$ | Both base and exponent vary: logarithmic differentiation gives $x^x(\ln x+1)$. | | ❌ $\frac{d}{dx}x^\pi=x^\pi\ln\pi$ | The exponent is constant, so the power rule applies: $\pi x^{\pi-1}$. | | ❌ $\left(f^{-1}\right)'(b)=\frac{1}{f'(b)}$ | The derivative of $f$ is taken at $a=f^{-1}(b)$, not at $b$: $\frac{1}{f'\left(f^{-1}(b)\right)}$. | | ❌ $f^{-1}(x)$ means $\frac{1}{f(x)}$, so its derivative is $-\frac{f'}{f^2}$ | $f^{-1}$ is the inverse function, which undoes $f$; it is not the reciprocal. | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: inverses and logarithms at a glance - **Inverses:** $\left(f^{-1}\right)'(b)=\frac{1}{f'\left(f^{-1}(b)\right)}$ when $f'\ne0$; slopes at mirror points are reciprocals. - **Natural logarithm:** $\frac{d}{dx}\ln x=\frac1x$, $\frac{d}{dx}\ln u=\frac{u'}{u}$, $\frac{d}{dx}\ln|x|=\frac1x$. - **Other bases:** $\frac{d}{dx}a^u=a^u\ln a\cdot u'$ and $\frac{d}{dx}\log_au=\frac{u'}{u\ln a}$; $\ln e=1$ makes $e$ the natural base. - **The number $e$:** $\lim(1+h)^{1/h}=e$ and $\lim\frac{a^h-1}{h}=\ln a$. - **Logarithmic differentiation:** $\ln y$, split, differentiate, multiply by $y$; $\frac{d}{dx}x^x=x^x(\ln x+1)$. - **Power rule:** $\frac{d}{dx}x^n=nx^{n-1}$ for every real $n$ because $x^n=e^{n\ln x}$; $x^\pi$, $\pi^x$ and $x^x$ are three cases. - **Code:** `sp.diff(sp.log(x), x)`; check an inverse with bisection and a difference quotient. ## Glossary: key terms - **Inverse function**: A function that undoes another, so that applying one after the other returns the starting number; its graph is the mirror image of the first in the line y equals x. - **Natural logarithm**: The logarithm to the base e, written ln x, the inverse of the exponential function e to the x, whose derivative is 1 over x. - **Logarithmic differentiation**: Finding a derivative by taking the logarithm of both sides, simplifying with the laws of logarithms, differentiating implicitly, and multiplying by the original function. - **Euler’s number e**: The number about 2.71828 that is the limit of one plus h to the power one over h as h tends to zero, and the base for which the slope of the exponential at the y-axis is exactly 1. - **Change-of-base formula**: The identity that log base a of x equals ln x divided by ln a, which reduces every logarithm to the natural one. - **General power function**: The function x to the power n for any real n, defined for positive x as e to the power n ln x, so that irrational exponents make sense. ## Frequently asked questions ### What is the derivative of ln x? The derivative of the natural logarithm of x is one over x, for x greater than zero. It follows from the rule for inverses applied to the exponential function. With a function u inside, the derivative of ln u is the derivative of u divided by u. ### What is the derivative of an inverse function? The derivative of the inverse at b is one divided by the derivative of the original function at a, where a is the number that f sends to b. The slopes of a function and its inverse are reciprocals at points that mirror each other in the line y equals x. ### What is the derivative of a to the x? It is a to the x times the natural logarithm of a, for a greater than zero. It comes from writing a to the x as e to the x ln a and using the chain rule. For a equal to e the factor ln a is one, so e to the x is its own derivative. ### What is the derivative of log base a of x? It is one divided by x times ln a. Write the logarithm to base a as ln x divided by ln a, and the constant ln a stays in the denominator while ln x is differentiated. For base 10 the derivative is one over x times ln 10. ### What is logarithmic differentiation? It is a method that takes the natural logarithm of both sides of y equals f of x, simplifies with the laws of logarithms, differentiates implicitly, and multiplies by y. It is quickest for long products, quotients and powers, and needed for variable exponents. ### What is the derivative of x to the x? It is x to the x times the quantity ln x plus 1. Take the logarithm to get ln y equal to x ln x, differentiate to get y prime over y equal to ln x plus 1, and multiply by y. The power rule alone or the exponential rule alone gives only half of it. ### What is the derivative of ln of the absolute value of x? It is one over x for every x not equal to zero, positive or negative. This is why one over x has an antiderivative on the whole line except zero: ln of the absolute value of x. The chain rule with the derivative of the absolute value gives it. ### Why is e the natural base for derivatives? Because the derivative of a to the x carries the constant ln a, and only for a equal to e is that constant one. Then the exponential function equals its own derivative, and the logarithm to base e has the simplest derivative, one over x. ### How is e defined as a limit? The number e is the limit of one plus h, all to the power one over h, as h tends to zero. Its logarithm is ln of one plus h over h, the difference quotient of the natural logarithm at one, which tends to the derivative one over one, which is one. --- # Turunan Fungsi Invers dan Logaritma Source: https://nunada.my.id/artikel/turunan-fungsi-invers-dan-logaritma/ Updated: 2026-10-17 ## Jawaban singkat **Turunan fungsi invers di suatu titik adalah kebalikan turunan fungsi itu di titik yang bersesuaian: $\left(f^{-1}\right)'(b)=\frac{1}{f'\left(f^{-1}(b)\right)}$, dan ini memberi $\frac{d}{dx}\ln x=\frac1x$.** Dengan aturan rantai, $\frac{d}{dx}\ln u=\frac{u'}{u}$. Eksponensial dengan basis lain mengikuti: $\frac{d}{dx}a^x=a^x\ln a$ dan $\frac{d}{dx}\log_a x=\frac{1}{x\ln a}$. Bila suatu fungsi berupa hasil kali, hasil bagi, atau berpangkat peubah, mengambil $\ln$ lebih dulu, yaitu diferensiasi logaritmik, adalah cara cepatnya. ### Poin penting - Jika $f$ terdiferensialkan dengan $f'\ne0$ pada suatu selang, maka $f^{-1}$ terdiferensialkan dan $\left(f^{-1}\right)'(b)=\frac{1}{f'(a)}$ dengan $a=f^{-1}(b)$: kedua gradien saling berkebalikan di titik yang bersesuaian, seperti garis dan bayangan cerminnya dalam $y=x$. - Diterapkan pada $e^x$ aturan itu memberi $\frac{d}{dx}\ln x=\frac1x$ untuk $x>0$; dengan aturan rantai $\frac{d}{dx}\ln u=\frac{u'}{u}$, dan $\frac{d}{dx}\ln|x|=\frac1x$ untuk setiap $x\ne0$. - $\frac{d}{dx}a^x=a^x\ln a$ dan $\frac{d}{dx}\log_a x=\frac{1}{x\ln a}$; hanya untuk $a=e$ nilai $\ln a=1$, itulah sebabnya $e$ adalah basis yang disukai kalkulus. - Bilangan $e$ adalah limit $(1+h)^{1/h}$ saat $h\to0$, karena logaritma ekspresi itu adalah hasil bagi selisih $\frac{\ln(1+h)}{h}$ dari $\ln$ di $1$, yang menuju $\frac11=1$. - Diferensiasi logaritmik: ambil $\ln$ dari $y$, pecah dengan hukum logaritma, turunkan, dan kalikan dengan $y$; untuk $y=x^x$ ia memberi $y'=x^x(\ln x+1)$. - Dengan $x^n=e^{n\ln x}$ aturan pangkat $\frac{d}{dx}x^n=nx^{n-1}$ berlaku untuk setiap $n$ real, termasuk yang irasional; $x^\pi$, $\pi^x$, dan $x^x$ adalah tiga kasus yang berbeda. ## Berapa turunan suatu fungsi invers? **Jika $f$ berdomain selang dan $f'$ ada dan tidak pernah nol di sana, maka $f^{-1}$ terdiferensialkan di setiap titik domainnya dan $\left(f^{-1}\right)'(b)=\frac{1}{f'\left(f^{-1}(b)\right)}$.** Dengan kata-kata: gradien $f^{-1}$ di $x=b$ adalah kebalikan gradien $f$ di $x=f^{-1}(b)$. Invers $f$ membatalkannya, sehingga grafiknya adalah bayangan cermin grafik $f$ dalam garis $y=x$, dan cermin mengubah gradien $m$ menjadi $\frac1m$. **Garis lebih dulu.** Fungsi $f(x)=\frac12x+1$ memiliki invers $f^{-1}(x)=2x-2$. Turunannya $\frac12$ dan $2$, saling berkebalikan. Mencerminkan garis apa pun yang tidak mendatar dan tidak tegak dalam $y=x$ membalik gradiennya. **Fungsi lain: bandingkan di titik yang bersesuaian.** Jika gradien $y=f(x)$ di titik $(a,b)$ adalah $f'(a)$, dengan $b=f(a)$, maka gradien $y=f^{-1}(x)$ di titik cermin $(b,a)$ adalah $\frac{1}{f'(a)}$. Turunan $f$ dibaca di $a$ dan turunan $f^{-1}$ di $b=f(a)$. Jika $f$ memiliki garis singgung mendatar di $(a,b)$, inversnya memiliki garis singgung tegak di $(b,a)$ dan tidak berturunan di sana, itulah sebabnya $f'\ne0$ adalah bagian dari syaratnya. **Mengapa rumus itu berlaku.** Mulai dari $f\left(f^{-1}(x)\right)=x$ dan turunkan kedua ruas, dengan [aturan rantai](https://nunada.my.id/artikel/aturan-rantai/#chain-rule) di ruas kiri: $$f'\left(f^{-1}(x)\right)\cdot\left(f^{-1}\right)'(x)=1.$$ Selesaikan untuk $\left(f^{-1}\right)'(x)$ dan aturannya muncul. Buktinya mengasumsikan bahwa $f^{-1}$ terdiferensialkan; bahwa ia memang demikian, bila $f'\ne0$, adalah separuh pertama teorema, yang di artikel ini diterima begitu saja. **Contoh 1.** Fungsi $f(x)=x^2$ untuk $x>0$ memiliki invers $f^{-1}(x)=\sqrt x$. Aturan itu menyatakan $\left(f^{-1}\right)'(x)=\frac{1}{f'\left(\sqrt x\right)}=\frac{1}{2\sqrt x}$, turunan akar kuadrat yang sudah dikenal. Di $a=2$ dan $b=f(2)=4$: $f'(2)=4$ dan $\left(f^{-1}\right)'(4)=\frac14$. **Contoh 2.** Misalkan $f(x)=x^3-2$ untuk $x>0$. Tentukan $\left(f^{-1}\right)'(6)$ tanpa rumus untuk $f^{-1}$. Pertama cari $a$ dengan $f(a)=6$: $a^3-2=6$, sehingga $a=2$. Lalu $f'(2)=3\cdot2^2=12$, dan $$\left(f^{-1}\right)'(6)=\frac{1}{f'(2)}=\frac{1}{12}.$$ Di sini persamaan $f(a)=6$ yang melakukan pekerjaan rumus yang tidak ada. Pilih fungsi di bawah dan geser $a$: grafik bayangan cermin dan kedua garis singgungnya digambar, dan gradien invers diperiksa dengan invers numerik. ## Berapa turunan ln x? **Turunan logaritma natural adalah $\frac{d}{dx}\ln x=\frac1x$ untuk $x>0$, dan dengan [aturan rantai](https://nunada.my.id/artikel/aturan-rantai/#outside-inside), $\frac{d}{dx}\ln u=\frac{1}{u}\cdot\frac{du}{dx}$ untuk $u(x)$ positif yang terdiferensialkan.** Fungsi $\ln x$ adalah invers $e^x$, yang turunannya $e^x$ sendiri. Dengan aturan untuk invers, dengan $f(x)=e^x$ dan $f^{-1}(x)=\ln x$: $$\left(f^{-1}\right)'(x)=\frac{1}{f'\left(\ln x\right)}=\frac{1}{e^{\ln x}}=\frac1x.$$ **Penurunan kedua, dengan diferensiasi implisit.** Misalkan $y=\ln x$, sehingga $e^y=x$. Turunkan kedua ruas terhadap $x$, dengan aturan rantai pada $e^y$: $$e^y\,\frac{dy}{dx}=1,\qquad\frac{dy}{dx}=\frac{1}{e^y}=\frac1x.$$ Ini adalah [diferensiasi implisit](https://nunada.my.id/artikel/diferensiasi-implisit/#method) pada persamaan yang tidak dapat diselesaikan untuk $y$ tanpa fungsi yang sedang diturunkan itu sendiri. **Contoh 3.** Empat turunan dengan $\ln$. - $\frac{d}{dx}\ln2x=\frac{1}{2x}\cdot2=\frac1x$. Konstantanya hilang: $\ln2x=\ln2+\ln x$. - $\frac{d}{dx}\ln\left(x^2+3\right)=\frac{1}{x^2+3}\cdot2x=\frac{2x}{x^2+3}$. - $\frac{d}{dx}\ln^3x=3\ln^2x\cdot\frac1x=\frac{3\ln^2x}{x}$, karena fungsi luarnya pangkat tiga dan fungsi dalamnya $\ln x$. - $\frac{d}{dx}\ln|x|=\frac{1}{|x|}\cdot\frac{x}{|x|}=\frac1x$ untuk $x\ne0$, dengan $\frac{d}{dx}|x|=\frac{x}{|x|}$. Jadi $\frac1x$ adalah turunan $\ln x$ pada $x>0$ dan $\ln(-x)$ pada $x<0$. **Logaritma hasil kali dan pangkat lebih dulu.** Hukum logaritma membuat banyak turunan lebih pendek. Misalnya $\ln\sqrt{x^2+1}=\frac12\ln\left(x^2+1\right)$ berturunan $\frac12\cdot\frac{2x}{x^2+1}=\frac{x}{x^2+1}$, tanpa turunan akar kuadrat sama sekali. **Contoh 4.** Garis bergradien $m$ yang melalui titik asal menyinggung grafik $y=\ln x$. Berapa $m$? Misalkan titik singgungnya $(a,\ln a)$. Gradien di sana $\frac1a$, dan garis yang melalui titik asal dan $(a,\ln a)$ bergradien $\frac{\ln a}{a}$. Menyamakannya, $$\frac1a=\frac{\ln a}{a},\qquad\ln a=1,\qquad a=e,\qquad m=\frac1e.$$ Garis singgungnya $y=\frac{x}{e}$, dan ia menyentuh grafik di $(e,1)$. Kurva $\ln x$ naik makin pelan, dan gradien $\frac1x$ turun dari nilai besar di dekat $0$ ke nilai kecil. *y = ln x (hijau), gradiennya 1/x (jingga), dan garis singgung y = x/e melalui titik asal (biru), yang menyentuh di (e, 1).* ## Berapa turunan a^x dan logaritma basis a, dan dari mana e berasal? **Untuk $a>0$, $\frac{d}{dx}a^x=a^x\ln a$, dan untuk $a>0$ dengan $a\ne1$, $\frac{d}{dx}\log_ax=\frac{1}{x\ln a}$.** Keduanya mengikuti dari logaritma natural. Menurut definisi $a^x=e^{x\ln a}$, sehingga dengan [aturan rantai](https://nunada.my.id/artikel/aturan-rantai/#outside-inside) turunan eksponensial $e^{u}$ dengan $u=x\ln a$ adalah $e^{x\ln a}\cdot\ln a=a^x\ln a$. Dengan fungsi $u(x)$ di pangkat, $$\frac{d}{dx}a^u=a^u\ln a\cdot\frac{du}{dx}.$$ Untuk logaritma, rumus perubahan basis $\log_ax=\frac{\ln x}{\ln a}$ menunjukkan konstanta $\frac{1}{\ln a}$ di depan $\ln x$, sehingga $$\frac{d}{dx}\log_au=\frac{1}{u\ln a}\cdot\frac{du}{dx}.$$ **Contoh 5.** Turunan eksponensial umum. - $\frac{d}{dx}3^x=3^x\ln3$. - $\frac{d}{dx}3^{-x}=3^{-x}\ln3\cdot(-1)=-3^{-x}\ln3$. - $\frac{d}{dx}3^{\sin x}=3^{\sin x}\ln3\cdot\cos x$. - $\frac{d}{dx}\sin\left(3^x\right)=\cos\left(3^x\right)\cdot3^x\ln3$, dengan dua lapisan, sinus dan eksponensial. **Contoh 6.** Turunan logaritma berbasis lain: $\frac{d}{dx}\log_{10}x=\frac{1}{x\ln10}$, dan $\frac{d}{dx}\log_2\left(x^2+1\right)=\frac{2x}{\left(x^2+1\right)\ln2}$. **Mengapa $e$ basis yang disukai.** Jika $a=e$ maka $\ln a=1$ dan faktornya hilang: $\frac{d}{dx}e^x=e^x$, dan $\frac{d}{dx}\log_ex=\frac1x$. Untuk basis lain, konstanta $\ln a$ mengikuti setiap turunan. Gradien $a^x$ di tempat grafiknya memotong sumbu-$y$ adalah $a^0\ln a=\ln a$, dan menurut definisi turunan ia adalah limit $$\lim_{h\to0}\frac{a^h-1}{h}=\ln a.$$ Untuk $a=e$ limit itu $1$: $e$ adalah basis yang kurva $a^x$-nya meninggalkan sumbu-$y$ dengan gradien tepat $1$. **Bilangan $e$ sebagai limit.** Turunan $\ln$ di $1$ adalah $\frac11=1$, dan menurut definisi turunan ia adalah $\lim_{h\to0}\frac{\ln(1+h)-\ln1}{h}=\lim_{h\to0}\frac{\ln(1+h)}{h}$. Jadi $\frac{\ln(1+h)}{h}\to1$. Karena $\frac{\ln(1+h)}{h}=\ln\left((1+h)^{1/h}\right)$ dan $e^x$ kontinu, $$\lim_{h\to0}(1+h)^{1/h}=e^1=e.$$ Inilah limit di balik bunga majemuk. Dengan $h=\frac1n$ ia berbunyi $\left(1+\frac1n\right)^n\to e$: uang yang berbunga $12$ kali setahun tumbuh dengan faktor $\left(1+\frac{1}{12}\right)^{12}\approx2{,}613$ dalam setahun pada suku bunga nominal $100\%$, $365$ kali setahun dengan $2{,}7146$, dan terus-menerus dengan $e\approx2{,}71828$. **Catatan yang jujur.** Penurunan di atas mengasumsikan bahwa limit $\frac{a^h-1}{h}$ ada. Memang ada, dan bab kemudian dalam buku mendefinisikan $\ln$ dan $e^x$ dengan cara yang membuktikannya; di sini ia diterima sebagai diketahui. Kecilkan $h$ di bawah dan lihat ketiga limit itu menetap. ## Apa itu diferensiasi logaritmik, dan kapan ia membantu? **Diferensiasi logaritmik mengambil logaritma natural kedua ruas $y=f(x)$, menyederhanakan dengan hukum logaritma, menurunkan secara implisit, dan mengalikan dengan $y$.** Ia paling cepat untuk hasil kali, hasil bagi, dan pangkat dari banyak faktor, dan ia satu-satunya cara untuk fungsi dengan pangkat peubah. 1. Ambil $\ln$ kedua ruas dan sederhanakan: $\ln(ab)=\ln a+\ln b$, $\ln\frac ab=\ln a-\ln b$, $\ln a^n=n\ln a$. 2. Turunkan kedua ruas terhadap $x$, yang memberi $\frac{y'}{y}$ di ruas kiri (lihat [diferensiasi implisit](https://nunada.my.id/artikel/diferensiasi-implisit/#method)). 3. Selesaikan untuk $y'$, dan substitusikan $y$. **Contoh 7.** Tentukan $y'$ untuk $y=\frac{x^2(x+1)^3}{x-2}$, dengan $x>2$. Ambil logaritma: $$\ln y=2\ln x+3\ln(x+1)-\ln(x-2).$$ Turunkan kedua ruas: $$\frac{y'}{y}=\frac2x+\frac{3}{x+1}-\frac{1}{x-2}.$$ Kalikan dengan $y$: $$y'=\frac{x^2(x+1)^3}{x-2}\left(\frac2x+\frac{3}{x+1}-\frac{1}{x-2}\right).$$ Di $x=3$: $y=\frac{9\cdot64}{1}=576$ dan kurungnya $\frac23+\frac34-1=\frac{5}{12}$, sehingga $y'(3)=576\cdot\frac{5}{12}=240$. Aturan hasil kali dan hasil bagi akan mencapai bilangan yang sama, dengan jalan yang lebih panjang. **Contoh 8: pangkat peubah.** Untuk $y=x^x$ dengan $x>0$ baik aturan pangkat (pangkatnya tidak konstan) maupun aturan untuk $a^x$ (basisnya tidak konstan) tidak berlaku. Ambil logaritma: $\ln y=x\ln x$. Turunkan dengan aturan hasil kali: $$\frac{y'}{y}=\ln x+x\cdot\frac1x=\ln x+1$$ $$y'=x^x(\ln x+1).$$ **Contoh 9.** Untuk $y=x^{\sin x}$: $\ln y=\sin x\ln x$ dan $\frac{y'}{y}=\cos x\ln x+\frac{\sin x}{x}$, sehingga $$y'=x^{\sin x}\left(\cos x\ln x+\frac{\sin x}{x}\right).$$ **Nilai negatif.** Logaritma memerlukan bilangan positif. Jika suatu faktor $y$ negatif, atau $y$ sendiri, tulis $\ln|y|$: $\frac{d}{dx}\ln|y|=\frac{y'}{y}$ juga, sehingga langkah yang sama berlaku. Ketik fungsi di bawah: alat itu menerapkan aturan, menampilkan diferensiasi logaritmik untuk hasil kali, hasil bagi, atau pangkat, dan memeriksa hasilnya dengan hasil bagi selisih. ## Mengapa aturan pangkat berlaku untuk pangkat irasional? **Untuk $x>0$ dan bilangan real $n$ mana pun, $\frac{d}{dx}x^n=nx^{n-1}$, karena $x^n$ didefinisikan sebagai $e^{n\ln x}$.** Sampai sekarang pangkat didefinisikan dengan perkalian berulang dan akar, yang tidak dapat memangkatkan bilangan ke $\pi$ atau $\sqrt2$. Eksponensial dan logaritma dapat: untuk $x>0$ dan setiap $n$ real, $x^n=e^{n\ln x}$, sehingga $\ln x^n=n\ln x$ untuk semua $n$ real, hukum logaritma yang tadinya hanya dibuktikan untuk pangkat rasional. **Bukti.** Turunkan $e^{n\ln x}$ dengan aturan rantai: fungsi luarnya eksponensial, yang tetap $e^{n\ln x}=x^n$, dan fungsi dalamnya $n\ln x$, berturunan $\frac nx$: $$\frac{d}{dx}x^n=x^n\cdot\frac nx=nx^{n-1}.$$ **Contoh.** $\frac{d}{dx}x^\pi=\pi x^{\pi-1}$ dan $\frac{d}{dx}x^{\sqrt2}=\sqrt2\,x^{\sqrt2-1}$. **Tiga kasus yang berbeda.** Tampilan ekspresi berpangkat menunjukkan aturan mana yang dipakai. | Bentuk | Yang konstan | Aturan | Turunan | |---|---|---|---| | $x^\pi$ | pangkatnya | aturan pangkat | $\pi x^{\pi-1}$ | | $\pi^x$ | basisnya | aturan $a^x$ | $\pi^x\ln\pi$ | | $x^x$ | tidak ada | diferensiasi logaritmik | $x^x(\ln x+1)$ | Dua yang pertama adalah aturan tunggal; yang ketiga adalah kasus yang memerlukan logaritma. Kekeliruan yang umum adalah memperlakukan $x^x$ dengan aturan pangkat, sebagai $x\cdot x^{x-1}$, atau dengan aturan eksponensial, sebagai $x^x\ln x$: masing-masing hanya memberi satu dari dua suku $x^x\ln x+x^x$. ## Bagaimana menurunkan logaritma dan invers dalam kode? **SymPy menurunkan `sp.log` dan pangkat umum secara langsung: `sp.diff(sp.log(x), x)` adalah `1/x` dan `sp.diff(x**x, x)` adalah `x**x*(log(x) + 1)`.** Di SymPy `log` adalah logaritma natural, dan `sp.log(x, 10)` adalah yang berbasis 10, `log(x)/log(10)`. Menyatakan `x` positif memungkinkannya menyederhanakan logaritma dari pangkat. Program kedua memeriksa aturan untuk invers tanpa rumus untuk $f^{-1}$: ia mencari $f^{-1}(6)$ untuk $f(x)=x^3-2$ dengan bagi dua, lalu membandingkan $\frac{1}{f'(a)}$ dengan hasil bagi selisih dari invers numerik. Keduanya memberi $\frac{1}{12}\approx0{,}083333$. ```python import sympy as sp x = sp.symbols('x', positive=True) for f in (sp.log(x), sp.log(2 * x), sp.log(x**2 + 3), sp.log(x, 10), 3**x, 3 ** sp.sin(x), x**x, x ** sp.sin(x), x**sp.pi): print(f, '->', sp.simplify(sp.diff(f, x))) # log(x) -> 1/x # log(2*x) -> 1/x # log(x**2 + 3) -> 2*x/(x**2 + 3) # log(x)/log(10) -> 1/(x*log(10)) # 3**x -> 3**x*log(3) # 3**sin(x) -> 3**sin(x)*log(3)*cos(x) # x**x -> x**x*(log(x) + 1) # x**sin(x) -> x**(sin(x) - 1)*(x*log(x)*cos(x) + sin(x)) # x**pi -> pi*x**(-1 + pi) y = x**2 * (x + 1) ** 3 / (x - 2) # Example 7 print(sp.diff(y, x).subs(x, 3), y.subs(x, 3), sp.diff(sp.log(y), x).subs(x, 3)) # 240 576 5/12 ``` ```python import math def inverse(f, b, lo, hi): """f is increasing on [lo, hi]: find f^-1(b) by bisection.""" for _ in range(200): mid = (lo + hi) / 2 if f(mid) < b: lo = mid else: hi = mid return (lo + hi) / 2 f = lambda t: t**3 - 2 df = lambda t: 3 * t**2 h = 1e-6 a = inverse(f, 6, 0, 3) print(round(a, 6), round(1 / df(a), 6)) # 2.0 0.083333 print(round((inverse(f, 6 + h, 0, 3) - inverse(f, 6 - h, 0, 3)) / (2 * h), 6)) # 0.083333 for h in (0.1, 0.01, 0.001, 0.0001, 0.000001): print(h, round((1 + h) ** (1 / h), 6), round(math.log(1 + h) / h, 6), round((2**h - 1) / h, 6)) # 0.1 2.593742 0.953102 0.717735 # 0.01 2.704814 0.995033 0.695555 # 0.001 2.716924 0.9995 0.693387 # 0.0001 2.718146 0.99995 0.693171 # 1e-06 2.71828 0.999999 0.693147 print(round(math.e, 6), round(math.log(2), 6)) # 2.718282 0.693147 ``` ```cpp #include #include #include using namespace std; double f(double t) { return t * t * t - 2; } // f is increasing on [lo, hi]: find f^-1(b) by bisection double inverse(double b, double lo, double hi) { for (int i = 0; i < 200; i++) { double mid = (lo + hi) / 2; if (f(mid) < b) lo = mid; else hi = mid; } return (lo + hi) / 2; } int main() { double h = 1e-6, a = inverse(6, 0, 3); printf("%.6f %.6f\n", a, 1 / (3 * a * a)); // f^-1(6) = 2 and 1 / f'(2) printf("%.6f\n", (inverse(6 + h, 0, 3) - inverse(6 - h, 0, 3)) / (2 * h)); // the slope of the inverse double hs[5] = {0.1, 0.01, 0.001, 0.0001, 0.000001}; for (int i = 0; i < 5; i++) { double x = hs[i]; printf("%.6f %.6f %.6f %.6f\n", x, pow(1 + x, 1 / x), log(1 + x) / x, (pow(2, x) - 1) / x); } printf("%.6f %.6f\n", exp(1.0), log(2.0)); // e and ln 2 return 0; } /* output: 2.000000 0.083333 0.083333 0.100000 2.593742 0.953102 0.717735 0.010000 2.704814 0.995033 0.695555 0.001000 2.716924 0.999500 0.693387 0.000100 2.718146 0.999950 0.693171 0.000001 2.718280 0.999999 0.693147 2.718282 0.693147 */ ``` ## Siapa yang menemukan logaritma, dan kapan e dan turunan ln muncul? **Logaritma mula-mula adalah cara mengalikan bilangan besar dengan menjumlahkan, dan kalkulus $\ln$ ditemukan ketika luas di bawah hiperbola dikenali sebagai logaritma.** - **Napier dan Briggs.** Matematikawan Skotlandia John Napier menerbitkan tabel logaritmanya pada 1614, untuk mengubah perkalian panjang dalam astronomi menjadi penjumlahan. Henry Briggs, yang bekerja dengan Napier, membuat tabel logaritma basis $10$, diterbitkan sejak 1617. - **Hiperbola.** Pada 1640-an Gregory dari Saint-Vincent dan muridnya de Sarasa menunjukkan bahwa luas di bawah $y=\frac1x$ bertambah dengan langkah sama ketika $x$ bertambah dengan faktor sama: luas itu adalah logaritma. Itulah $\ln x=\int_1^x\frac{dt}{t}$, dan itulah sebabnya turunannya $\frac1x$. - **Mercator.** Nicolaus Mercator menamai logaritma natural dan menerbitkan deretnya $\ln(1+x)=x-\frac{x^2}{2}+\frac{x^3}{3}-\cdots$ pada 1668. - **Bilangan $e$.** Pada 1683 Jacob Bernoulli mempelajari limit $\left(1+\frac1n\right)^n$ dalam soal bunga majemuk. Pada 1730-an Leonhard Euler memberi bilangan itu huruf $e$ dan mengembangkan eksponensial dan logaritma sebagai invers satu sama lain. ## Kesalahan apa yang sering terjadi pada invers dan logaritma? **Kesalahan paling umum pada turunan invers dan logaritma adalah sembilan hal berikut, masing-masing dengan pernyataan yang benar.** | Kesalahan | Yang benar | |---|---| | ❌ $\frac{d}{dx}\ln2x=\frac{1}{2x}$ | Fungsi dalam $2x$ berturunan $2$: $\frac{1}{2x}\cdot2=\frac1x$. | | ❌ $\frac{d}{dx}\ln\left(x^2+3\right)=\frac{1}{x^2+3}$ | Kalikan dengan turunan fungsi dalam: $\frac{2x}{x^2+3}$. | | ❌ $\frac{d}{dx}\ln|x|=\frac{1}{|x|}$ | Ia $\frac1x$ untuk setiap $x\ne0$, termasuk nilai negatif. | | ❌ $\frac{d}{dx}3^x=x\cdot3^{x-1}$ | Pangkatnya memuat $x$, sehingga aturan pangkat tidak berlaku: $3^x\ln3$. | | ❌ $\frac{d}{dx}3^x=3^x$ | Hanya $e^x$ yang turunannya dirinya sendiri; $3^x$ memiliki faktor $\ln3$. | | ❌ $\frac{d}{dx}x^x=x\cdot x^{x-1}$ | Basis dan pangkat sama-sama berubah: diferensiasi logaritmik memberi $x^x(\ln x+1)$. | | ❌ $\frac{d}{dx}x^\pi=x^\pi\ln\pi$ | Pangkatnya konstan, sehingga aturan pangkat berlaku: $\pi x^{\pi-1}$. | | ❌ $\left(f^{-1}\right)'(b)=\frac{1}{f'(b)}$ | Turunan $f$ diambil di $a=f^{-1}(b)$, bukan di $b$: $\frac{1}{f'\left(f^{-1}(b)\right)}$. | | ❌ $f^{-1}(x)$ berarti $\frac{1}{f(x)}$, sehingga turunannya $-\frac{f'}{f^2}$ | $f^{-1}$ adalah fungsi invers, yang membatalkan $f$; ia bukan kebalikan. | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: invers dan logaritma sekilas - **Invers:** $\left(f^{-1}\right)'(b)=\frac{1}{f'\left(f^{-1}(b)\right)}$ bila $f'\ne0$; gradien di titik cermin saling berkebalikan. - **Logaritma natural:** $\frac{d}{dx}\ln x=\frac1x$, $\frac{d}{dx}\ln u=\frac{u'}{u}$, $\frac{d}{dx}\ln|x|=\frac1x$. - **Basis lain:** $\frac{d}{dx}a^u=a^u\ln a\cdot u'$ dan $\frac{d}{dx}\log_au=\frac{u'}{u\ln a}$; $\ln e=1$ menjadikan $e$ basis natural. - **Bilangan $e$:** $\lim(1+h)^{1/h}=e$ dan $\lim\frac{a^h-1}{h}=\ln a$. - **Diferensiasi logaritmik:** $\ln y$, pecah, turunkan, kalikan dengan $y$; $\frac{d}{dx}x^x=x^x(\ln x+1)$. - **Aturan pangkat:** $\frac{d}{dx}x^n=nx^{n-1}$ untuk setiap $n$ real karena $x^n=e^{n\ln x}$; $x^\pi$, $\pi^x$, dan $x^x$ adalah tiga kasus. - **Kode:** `sp.diff(sp.log(x), x)`; periksa invers dengan bagi dua dan hasil bagi selisih. ## Glosarium: istilah penting - **Fungsi invers**: Fungsi yang membatalkan fungsi lain, sehingga menerapkan satu setelah yang lain mengembalikan bilangan awal; grafiknya adalah bayangan cermin grafik pertama dalam garis y sama dengan x. - **Logaritma natural**: Logaritma berbasis e, ditulis ln x, invers fungsi eksponensial e pangkat x, yang turunannya 1 per x. - **Diferensiasi logaritmik**: Mencari turunan dengan mengambil logaritma kedua ruas, menyederhanakan dengan hukum logaritma, menurunkan secara implisit, dan mengalikan dengan fungsi semula. - **Bilangan Euler e**: Bilangan sekitar 2,71828 yang merupakan limit satu ditambah h pangkat satu per h saat h menuju nol, dan basis yang gradien eksponensialnya di sumbu-y tepat 1. - **Rumus perubahan basis**: Kesamaan bahwa logaritma basis a dari x sama dengan ln x dibagi ln a, yang mengubah setiap logaritma menjadi logaritma natural. - **Fungsi pangkat umum**: Fungsi x pangkat n untuk n real mana pun, didefinisikan untuk x positif sebagai e pangkat n ln x, sehingga pangkat irasional bermakna. ## Pertanyaan yang sering diajukan ### Berapa turunan ln x? Turunan logaritma natural dari x adalah satu per x, untuk x lebih besar dari nol. Ia mengikuti dari aturan untuk invers yang diterapkan pada fungsi eksponensial. Dengan fungsi u di dalam, turunan ln u adalah turunan u dibagi u. ### Berapa turunan suatu fungsi invers? Turunan invers di b adalah satu dibagi turunan fungsi semula di a, dengan a adalah bilangan yang oleh f dikirim ke b. Gradien suatu fungsi dan inversnya saling berkebalikan di titik-titik yang saling mencerminkan dalam garis y sama dengan x. ### Berapa turunan a pangkat x? Turunannya adalah a pangkat x kali logaritma natural a, untuk a lebih besar dari nol. Ia berasal dari menulis a pangkat x sebagai e pangkat x ln a dan memakai aturan rantai. Untuk a sama dengan e faktor ln a adalah satu, sehingga e pangkat x turunannya sendiri. ### Berapa turunan logaritma basis a dari x? Turunannya adalah satu dibagi x kali ln a. Tulis logaritma basis a sebagai ln x dibagi ln a, dan konstanta ln a tetap di penyebut sementara ln x diturunkan. Untuk basis 10 turunannya satu per x kali ln 10. ### Apa itu diferensiasi logaritmik? Ia adalah cara yang mengambil logaritma natural kedua ruas y sama dengan f dari x, menyederhanakan dengan hukum logaritma, menurunkan secara implisit, dan mengalikan dengan y. Ia paling cepat untuk hasil kali, hasil bagi, dan pangkat yang panjang, dan diperlukan untuk pangkat peubah. ### Berapa turunan x pangkat x? Turunannya adalah x pangkat x kali bilangan ln x ditambah 1. Ambil logaritma untuk mendapat ln y sama dengan x ln x, turunkan untuk mendapat y aksen per y sama dengan ln x ditambah 1, dan kalikan dengan y. Aturan pangkat saja atau aturan eksponensial saja hanya memberi separuhnya. ### Berapa turunan ln nilai mutlak x? Turunannya satu per x untuk setiap x tidak sama dengan nol, positif atau negatif. Itulah sebabnya satu per x memiliki antiturunan pada seluruh garis kecuali nol: ln nilai mutlak x. Aturan rantai dengan turunan nilai mutlak memberikannya. ### Mengapa e basis natural untuk turunan? Karena turunan a pangkat x membawa konstanta ln a, dan hanya untuk a sama dengan e konstanta itu satu. Lalu fungsi eksponensial sama dengan turunannya sendiri, dan logaritma basis e memiliki turunan paling sederhana, satu per x. ### Bagaimana e didefinisikan sebagai limit? Bilangan e adalah limit satu ditambah h, semuanya dipangkatkan satu per h, saat h menuju nol. Logaritmanya adalah ln satu ditambah h per h, hasil bagi selisih logaritma natural di satu, yang menuju turunan satu per satu, yaitu satu. --- # Implicit Differentiation Source: https://nunada.my.id/articles/implicit-differentiation/ Updated: 2026-10-16 ## Quick answer **Implicit differentiation finds $\frac{dy}{dx}$ from an equation in $x$ and $y$ without solving it for $y$: differentiate both sides with respect to $x$, treating $y$ as a differentiable function of $x$, then collect the terms with $\frac{dy}{dx}$ and solve for it.** Each $y$ brings a factor $\frac{dy}{dx}$ by the chain rule, so $\frac{d}{dx}y^2=2y\,\frac{dy}{dx}$. For the circle $x^2+y^2=25$ this gives $\frac{dy}{dx}=-\frac{x}{y}$, the slope at every point where $y\ne0$. ### Key takeaways - An equation such as $x^3+y^3=9xy$ defines $y$ implicitly: near most of its points the curve is the graph of a differentiable function of $x$, even when no formula for it can be written. - Method: differentiate both sides with respect to $x$ (a factor $\frac{dy}{dx}$ for every $y$), collect the terms with $\frac{dy}{dx}$, solve; the answer usually contains both $x$ and $y$. - At a point of the curve with slope $m$ the tangent line is $y-y_0=m(x-x_0)$ and the normal line has slope $-\frac1m$; the tangent is horizontal where the numerator of $\frac{dy}{dx}$ is $0$ and vertical where the denominator is $0$. - For the second derivative differentiate $\frac{dy}{dx}$ again, put the formula for $\frac{dy}{dx}$ back in, and use the original equation to simplify: for $x^2+y^2=25$, $\frac{d^2y}{dx^2}=-\frac{25}{y^3}$. - Implicit differentiation of $y^q=x^p$ proves the power rule $\frac{d}{dx}x^{p/q}=\frac pq\,x^{p/q-1}$ for every rational exponent. - Check that the point is on the curve, expect $\frac00$ at points where the curve crosses itself, and remember that the formula is only a formula: $x^2+y^2=-1$ has no points and still gives $-\frac xy$. ## What is an implicit function, and why can you not always solve for y? **An implicit function is a function that an equation in $x$ and $y$ defines without giving $y$ by a formula: $y$ is whatever number makes the equation true.** Most of the functions so far were explicit, $y=f(x)$, with $y$ alone on one side. Three equations are different: - $y^2=x$ gives two values of $y$ for each $x>0$, namely $\sqrt x$ and $-\sqrt x$; - $x^2+y^2=25$, the [circle](https://nunada.my.id/articles/circles/#equation) of radius $5$, gives $y=\sqrt{25-x^2}$ or $y=-\sqrt{25-x^2}$; - $x^3+y^3=9xy$, the folium of Descartes, is a cubic in $y$ with no simple formula for its three solutions. Each of these is a relation, not a function: a value of $x$ can have more than one $y$. But the curve can be cut into arcs, and each arc is the graph of a differentiable function of $x$, for example the lower half of the circle through $(3,-4)$. **Why this matters.** The slope of such a curve is still the derivative of those arcs, and the [derivative rules](https://nunada.my.id/articles/differentiation-rules/#product-rule) will find it if we are able to differentiate the equation itself instead of a formula for $y$. That is implicit differentiation. It is the only way for the folium, and for the circle it is shorter than the explicit way. **The assumption.** In every example the equation is assumed to determine $y$ as a differentiable function of $x$ near the point in question, so that $\frac{dy}{dx}$ exists. The section on what can go wrong says when that fails. ## How does implicit differentiation work? **To differentiate implicitly, differentiate both sides of the equation with respect to $x$, treating $y$ as a differentiable function of $x$, collect the terms with $\frac{dy}{dx}$ on one side, and solve for $\frac{dy}{dx}$.** 1. Differentiate both sides with respect to $x$, treating $y$ as a differentiable function of $x$. 2. Collect the terms with $\frac{dy}{dx}$ on one side and solve for $\frac{dy}{dx}$. **Where the factor comes from.** The word treating is the [chain rule](https://nunada.my.id/articles/the-chain-rule/#chain-rule). With $y=f(x)$, $y^2$ is a composite function: the outside is a square and the inside is $y$, so $\frac{d}{dx}y^2=2y\cdot\frac{dy}{dx}$. In general every function of $y$ gets one extra factor $y'$: $$\frac{d}{dx}f(y)=f'(y)\cdot\frac{dy}{dx},$$ and a product such as $xy$ needs the [product rule](https://nunada.my.id/articles/differentiation-rules/#product-rule): $\frac{d}{dx}(xy)=y+x\,\frac{dy}{dx}$. A function of $x$ alone gets no factor. **Example 1.** Find $\frac{dy}{dx}$ if $y^2=x$. The equation defines two functions we can write, $y=\sqrt x$ and $y=-\sqrt x$ for $x>0$, with derivatives $\frac{1}{2\sqrt x}$ and $-\frac{1}{2\sqrt x}$. But without knowing them, differentiate both sides: $$2y\,\frac{dy}{dx}=1,\qquad\frac{dy}{dx}=\frac{1}{2y}.$$ One formula gives both: $\frac{1}{2y}=\frac{1}{2\sqrt x}$ when $y=\sqrt x$ and $\frac{1}{2y}=-\frac{1}{2\sqrt x}$ when $y=-\sqrt x$. **Example 2.** Find the slope of the circle $x^2+y^2=25$ at the point $(3,-4)$. Differentiate: $$2x+2y\,\frac{dy}{dx}=0,\qquad\frac{dy}{dx}=-\frac{x}{y}.$$ At $(3,-4)$ the slope is $-\frac{3}{-4}=\frac34$. The explicit way agrees: the lower semicircle is $y=-\sqrt{25-x^2}$, whose derivative $\frac{x}{\sqrt{25-x^2}}$ is $\frac34$ at $x=3$. Notice that the explicit formula only works on that half of the circle, but $-\frac xy$ works everywhere on the circle except where $y=0$, and that it contains both variables. **Example 3.** Find $\frac{dy}{dx}$ if $y^2=x^2+\sin(xy)$. Differentiate both sides, using the product rule inside the sine: $$2y\,y'=2x+\cos(xy)\,(y+x\,y').$$ Collect the terms with $y'$ on the left: $$2y\,y'-x\cos(xy)\,y'=2x+y\cos(xy).$$ Factor and solve: $$y'=\frac{2x+y\cos(xy)}{2y-x\cos(xy)}.$$ The formula applies at every point of the curve where the denominator is not $0$. Type any equation in $x$ and $y$ below, with a point to find the tangent and normal lines there. The curve is drawn, the steps are shown, and the slope is checked by solving the equation numerically on both sides of the point. ## How do you find tangent and normal lines to an implicit curve? **At a point $(x_0,y_0)$ of the curve where the slope is $m$, the tangent line is $y-y_0=m(x-x_0)$ and the normal line, perpendicular to it, has slope $-\frac1m$.** First check that the point is on the curve, then evaluate $\frac{dy}{dx}$ there with both coordinates. The two lines are the [tangent line equation](https://nunada.my.id/articles/tangent-lines-and-derivative-at-a-point/#tangent-line-equation) of the earlier article, with the slope found implicitly. The normal line matters in optics: the angles at which a ray of light enters a lens are measured from the normal line to the surface. **Example 4.** Show that $(2,4)$ lies on the folium $x^3+y^3=9xy$, and find the tangent and normal lines there. The point is on the curve because $8+64=72=9\cdot2\cdot4$. Differentiate: $$3x^2+3y^2y'=9y+9x\,y'.$$ Collect and solve, then divide the top and bottom by $3$: $$y'=\frac{9y-3x^2}{3y^2-9x}=\frac{3y-x^2}{y^2-3x}.$$ At $(2,4)$ the slope is $\frac{12-4}{16-6}=\frac45$. The tangent line is $y-4=\frac45(x-2)$, that is $y=\frac45x+\frac{12}{5}$. The normal line has slope $-\frac54$: $y-4=-\frac54(x-2)$, that is $y=-\frac54x+\frac{13}{2}$. **Example 5: parallel tangents.** The curve $x^2+xy+y^2=7$ meets the $x$-axis where $y=0$ and $x^2=7$, at $\left(\sqrt7,0\right)$ and $\left(-\sqrt7,0\right)$. Differentiating gives $2x+y+x\,y'+2y\,y'=0$, so $$y'=-\frac{2x+y}{x+2y}.$$ At both points $y=0$ and the slope is $-\frac{2x}{x}=-2$: the tangent lines are parallel. **Example 6: horizontal and vertical tangents of the folium.** A tangent is horizontal where the numerator of $y'=\frac{3y-x^2}{y^2-3x}$ is $0$, that is $y=\frac{x^2}{3}$, and vertical where the denominator is $0$, that is $y^2=3x$. Put $y=\frac{x^2}{3}$ in the equation of the curve: $$x^3+\frac{x^6}{27}=3x^3,\qquad x^6=54\,x^3.$$ Apart from the origin, $x^3=54$, so $x=\sqrt[3]{54}=3\sqrt[3]{2}\approx3.78$ and $y=\frac{x^2}{3}=3\sqrt[3]{4}\approx4.76$. The equation does not change when $x$ and $y$ are swapped, so the vertical tangent is at the mirror point $\left(3\sqrt[3]{4},\,3\sqrt[3]{2}\right)\approx(4.76,\,3.78)$. Move a point around a circle, an ellipse and a rounded square below, and watch the tangent and normal lines turn. ## How do you find the second derivative of an implicit function? **To find $\frac{d^2y}{dx^2}$, differentiate the formula for $y'$ again, treating $y$ as a function of $x$, and then put the formula for $y'$ in place of every $y'$ that appears.** The result has only $x$ and $y$ in it, and the original equation can often shorten it. **Example 7.** Find $y''$ if $2x^3-3y^2=8$. First, $6x^2-6y\,y'=0$, so $$y'=\frac{x^2}{y}\qquad(y\ne0).$$ Differentiate with the [quotient rule](https://nunada.my.id/articles/differentiation-rules/#quotient-rule), remembering that $y$ is a function of $x$: $$y''=\frac{2x\cdot y-x^2\cdot y'}{y^2}.$$ Now substitute $y'=\frac{x^2}{y}$: $$y''=\frac{2xy-x^2\cdot\frac{x^2}{y}}{y^2}=\frac{2x}{y}-\frac{x^4}{y^3}.$$ **Example 8: the circle.** For $x^2+y^2=25$ we found $y'=-\frac{x}{y}$. Then $$y''=-\frac{y-x\,y'}{y^2}=-\frac{y+\frac{x^2}{y}}{y^2}$$ $$=-\frac{x^2+y^2}{y^3}.$$ The original equation says $x^2+y^2=25$, so $$\frac{d^2y}{dx^2}=-\frac{25}{y^3}.$$ At $(3,-4)$ that is $\frac{25}{64}>0$: the lower semicircle is bent upward there, like a bowl, as it should be. At $(0,5)$ it is $-\frac{25}{125}=-\frac15<0$: the top of the circle bends downward. The same pattern works for third and higher derivatives: each step differentiates the previous formula and replaces $y'$ again. Tick also the second derivative in the tool above to see $y''$ for any equation; the formulas come out longer than by hand, because the tool does not use the original equation to shorten them. ## How does implicit differentiation prove the power rule for fractions? **If $p$ and $q$ are integers with $q>0$ and $y=x^{p/q}$, then $\frac{dy}{dx}=\frac pq\,x^{p/q-1}$: the [power rule](https://nunada.my.id/articles/differentiation-rules/#constants-and-powers) holds for every rational exponent.** The proof is implicit differentiation of an equation that has no fraction in it. Since $y=x^{p/q}$, we have $y^q=x^p$. Differentiate both sides with respect to $x$: $$q\,y^{q-1}\,y'=p\,x^{p-1}.$$ Solve for $y'$, and replace $y^{q-1}$ by $x^{p(q-1)/q}$: $$y'=\frac pq\cdot\frac{x^{p-1}}{y^{q-1}}$$ $$=\frac pq\cdot x^{p-1-\frac{p(q-1)}{q}}=\frac pq\cdot x^{\frac pq-1}.$$ The exponent works out because $p-1-p+\frac pq=\frac pq-1$. The result holds where $y\ne0$ and $y$ is differentiable. **Examples.** For $y=\sqrt x$ take $y^2=x$: $2y\,y'=1$ and $y'=\frac{1}{2\sqrt x}$. For $y=x^{2/3}$ take $y^3=x^2$: $3y^2y'=2x$, so $$y'=\frac{2x}{3y^2}=\frac{2x}{3x^{4/3}}=\frac23\,x^{-1/3}.$$ This is the derivative of $x^{2/3}$ met in the earlier articles, which is undefined at $x=0$, as the formula $x^{-1/3}$ predicts. The [chain rule](https://nunada.my.id/articles/the-chain-rule/#power-chain-rule) then lets the exponent sit on any function: $\frac{d}{dx}u^{p/q}=\frac pq\,u^{p/q-1}\frac{du}{dx}$. ## What can go wrong with implicit differentiation? **The formula $y'=-\frac AB$ is only meaningful at points that are on the curve and where $B\ne0$; at other points it is wrong, undefined, or $\frac00$.** - **The point must be on the curve.** The formula $-\frac xy$ gives a number at $(1,1)$, but $(1,1)$ is not on $x^2+y^2=25$, so that number is the slope of nothing. Always check that the coordinates satisfy the equation first, as in Example 4. - **A zero denominator means a vertical tangent, not "no tangent".** Where $B=0$ and $A\ne0$ the quantity $\frac{dy}{dx}$ does not exist but the curve is smooth and its tangent line is vertical: on the circle at $(5,0)$ and $(-5,0)$, where $y=0$. In the folium, at $\left(3\sqrt[3]{4},3\sqrt[3]{2}\right)$. - **$\frac00$ at a crossing.** At the origin the folium's formula $\frac{3y-x^2}{y^2-3x}$ is $\frac00$. That is not a slope of $0$. Near the origin the term $9xy$ dominates, so the curve looks like $xy=0$: two branches cross there, one along each axis, with tangents $y=0$ and $x=0$. A point where a curve crosses itself has two tangent lines and no single slope. - **A formula is not a curve.** The equation $x^2+y^2=-1$ is satisfied by no real point, yet differentiating it produces $y'=-\frac xy$ just the same. The method assumes that $y$ exists as a differentiable function, and does not check it. - **When does the assumption hold?** If the equation is $F(x,y)=0$ with smooth $F$ and $B\ne0$ at a point of the curve, the implicit function theorem says that near that point the curve really is the graph of a differentiable function $y(x)$. That is why a nonzero denominator is the condition to look at. ## How do you differentiate implicitly in code? **SymPy has the method built in: `sp.idiff(F, y, x)` differentiates the equation $F(x,y)=0$ implicitly and returns $\frac{dy}{dx}$, and a fourth argument asks for a higher derivative.** The equation is given as an expression equal to zero, so $x^3+y^3=9xy$ becomes `x**3 + y**3 - 9xy`. SymPy writes the folium's slope as $\frac{x^2-3y}{3x-y^2}$, which is our $\frac{3y-x^2}{y^2-3x}$ with the top and bottom both multiplied by $-1$. For the circle it gives the second derivative $-\frac{1}{y}\left(\frac{x^2}{y^2}+1\right)$, which is $-\frac{x^2+y^2}{y^3}$. **A check that needs no calculus.** Solve the equation numerically for $y$ at $x=2+h$ and at $x=2-h$ with Newton's method, and take the difference quotient: it is the slope, because it is the derivative of the function that the curve defines, with no formula for $y$ ever written. ```python import sympy as sp x, y = sp.symbols('x y') print(sp.idiff(x**3 + y**3 - 9 * x * y, y, x)) # (x**2 - 3*y)/(3*x - y**2) print(sp.idiff(x**2 + y**2 - 25, y, x, 2)) # -(x**2/y**2 + 1)/y print(sp.idiff(2 * x**3 - 3 * y**2 - 8, y, x, 2)) # x*(-x**3/y**2 + 2)/y print(sp.simplify(sp.idiff(sp.sin(x * y) - x - y, y, x))) # (-y*cos(x*y) + 1)/(x*cos(x*y) - 1) def solve_y(x, y): """Newton's method on F(x, y) = 0, for y, starting from a guess.""" for _ in range(50): f = x**3 + y**3 - 9 * x * y d = 3 * y**2 - 9 * x # the derivative of F with respect to y y -= f / d return y h = 1e-6 print(round((solve_y(2 + h, 4) - solve_y(2 - h, 4)) / (2 * h), 6)) # 0.8 (a difference quotient of the solutions) print(round(solve_y(2, 4), 6)) # 4.0 (the point (2, 4) is on the curve) slope = lambda x, y: (3 * y - x**2) / (y**2 - 3 * x) print(round(slope(2, 4), 6)) # 0.8 (the formula of Example 4) ``` ```cpp #include #include using namespace std; // Newton's method on F(x, y) = x^3 + y^3 - 9xy = 0, for y, starting from a guess double solveY(double x, double y) { for (int i = 0; i < 50; i++) { double f = x * x * x + y * y * y - 9 * x * y; double d = 3 * y * y - 9 * x; // the derivative of F with respect to y y -= f / d; } return y; } // the implicit derivative: dy/dx = (3y - x^2) / (y^2 - 3x) double slope(double x, double y) { return (3 * y - x * x) / (y * y - 3 * x); } int main() { double h = 1e-6; printf("%.6f\n", (solveY(2 + h, 4) - solveY(2 - h, 4)) / (2 * h)); // a difference quotient of the solutions printf("%.6f\n", solveY(2, 4)); // the point (2, 4) is on the curve printf("%.6f\n", slope(2, 4)); // the formula of Example 4 return 0; } /* output: 0.800000 4.000000 0.800000 */ ``` ## Who first differentiated equations without solving them? **Curves given by equations were the first problems of the calculus, and the folium of Descartes was one of its first tests.** - **Descartes and Fermat.** In 1638 René Descartes proposed the curve $x^3+y^3=3axy$, today called the folium of Descartes, as a challenge to Pierre de Fermat: find its tangent line at any point. Fermat solved it easily, which Descartes had been unable to do, and the episode is remembered as a test of the new methods of tangents. - **Newton.** Isaac Newton's Method of Fluxions, written in 1671 and published in 1736, treats curves given by an equation between two flowing quantities $x$ and $y$ and finds the ratio of their rates of change directly from the equation, without solving it for $y$. That is implicit differentiation in the language of fluxions. - **The theorem behind it.** Why $y$ exists as a differentiable function near a point where $B\ne0$ was settled much later. Augustin-Louis Cauchy is credited with the first rigorous implicit function theorem, and Ulisse Dini gave the general form for several variables in 1878. ## What mistakes do people make with implicit differentiation? **The most common mistakes with implicit differentiation are the nine below, each with the correct statement.** | Mistake | Correct | |---|---| | ❌ $\frac{d}{dx}y^2=2y$ | $y$ depends on $x$, so the chain rule adds a factor: $2y\,\frac{dy}{dx}$. | | ❌ $\frac{d}{dx}(xy)=y$ | It is a product of two functions of $x$: $y+x\,\frac{dy}{dx}$. | | ❌ $\frac{d}{dx}\sin y=\cos y$ | Again a factor: $\cos y\cdot\frac{dy}{dx}$. | | ❌ $\frac{dy}{dx}$ may contain only $x$ | It usually contains both $x$ and $y$, and is evaluated at a point with both coordinates. | | ❌ Put any point into the slope formula | The point must satisfy the equation; otherwise the number is the slope of nothing. | | ❌ For $y'=-\frac{x}{y}$, $y''=-\frac1y$ | $y$ is a function of $x$: $y''=-\frac{y-x\,y'}{y^2}$, which is $-\frac{25}{y^3}$ on $x^2+y^2=25$. | | ❌ If the denominator of $y'$ is $0$, there is no tangent line | The tangent line is vertical there, as at $(5,0)$ on the circle $x^2+y^2=25$. | | ❌ At the origin of the folium, $\frac00$ means the slope is $0$ | $\frac00$ is undetermined: two branches cross, with tangents $y=0$ and $x=0$. | | ❌ Implicit differentiation works only when $y$ can be solved for | It is for exactly the opposite case, when $y$ cannot be isolated, as in $x^3+y^3=9xy$. | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: implicit differentiation at a glance - **Method:** differentiate both sides with respect to $x$, treating $y$ as a function of $x$ ($\frac{d}{dx}f(y)=f'(y)\,\frac{dy}{dx}$, $\frac{d}{dx}(xy)=y+x\frac{dy}{dx}$), collect the $\frac{dy}{dx}$ terms, solve. - **Circle:** $x^2+y^2=25$ gives $\frac{dy}{dx}=-\frac xy$, slope $\frac34$ at $(3,-4)$, and $\frac{d^2y}{dx^2}=-\frac{25}{y^3}$. - **Lines:** tangent $y-y_0=m(x-x_0)$, normal slope $-\frac1m$; horizontal tangent where the numerator is $0$, vertical where the denominator is $0$. - **Folium:** $\frac{dy}{dx}=\frac{3y-x^2}{y^2-3x}$, slope $\frac45$ at $(2,4)$, horizontal tangent at $x=\sqrt[3]{54}$. - **Second derivative:** differentiate again and put $y'$ back in; simplify with the original equation. - **Rational powers:** $y^q=x^p$ gives $\frac{d}{dx}x^{p/q}=\frac pq\,x^{p/q-1}$. - **Care:** the point must be on the curve; $\frac00$ marks a crossing; a formula can exist where no curve does. - **Code:** `sp.idiff(F, y, x)`; check with Newton's method and a difference quotient. ## Glossary: key terms - **Implicit function**: A function defined by an equation in x and y that is not solved for y, so that y is whatever value makes the equation true. - **Explicit function**: A function written with y alone on one side, y equals f of x, which gives y directly from x. - **Implicit differentiation**: Finding dy over dx by differentiating both sides of an equation with respect to x, treating y as a function of x, and then solving for dy over dx. - **Normal line**: The line through a point of a curve that is perpendicular to the tangent line there; its slope is minus the reciprocal of the tangent slope. - **Folium of Descartes**: The curve x cubed plus y cubed equals 9xy, a loop with two branches that cross at the origin, first proposed by Descartes in 1638. - **Vertical tangent**: A tangent line parallel to the y-axis, at a point where dy over dx grows without bound because its denominator is zero. ## Frequently asked questions ### What is implicit differentiation? Implicit differentiation is a way to find dy over dx from an equation in x and y without solving the equation for y. You differentiate both sides with respect to x, treating y as a function of x, then collect the terms with dy over dx and solve for it. ### When do you use implicit differentiation? Use it when an equation defines y in terms of x but y cannot be isolated, or when isolating it would give several branches and messy formulas, as for the folium of Descartes. It also gives a slope for the whole circle with one formula. ### Why does y squared differentiate to 2y times dy over dx? Because y depends on x, so y squared is a composite function: a square outside and y inside. The chain rule gives the derivative of the outside, two y, times the derivative of the inside, which is dy over dx. A function of x alone gets no extra factor. ### What is the derivative of a circle? For the circle x squared plus y squared equals r squared, implicit differentiation gives dy over dx equal to minus x over y, at every point where y is not zero. At the top and bottom points the slope is zero, and at the left and right points the tangent is vertical. ### How do you find the tangent line to an implicit curve? Check that the point is on the curve, find dy over dx by implicit differentiation, and put in both coordinates to get the slope m. The tangent line is y minus y0 equals m times x minus x0. The normal line uses the slope minus one over m. ### How do you find the second derivative implicitly? Differentiate the formula for dy over dx again, treating y as a function of x, then replace every dy over dx by its formula. The result has only x and y, and the original equation often shortens it, as with minus 25 over y cubed for the circle. ### What does it mean when the denominator of dy over dx is zero? Usually the tangent line is vertical there, since the slope grows without bound, as at the left and right points of a circle. If the numerator is zero too, you get zero over zero, which can mean that two branches of the curve cross at that point. ### How does implicit differentiation prove the power rule for fractions? Write y equals x to the p over q as y to the q equals x to the p, and differentiate both sides. That gives q times y to the q minus one times dy over dx equal to p times x to the p minus one, which solves to p over q times x to the p over q minus one. ### Is implicit differentiation valid for any equation? No. It assumes that y is a differentiable function of x near the point, which holds where the denominator of dy over dx is not zero and the equation is smooth. It gives formulas even for equations with no points, such as x squared plus y squared equals minus one. --- # Diferensiasi Implisit Source: https://nunada.my.id/artikel/diferensiasi-implisit/ Updated: 2026-10-16 ## Jawaban singkat **Diferensiasi implisit mencari $\frac{dy}{dx}$ dari persamaan dalam $x$ dan $y$ tanpa menyelesaikannya untuk $y$: turunkan kedua ruas terhadap $x$, dengan memperlakukan $y$ sebagai fungsi $x$ yang terdiferensialkan, lalu kumpulkan suku-suku dengan $\frac{dy}{dx}$ dan selesaikan untuknya.** Setiap $y$ membawa faktor $\frac{dy}{dx}$ lewat aturan rantai, sehingga $\frac{d}{dx}y^2=2y\,\frac{dy}{dx}$. Untuk lingkaran $x^2+y^2=25$ ini memberi $\frac{dy}{dx}=-\frac{x}{y}$, gradien di setiap titik tempat $y\ne0$. ### Poin penting - Persamaan seperti $x^3+y^3=9xy$ mendefinisikan $y$ secara implisit: di dekat sebagian besar titiknya kurva itu adalah grafik fungsi $x$ yang terdiferensialkan, walaupun tidak ada rumus untuknya yang dapat ditulis. - Cara: turunkan kedua ruas terhadap $x$ (faktor $\frac{dy}{dx}$ untuk setiap $y$), kumpulkan suku-suku dengan $\frac{dy}{dx}$, selesaikan; jawabannya biasanya memuat $x$ dan $y$. - Di titik kurva dengan gradien $m$ garis singgungnya $y-y_0=m(x-x_0)$ dan garis normalnya bergradien $-\frac1m$; garis singgung mendatar di tempat pembilang $\frac{dy}{dx}$ bernilai $0$ dan tegak di tempat penyebutnya $0$. - Untuk turunan kedua turunkan $\frac{dy}{dx}$ lagi, masukkan kembali rumus $\frac{dy}{dx}$, dan pakai persamaan semula untuk menyederhanakan: untuk $x^2+y^2=25$, $\frac{d^2y}{dx^2}=-\frac{25}{y^3}$. - Diferensiasi implisit pada $y^q=x^p$ membuktikan aturan pangkat $\frac{d}{dx}x^{p/q}=\frac pq\,x^{p/q-1}$ untuk setiap pangkat rasional. - Periksa bahwa titik itu berada pada kurva, harapkan $\frac00$ di titik tempat kurva memotong dirinya sendiri, dan ingat bahwa rumus itu hanyalah rumus: $x^2+y^2=-1$ tidak memiliki titik dan tetap memberi $-\frac xy$. ## Apa itu fungsi implisit, dan mengapa tidak selalu dapat menyelesaikan untuk y? **Fungsi implisit adalah fungsi yang didefinisikan oleh persamaan dalam $x$ dan $y$ tanpa memberi $y$ dengan rumus: $y$ adalah bilangan apa pun yang membuat persamaan itu benar.** Kebanyakan fungsi sejauh ini eksplisit, $y=f(x)$, dengan $y$ sendirian di satu ruas. Tiga persamaan berikut berbeda: - $y^2=x$ memberi dua nilai $y$ untuk tiap $x>0$, yaitu $\sqrt x$ dan $-\sqrt x$; - $x^2+y^2=25$, [lingkaran](https://nunada.my.id/artikel/lingkaran/#equation) berjari-jari $5$, memberi $y=\sqrt{25-x^2}$ atau $y=-\sqrt{25-x^2}$; - $x^3+y^3=9xy$, folium Descartes, adalah kubik dalam $y$ yang tiga penyelesaiannya tidak punya rumus sederhana. Masing-masing adalah relasi, bukan fungsi: satu nilai $x$ dapat memiliki lebih dari satu $y$. Tetapi kurvanya dapat dipotong menjadi busur-busur, dan tiap busur adalah grafik fungsi $x$ yang terdiferensialkan, misalnya setengah bawah lingkaran yang melalui $(3,-4)$. **Mengapa ini penting.** Gradien kurva seperti itu tetap turunan busur-busur tersebut, dan [aturan turunan](https://nunada.my.id/artikel/aturan-turunan/#product-rule) akan menemukannya bila kita dapat menurunkan persamaannya sendiri dan bukan rumus untuk $y$. Itulah diferensiasi implisit. Ia satu-satunya cara untuk folium, dan untuk lingkaran ia lebih singkat daripada cara eksplisit. **Asumsinya.** Pada setiap contoh persamaan diasumsikan menentukan $y$ sebagai fungsi $x$ yang terdiferensialkan di dekat titik yang ditinjau, sehingga $\frac{dy}{dx}$ ada. Bagian tentang apa yang dapat salah menjelaskan kapan hal itu gagal. ## Bagaimana diferensiasi implisit bekerja? **Untuk menurunkan secara implisit, turunkan kedua ruas persamaan terhadap $x$, dengan memperlakukan $y$ sebagai fungsi $x$ yang terdiferensialkan, kumpulkan suku-suku dengan $\frac{dy}{dx}$ di satu ruas, dan selesaikan untuk $\frac{dy}{dx}$.** 1. Turunkan kedua ruas terhadap $x$, dengan memperlakukan $y$ sebagai fungsi $x$ yang terdiferensialkan. 2. Kumpulkan suku-suku dengan $\frac{dy}{dx}$ di satu ruas dan selesaikan untuk $\frac{dy}{dx}$. **Dari mana faktor itu berasal.** Kata memperlakukan adalah [aturan rantai](https://nunada.my.id/artikel/aturan-rantai/#chain-rule). Dengan $y=f(x)$, $y^2$ adalah fungsi komposit: fungsi luarnya kuadrat dan fungsi dalamnya $y$, sehingga $\frac{d}{dx}y^2=2y\cdot\frac{dy}{dx}$. Secara umum setiap fungsi dari $y$ mendapat satu faktor tambahan $y'$: $$\frac{d}{dx}f(y)=f'(y)\cdot\frac{dy}{dx},$$ dan hasil kali seperti $xy$ memerlukan [aturan hasil kali](https://nunada.my.id/artikel/aturan-turunan/#product-rule): $\frac{d}{dx}(xy)=y+x\,\frac{dy}{dx}$. Fungsi dari $x$ saja tidak mendapat faktor. **Contoh 1.** Tentukan $\frac{dy}{dx}$ jika $y^2=x$. Persamaan itu mendefinisikan dua fungsi yang dapat kita tulis, $y=\sqrt x$ dan $y=-\sqrt x$ untuk $x>0$, dengan turunan $\frac{1}{2\sqrt x}$ dan $-\frac{1}{2\sqrt x}$. Tetapi tanpa mengetahuinya, turunkan kedua ruas: $$2y\,\frac{dy}{dx}=1,\qquad\frac{dy}{dx}=\frac{1}{2y}.$$ Satu rumus memberi keduanya: $\frac{1}{2y}=\frac{1}{2\sqrt x}$ bila $y=\sqrt x$ dan $\frac{1}{2y}=-\frac{1}{2\sqrt x}$ bila $y=-\sqrt x$. **Contoh 2.** Tentukan gradien lingkaran $x^2+y^2=25$ di titik $(3,-4)$. Turunkan: $$2x+2y\,\frac{dy}{dx}=0,\qquad\frac{dy}{dx}=-\frac{x}{y}.$$ Di $(3,-4)$ gradiennya $-\frac{3}{-4}=\frac34$. Cara eksplisit setuju: setengah lingkaran bawah adalah $y=-\sqrt{25-x^2}$, yang turunannya $\frac{x}{\sqrt{25-x^2}}$ bernilai $\frac34$ di $x=3$. Perhatikan bahwa rumus eksplisit hanya berlaku pada setengah lingkaran itu, tetapi $-\frac xy$ berlaku di mana-mana pada lingkaran kecuali di tempat $y=0$, dan bahwa ia memuat kedua peubah. **Contoh 3.** Tentukan $\frac{dy}{dx}$ jika $y^2=x^2+\sin(xy)$. Turunkan kedua ruas, dengan aturan hasil kali di dalam sinus: $$2y\,y'=2x+\cos(xy)\,(y+x\,y').$$ Kumpulkan suku-suku dengan $y'$ di ruas kiri: $$2y\,y'-x\cos(xy)\,y'=2x+y\cos(xy).$$ Faktorkan dan selesaikan: $$y'=\frac{2x+y\cos(xy)}{2y-x\cos(xy)}.$$ Rumus itu berlaku di setiap titik kurva tempat penyebutnya bukan $0$. Ketik persamaan apa saja dalam $x$ dan $y$ di bawah, dengan satu titik untuk mencari garis singgung dan garis normal di sana. Kurvanya digambar, langkahnya ditampilkan, dan gradiennya diperiksa dengan menyelesaikan persamaan secara numerik di kedua sisi titik itu. ## Bagaimana mencari garis singgung dan garis normal pada kurva implisit? **Di titik $(x_0,y_0)$ pada kurva tempat gradiennya $m$, garis singgungnya $y-y_0=m(x-x_0)$ dan garis normalnya, yang tegak lurus padanya, bergradien $-\frac1m$.** Periksa dulu bahwa titik itu berada pada kurva, lalu hitung $\frac{dy}{dx}$ di sana dengan kedua koordinat. Kedua garis itu adalah [persamaan garis singgung](https://nunada.my.id/artikel/garis-singgung-dan-turunan-di-suatu-titik/#tangent-line-equation) pada artikel terdahulu, dengan gradien yang ditemukan secara implisit. Garis normal penting dalam optika: sudut tempat sinar cahaya memasuki lensa diukur dari garis normal pada permukaannya. **Contoh 4.** Tunjukkan bahwa $(2,4)$ terletak pada folium $x^3+y^3=9xy$, dan tentukan garis singgung dan garis normal di sana. Titik itu berada pada kurva karena $8+64=72=9\cdot2\cdot4$. Turunkan: $$3x^2+3y^2y'=9y+9x\,y'.$$ Kumpulkan dan selesaikan, lalu bagi pembilang dan penyebut dengan $3$: $$y'=\frac{9y-3x^2}{3y^2-9x}=\frac{3y-x^2}{y^2-3x}.$$ Di $(2,4)$ gradiennya $\frac{12-4}{16-6}=\frac45$. Garis singgungnya $y-4=\frac45(x-2)$, yaitu $y=\frac45x+\frac{12}{5}$. Garis normalnya bergradien $-\frac54$: $y-4=-\frac54(x-2)$, yaitu $y=-\frac54x+\frac{13}{2}$. **Contoh 5: garis singgung sejajar.** Kurva $x^2+xy+y^2=7$ memotong sumbu-$x$ di tempat $y=0$ dan $x^2=7$, di $\left(\sqrt7,0\right)$ dan $\left(-\sqrt7,0\right)$. Menurunkannya memberi $2x+y+x\,y'+2y\,y'=0$, sehingga $$y'=-\frac{2x+y}{x+2y}.$$ Di kedua titik $y=0$ dan gradiennya $-\frac{2x}{x}=-2$: garis singgungnya sejajar. **Contoh 6: garis singgung mendatar dan tegak pada folium.** Garis singgung mendatar di tempat pembilang $y'=\frac{3y-x^2}{y^2-3x}$ bernilai $0$, yaitu $y=\frac{x^2}{3}$, dan tegak di tempat penyebutnya $0$, yaitu $y^2=3x$. Masukkan $y=\frac{x^2}{3}$ ke persamaan kurva: $$x^3+\frac{x^6}{27}=3x^3,\qquad x^6=54\,x^3.$$ Selain titik asal, $x^3=54$, sehingga $x=\sqrt[3]{54}=3\sqrt[3]{2}\approx3{,}78$ dan $y=\frac{x^2}{3}=3\sqrt[3]{4}\approx4{,}76$. Persamaan tidak berubah bila $x$ dan $y$ dipertukarkan, sehingga garis singgung tegaknya di titik cermin $\left(3\sqrt[3]{4},\,3\sqrt[3]{2}\right)\approx(4{,}76;\,3{,}78)$. Gerakkan titik mengelilingi lingkaran, elips, dan persegi bulat di bawah, dan lihat garis singgung dan garis normalnya berputar. ## Bagaimana mencari turunan kedua fungsi implisit? **Untuk mencari $\frac{d^2y}{dx^2}$, turunkan rumus $y'$ sekali lagi, dengan memperlakukan $y$ sebagai fungsi $x$, lalu masukkan rumus $y'$ sebagai pengganti setiap $y'$ yang muncul.** Hasilnya hanya memuat $x$ dan $y$, dan persamaan semula sering dapat memperpendeknya. **Contoh 7.** Tentukan $y''$ jika $2x^3-3y^2=8$. Pertama, $6x^2-6y\,y'=0$, sehingga $$y'=\frac{x^2}{y}\qquad(y\ne0).$$ Turunkan dengan [aturan hasil bagi](https://nunada.my.id/artikel/aturan-turunan/#quotient-rule), dengan ingat bahwa $y$ adalah fungsi $x$: $$y''=\frac{2x\cdot y-x^2\cdot y'}{y^2}.$$ Sekarang substitusikan $y'=\frac{x^2}{y}$: $$y''=\frac{2xy-x^2\cdot\frac{x^2}{y}}{y^2}=\frac{2x}{y}-\frac{x^4}{y^3}.$$ **Contoh 8: lingkaran.** Untuk $x^2+y^2=25$ kita menemukan $y'=-\frac{x}{y}$. Maka $$y''=-\frac{y-x\,y'}{y^2}=-\frac{y+\frac{x^2}{y}}{y^2}$$ $$=-\frac{x^2+y^2}{y^3}.$$ Persamaan semula menyatakan $x^2+y^2=25$, sehingga $$\frac{d^2y}{dx^2}=-\frac{25}{y^3}.$$ Di $(3,-4)$ itu $\frac{25}{64}>0$: setengah lingkaran bawah melengkung ke atas di sana, seperti mangkuk, sebagaimana mestinya. Di $(0,5)$ itu $-\frac{25}{125}=-\frac15<0$: puncak lingkaran melengkung ke bawah. Pola yang sama berlaku untuk turunan ketiga dan lebih tinggi: tiap langkah menurunkan rumus sebelumnya dan mengganti $y'$ lagi. Centang juga turunan kedua pada alat di atas untuk melihat $y''$ dari persamaan apa saja; rumusnya keluar lebih panjang daripada cara manual, karena alat itu tidak memakai persamaan semula untuk memperpendeknya. ## Bagaimana diferensiasi implisit membuktikan aturan pangkat untuk pecahan? **Jika $p$ dan $q$ bilangan bulat dengan $q>0$ dan $y=x^{p/q}$, maka $\frac{dy}{dx}=\frac pq\,x^{p/q-1}$: [aturan pangkat](https://nunada.my.id/artikel/aturan-turunan/#constants-and-powers) berlaku untuk setiap pangkat rasional.** Buktinya adalah diferensiasi implisit pada persamaan yang tidak memuat pecahan. Karena $y=x^{p/q}$, kita punya $y^q=x^p$. Turunkan kedua ruas terhadap $x$: $$q\,y^{q-1}\,y'=p\,x^{p-1}.$$ Selesaikan untuk $y'$, dan ganti $y^{q-1}$ dengan $x^{p(q-1)/q}$: $$y'=\frac pq\cdot\frac{x^{p-1}}{y^{q-1}}$$ $$=\frac pq\cdot x^{p-1-\frac{p(q-1)}{q}}=\frac pq\cdot x^{\frac pq-1}.$$ Pangkatnya cocok karena $p-1-p+\frac pq=\frac pq-1$. Hasilnya berlaku di tempat $y\ne0$ dan $y$ terdiferensialkan. **Contoh.** Untuk $y=\sqrt x$ ambil $y^2=x$: $2y\,y'=1$ dan $y'=\frac{1}{2\sqrt x}$. Untuk $y=x^{2/3}$ ambil $y^3=x^2$: $3y^2y'=2x$, sehingga $$y'=\frac{2x}{3y^2}=\frac{2x}{3x^{4/3}}=\frac23\,x^{-1/3}.$$ Ini adalah turunan $x^{2/3}$ yang dijumpai pada artikel-artikel terdahulu, yang tak terdefinisi di $x=0$, seperti diramalkan rumus $x^{-1/3}$. [Aturan rantai](https://nunada.my.id/artikel/aturan-rantai/#power-chain-rule) lalu memungkinkan pangkat itu berada pada fungsi apa pun: $\frac{d}{dx}u^{p/q}=\frac pq\,u^{p/q-1}\frac{du}{dx}$. ## Apa yang dapat salah pada diferensiasi implisit? **Rumus $y'=-\frac AB$ hanya bermakna di titik yang berada pada kurva dan tempat $B\ne0$; di titik lain ia salah, tak terdefinisi, atau $\frac00$.** - **Titiknya harus berada pada kurva.** Rumus $-\frac xy$ memberi bilangan di $(1,1)$, tetapi $(1,1)$ tidak berada pada $x^2+y^2=25$, sehingga bilangan itu adalah gradien tak ada apa-apa. Selalu periksa lebih dulu bahwa koordinatnya memenuhi persamaan, seperti pada Contoh 4. - **Penyebut nol berarti garis singgung tegak, bukan "tidak ada garis singgung".** Di tempat $B=0$ dan $A\ne0$ besaran $\frac{dy}{dx}$ tidak ada tetapi kurvanya mulus dan garis singgungnya tegak: pada lingkaran di $(5,0)$ dan $(-5,0)$, tempat $y=0$. Pada folium, di $\left(3\sqrt[3]{4},3\sqrt[3]{2}\right)$. - **$\frac00$ pada persilangan.** Di titik asal rumus folium $\frac{3y-x^2}{y^2-3x}$ bernilai $\frac00$. Itu bukan gradien $0$. Di dekat titik asal suku $9xy$ mendominasi, sehingga kurvanya tampak seperti $xy=0$: dua cabang berpotongan di sana, satu sepanjang tiap sumbu, dengan garis singgung $y=0$ dan $x=0$. Titik tempat kurva memotong dirinya sendiri memiliki dua garis singgung dan tidak punya satu gradien. - **Rumus bukan kurva.** Persamaan $x^2+y^2=-1$ tidak dipenuhi titik real mana pun, namun menurunkannya tetap menghasilkan $y'=-\frac xy$. Cara ini mengasumsikan bahwa $y$ ada sebagai fungsi yang terdiferensialkan, dan tidak memeriksanya. - **Kapan asumsi itu berlaku?** Jika persamaannya $F(x,y)=0$ dengan $F$ mulus dan $B\ne0$ di suatu titik kurva, teorema fungsi implisit menyatakan bahwa di dekat titik itu kurva benar-benar grafik fungsi $y(x)$ yang terdiferensialkan. Itulah sebabnya penyebut tak nol adalah syarat yang perlu dilihat. ## Bagaimana menurunkan secara implisit dalam kode? **SymPy memiliki metode ini bawaan: `sp.idiff(F, y, x)` menurunkan persamaan $F(x,y)=0$ secara implisit dan mengembalikan $\frac{dy}{dx}$, dan argumen keempat meminta turunan yang lebih tinggi.** Persamaan diberikan sebagai ekspresi yang sama dengan nol, sehingga $x^3+y^3=9xy$ menjadi `x**3 + y**3 - 9xy`. SymPy menulis gradien folium sebagai $\frac{x^2-3y}{3x-y^2}$, yaitu $\frac{3y-x^2}{y^2-3x}$ kita dengan pembilang dan penyebut sama-sama dikalikan $-1$. Untuk lingkaran ia memberi turunan kedua $-\frac{1}{y}\left(\frac{x^2}{y^2}+1\right)$, yaitu $-\frac{x^2+y^2}{y^3}$. **Pemeriksaan yang tidak memerlukan kalkulus.** Selesaikan persamaan secara numerik untuk $y$ di $x=2+h$ dan di $x=2-h$ dengan metode Newton, lalu ambil hasil bagi selisih: itulah gradiennya, karena ia turunan fungsi yang didefinisikan kurva itu, tanpa pernah menulis rumus untuk $y$. ```python import sympy as sp x, y = sp.symbols('x y') print(sp.idiff(x**3 + y**3 - 9 * x * y, y, x)) # (x**2 - 3*y)/(3*x - y**2) print(sp.idiff(x**2 + y**2 - 25, y, x, 2)) # -(x**2/y**2 + 1)/y print(sp.idiff(2 * x**3 - 3 * y**2 - 8, y, x, 2)) # x*(-x**3/y**2 + 2)/y print(sp.simplify(sp.idiff(sp.sin(x * y) - x - y, y, x))) # (-y*cos(x*y) + 1)/(x*cos(x*y) - 1) def solve_y(x, y): """Newton's method on F(x, y) = 0, for y, starting from a guess.""" for _ in range(50): f = x**3 + y**3 - 9 * x * y d = 3 * y**2 - 9 * x # the derivative of F with respect to y y -= f / d return y h = 1e-6 print(round((solve_y(2 + h, 4) - solve_y(2 - h, 4)) / (2 * h), 6)) # 0.8 (a difference quotient of the solutions) print(round(solve_y(2, 4), 6)) # 4.0 (the point (2, 4) is on the curve) slope = lambda x, y: (3 * y - x**2) / (y**2 - 3 * x) print(round(slope(2, 4), 6)) # 0.8 (the formula of Example 4) ``` ```cpp #include #include using namespace std; // Newton's method on F(x, y) = x^3 + y^3 - 9xy = 0, for y, starting from a guess double solveY(double x, double y) { for (int i = 0; i < 50; i++) { double f = x * x * x + y * y * y - 9 * x * y; double d = 3 * y * y - 9 * x; // the derivative of F with respect to y y -= f / d; } return y; } // the implicit derivative: dy/dx = (3y - x^2) / (y^2 - 3x) double slope(double x, double y) { return (3 * y - x * x) / (y * y - 3 * x); } int main() { double h = 1e-6; printf("%.6f\n", (solveY(2 + h, 4) - solveY(2 - h, 4)) / (2 * h)); // a difference quotient of the solutions printf("%.6f\n", solveY(2, 4)); // the point (2, 4) is on the curve printf("%.6f\n", slope(2, 4)); // the formula of Example 4 return 0; } /* output: 0.800000 4.000000 0.800000 */ ``` ## Siapa yang pertama menurunkan persamaan tanpa menyelesaikannya? **Kurva yang diberikan oleh persamaan adalah soal-soal pertama kalkulus, dan folium Descartes adalah salah satu ujian pertamanya.** - **Descartes dan Fermat.** Pada 1638 René Descartes mengajukan kurva $x^3+y^3=3axy$, kini disebut folium Descartes, sebagai tantangan bagi Pierre de Fermat: tentukan garis singgungnya di titik mana pun. Fermat menyelesaikannya dengan mudah, yang tidak dapat dilakukan Descartes, dan peristiwa itu dikenang sebagai ujian bagi cara-cara baru mencari garis singgung. - **Newton.** Method of Fluxions karya Isaac Newton, ditulis pada 1671 dan diterbitkan pada 1736, memperlakukan kurva yang diberikan oleh persamaan antara dua besaran mengalir $x$ dan $y$ dan menemukan perbandingan laju perubahannya langsung dari persamaan itu, tanpa menyelesaikannya untuk $y$. Itu adalah diferensiasi implisit dalam bahasa fluksi. - **Teorema di baliknya.** Mengapa $y$ ada sebagai fungsi yang terdiferensialkan di dekat titik tempat $B\ne0$ dituntaskan jauh kemudian. Augustin-Louis Cauchy dikreditkan dengan teorema fungsi implisit rigor yang pertama, dan Ulisse Dini memberi bentuk umumnya untuk beberapa peubah pada 1878. ## Kesalahan apa yang sering terjadi pada diferensiasi implisit? **Kesalahan paling umum pada diferensiasi implisit adalah sembilan hal berikut, masing-masing dengan pernyataan yang benar.** | Kesalahan | Yang benar | |---|---| | ❌ $\frac{d}{dx}y^2=2y$ | $y$ bergantung pada $x$, sehingga aturan rantai menambah faktor: $2y\,\frac{dy}{dx}$. | | ❌ $\frac{d}{dx}(xy)=y$ | Itu hasil kali dua fungsi $x$: $y+x\,\frac{dy}{dx}$. | | ❌ $\frac{d}{dx}\sin y=\cos y$ | Lagi-lagi ada faktor: $\cos y\cdot\frac{dy}{dx}$. | | ❌ $\frac{dy}{dx}$ boleh memuat $x$ saja | Ia biasanya memuat $x$ dan $y$, dan dihitung di titik dengan kedua koordinat. | | ❌ Masukkan titik apa saja ke rumus gradien | Titik itu harus memenuhi persamaan; kalau tidak, bilangan itu adalah gradien tak ada apa-apa. | | ❌ Untuk $y'=-\frac{x}{y}$, $y''=-\frac1y$ | $y$ adalah fungsi $x$: $y''=-\frac{y-x\,y'}{y^2}$, yaitu $-\frac{25}{y^3}$ pada $x^2+y^2=25$. | | ❌ Jika penyebut $y'$ bernilai $0$, tidak ada garis singgung | Garis singgungnya tegak di sana, seperti di $(5,0)$ pada lingkaran $x^2+y^2=25$. | | ❌ Di titik asal folium, $\frac00$ berarti gradiennya $0$ | $\frac00$ tidak tertentu: dua cabang berpotongan, dengan garis singgung $y=0$ dan $x=0$. | | ❌ Diferensiasi implisit hanya bekerja bila $y$ dapat diselesaikan | Ia untuk kasus yang tepat berlawanan, bila $y$ tidak dapat diisolasi, seperti pada $x^3+y^3=9xy$. | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: diferensiasi implisit sekilas - **Cara:** turunkan kedua ruas terhadap $x$, dengan memperlakukan $y$ sebagai fungsi $x$ ($\frac{d}{dx}f(y)=f'(y)\,\frac{dy}{dx}$, $\frac{d}{dx}(xy)=y+x\frac{dy}{dx}$), kumpulkan suku $\frac{dy}{dx}$, selesaikan. - **Lingkaran:** $x^2+y^2=25$ memberi $\frac{dy}{dx}=-\frac xy$, gradien $\frac34$ di $(3,-4)$, dan $\frac{d^2y}{dx^2}=-\frac{25}{y^3}$. - **Garis:** singgung $y-y_0=m(x-x_0)$, gradien normal $-\frac1m$; singgung mendatar di tempat pembilang $0$, tegak di tempat penyebut $0$. - **Folium:** $\frac{dy}{dx}=\frac{3y-x^2}{y^2-3x}$, gradien $\frac45$ di $(2,4)$, singgung mendatar di $x=\sqrt[3]{54}$. - **Turunan kedua:** turunkan lagi dan masukkan $y'$ kembali; sederhanakan dengan persamaan semula. - **Pangkat rasional:** $y^q=x^p$ memberi $\frac{d}{dx}x^{p/q}=\frac pq\,x^{p/q-1}$. - **Hati-hati:** titik harus berada pada kurva; $\frac00$ menandai persilangan; rumus dapat ada di tempat kurva tidak ada. - **Kode:** `sp.idiff(F, y, x)`; periksa dengan metode Newton dan hasil bagi selisih. ## Glosarium: istilah penting - **Fungsi implisit**: Fungsi yang didefinisikan oleh persamaan dalam x dan y yang tidak diselesaikan untuk y, sehingga y adalah nilai apa pun yang membuat persamaan itu benar. - **Fungsi eksplisit**: Fungsi yang ditulis dengan y sendirian di satu ruas, y sama dengan f dari x, yang memberi y langsung dari x. - **Diferensiasi implisit**: Mencari dy per dx dengan menurunkan kedua ruas persamaan terhadap x, memperlakukan y sebagai fungsi x, lalu menyelesaikan untuk dy per dx. - **Garis normal**: Garis melalui suatu titik kurva yang tegak lurus pada garis singgung di sana; gradiennya adalah minus kebalikan gradien garis singgung. - **Folium Descartes**: Kurva x pangkat tiga ditambah y pangkat tiga sama dengan 9xy, sebuah simpul dengan dua cabang yang berpotongan di titik asal, pertama diajukan Descartes pada 1638. - **Garis singgung tegak**: Garis singgung yang sejajar sumbu-y, di titik tempat dy per dx membesar tanpa batas karena penyebutnya nol. ## Pertanyaan yang sering diajukan ### Apa itu diferensiasi implisit? Diferensiasi implisit adalah cara mencari dy per dx dari persamaan dalam x dan y tanpa menyelesaikan persamaan itu untuk y. Kamu menurunkan kedua ruas terhadap x, dengan memperlakukan y sebagai fungsi x, lalu mengumpulkan suku dengan dy per dx dan menyelesaikannya. ### Kapan memakai diferensiasi implisit? Pakai ia bila persamaan mendefinisikan y dalam x tetapi y tidak dapat diisolasi, atau bila mengisolasinya memberi beberapa cabang dan rumus yang berantakan, seperti pada folium Descartes. Ia juga memberi gradien seluruh lingkaran dengan satu rumus. ### Mengapa y kuadrat diturunkan menjadi 2y kali dy per dx? Karena y bergantung pada x, sehingga y kuadrat adalah fungsi komposit: kuadrat di luar dan y di dalam. Aturan rantai memberi turunan fungsi luar, dua y, kali turunan fungsi dalam, yaitu dy per dx. Fungsi dari x saja tidak mendapat faktor tambahan. ### Berapa turunan sebuah lingkaran? Untuk lingkaran x kuadrat ditambah y kuadrat sama dengan r kuadrat, diferensiasi implisit memberi dy per dx sama dengan minus x per y, di setiap titik tempat y bukan nol. Di titik atas dan bawah gradiennya nol, dan di titik kiri dan kanan garis singgungnya tegak. ### Bagaimana mencari garis singgung pada kurva implisit? Periksa bahwa titik berada pada kurva, cari dy per dx dengan diferensiasi implisit, dan masukkan kedua koordinat untuk mendapat gradien m. Garis singgungnya y dikurangi y0 sama dengan m kali x dikurangi x0. Garis normal memakai gradien minus satu per m. ### Bagaimana mencari turunan kedua secara implisit? Turunkan rumus dy per dx sekali lagi, dengan memperlakukan y sebagai fungsi x, lalu ganti setiap dy per dx dengan rumusnya. Hasilnya hanya memuat x dan y, dan persamaan semula sering memperpendeknya, seperti minus 25 per y pangkat tiga untuk lingkaran. ### Apa artinya bila penyebut dy per dx bernilai nol? Biasanya garis singgungnya tegak di sana, karena gradiennya membesar tanpa batas, seperti di titik kiri dan kanan lingkaran. Jika pembilangnya juga nol, kamu mendapat nol per nol, yang dapat berarti dua cabang kurva berpotongan di titik itu. ### Bagaimana diferensiasi implisit membuktikan aturan pangkat untuk pecahan? Tulis y sama dengan x pangkat p per q sebagai y pangkat q sama dengan x pangkat p, dan turunkan kedua ruas. Itu memberi q kali y pangkat q dikurangi satu kali dy per dx sama dengan p kali x pangkat p dikurangi satu, yang diselesaikan menjadi p per q kali x pangkat p per q dikurangi satu. ### Apakah diferensiasi implisit sah untuk persamaan apa saja? Tidak. Ia mengasumsikan y adalah fungsi x yang terdiferensialkan di dekat titik itu, yang berlaku di tempat penyebut dy per dx bukan nol dan persamaannya mulus. Ia memberi rumus bahkan untuk persamaan tanpa titik, seperti x kuadrat ditambah y kuadrat sama dengan minus satu. --- # The Chain Rule Source: https://nunada.my.id/articles/the-chain-rule/ Updated: 2026-10-15 ## Quick answer **The chain rule says that the derivative of a composite function is the derivative of the outside function, evaluated at the inside function, times the derivative of the inside function: $(f\circ g)'(x)=f'(g(x))\cdot g'(x)$.** In Leibniz's notation, with $y=f(u)$ and $u=g(x)$, it reads $\frac{dy}{dx}=\frac{dy}{du}\cdot\frac{du}{dx}$: rates of change multiply. It is the reason that $\frac{d}{dx}\sin 2x=2\cos 2x$ and $\frac{d}{dx}e^{x^2}=2x\,e^{x^2}$. ### Key takeaways - A composite function $f(g(x))$ puts the inside function $g$ into the outside function $f$; the outside is the last thing done to $x$, and finding the two layers is the first step of every chain rule problem. - $\frac{dy}{dx}=\frac{dy}{du}\cdot\frac{du}{dx}$: if $y$ changes half as fast as $u$ and $u$ changes three times as fast as $x$, then $y$ changes $\frac32$ times as fast as $x$, like a train of gears. - Outside-inside rule: differentiate the outside function and leave the inside alone, then multiply by the derivative of the inside; for example $\frac{d}{dx}e^u=e^u\frac{du}{dx}$ and $\frac{d}{dx}\sin u=\cos u\,\frac{du}{dx}$. - The power chain rule $\frac{d}{dx}u^n=n\,u^{n-1}\frac{du}{dx}$ handles $\left(5x^3-x^4\right)^7$, $\frac{1}{3x-2}$, $\sin^5x$ and $\sqrt{3x+1}$, and gives $\frac{d}{dx}|x|=\frac{x}{|x|}$ for $x\ne0$. - A constant $k$ inside a sine brings out a factor $k$: doubling the frequency of a piston doubles its velocity, quadruples its acceleration and multiplies its jerk by $8$; in degrees the factor is $\frac{\pi}{180}$. - The second derivative of a composite is $f''(g)\,(g')^2+f'(g)\,g''$, not $f''(g)\,g''$; and the rule needs both functions to be differentiable where they are used. ## What is a composite function, and how do you find its inside and outside? **A composite function applies one function to the result of another: $(f\circ g)(x)=f(g(x))$, where $g$ is the inside function, applied first, and $f$ is the outside function, applied last.** The function $F(x)=\sin\left(x^2-4\right)$ is of this kind. It cannot be differentiated by the [rules so far](https://nunada.my.id/articles/differentiation-rules/#product-rule), but it is built from two functions that can: the outside $f(u)=\sin u$ and the inside $u=g(x)=x^2-4$. To find the layers, ask what is the last thing done to $x$? That is the outside function. What it is done to is the inside. | Function | Outside $f(u)$ | Inside $u=g(x)$ | |---|---|---| | $\left(3x^2+1\right)^2$ | $u^2$ | $3x^2+1$ | | $\sin\left(x^2-4\right)$ | $\sin u$ | $x^2-4$ | | $e^{\cos x}$ | $e^u$ | $\cos x$ | | $\sqrt{3x+1}$ | $\sqrt u$ | $3x+1$ | | $\frac{1}{3x-2}$ | $u^{-1}$ | $3x-2$ | | $\sin^5x$ | $u^5$ | $\sin x$ | **The order matters.** $f(g(x))$ is not $g(f(x))$: $\sin\left(x^2\right)$ puts the square inside the sine, while $\sin^2x=(\sin x)^2$ puts the sine inside the square. At $x=2$ they are $\sin4\approx-0.757$ and $\sin^22\approx0.827$. **More than two layers.** The function $\tan\left(5-\sin2x\right)$ is a tangent of $5-\sin2x$, which is $5$ minus a sine of $2x$, which is twice $x$. Peeling it like an onion gives four layers: tangent, "$5$ minus", sine, and "twice". Each layer will cost one factor in the derivative. **Not every combination is a composition.** $x^2\sin x$ is a product of two functions of $x$, and $x^2+\sin x$ is a sum: neither puts one function inside the other, so the [product rule](https://nunada.my.id/articles/differentiation-rules/#product-rule) and the sum rule are the ones to use. A function can need both, as $x\sin2x$ does. ## What is the chain rule? **The chain rule says that if $g$ is differentiable at $x$ and $f$ is differentiable at $g(x)$, then $f\circ g$ is differentiable at $x$ and $(f\circ g)'(x)=f'(g(x))\cdot g'(x)$.** In Leibniz's notation, with $y=f(u)$ and $u=g(x)$, $$\frac{dy}{dx}=\frac{dy}{du}\cdot\frac{du}{dx},$$ where $\frac{dy}{du}$ is evaluated at $u=g(x)$. **Why rates multiply.** Three gears are meshed in a line. When gear A turns $x$ times, gear B turns $u=3x$ times, because B turns three times for each turn of A, and gear C turns $y=\frac{u}{2}$ times, because C turns half a turn for each turn of B. So $y=\frac{3x}{2}$ and $$\frac{dy}{dx}=\frac32=\frac12\cdot3=\frac{dy}{du}\cdot\frac{du}{dx}.$$ If $y$ changes half as fast as $u$ and $u$ changes three times as fast as $x$, then $y$ changes $\frac32$ times as fast as $x$. For curves the same is true instant by instant: the slope of the composite at $x$ is the rate of the outside at the point $g(x)$ that the inside has reached times the rate of the inside at $x$. **The outside-inside rule.** In words: differentiate the outside function and evaluate it at the inside function left alone, then multiply by the derivative of the inside function. The Leibniz form hides where each derivative is evaluated; the functional form $f'(g(x))\cdot g'(x)$ shows it: $f'$ at $g(x)$, not at $x$. **Example 1.** Find the derivative of $y=\left(3x^2+1\right)^2$. The outside is $y=u^2$ and the inside is $u=3x^2+1$, so $\frac{dy}{du}=2u=2\left(3x^2+1\right)$ and $\frac{du}{dx}=6x$: $$\frac{dy}{dx}=2\left(3x^2+1\right)\cdot6x=36x^3+12x.$$ Expanding first gives $y=9x^4+6x^2+1$ and the same $36x^3+12x$. The chain rule is not needed for this one, but it is for $\left(3x^2+1\right)^{50}$. **Example 2.** A body moves along a line with position $x(t)=\cos\left(t^2+1\right)$ at time $t\ge0$. The outside is $\cos u$, with derivative $-\sin u$, and the inside is $u=t^2+1$, with derivative $2t$. The velocity is $$v=-\sin\left(t^2+1\right)\cdot2t$$ $$=-2t\sin\left(t^2+1\right).$$ **A proof of one case, and its gap.** Let $\Delta u=g(x+\Delta x)-g(x)$ and $\Delta y=f(u+\Delta u)-f(u)$. If $\Delta u\ne0$ we can write $$\frac{\Delta y}{\Delta x}=\frac{\Delta y}{\Delta u}\cdot\frac{\Delta u}{\Delta x}.$$ As $\Delta x\to0$ we also have $\Delta u\to0$, because $g$ is continuous, so the right side tends to $f'(u)\cdot g'(x)$. The gap is that if $g$ oscillates rapidly near $x$, $\Delta u$ can be $0$ even when $\Delta x\ne0$, and then the cancellation is not allowed. A complete proof avoids dividing by $\Delta u$: it writes $\Delta y=\left(f'(u)+\varepsilon\right)\Delta u$, where $\varepsilon\to0$ as $\Delta u\to0$ and $\varepsilon=0$ when $\Delta u=0$. That form is true in every case. Pick an outside function and an inside function below, slide $x$, and compare the product of the two rates with the slope of the graph of the composite. ## How do you differentiate sin u, e^u and other functions of a function? **For any differentiable function $u(x)$, each formula for $x$ gets one extra factor $\frac{du}{dx}$: $\frac{d}{dx}\sin u=\cos u\cdot\frac{du}{dx}$, $\frac{d}{dx}\cos u=-\sin u\cdot\frac{du}{dx}$, $\frac{d}{dx}e^u=e^u\cdot\frac{du}{dx}$, and so on.** The chain rule turns the table of [the derivatives of trigonometric functions](https://nunada.my.id/articles/derivatives-of-trigonometric-functions/#other-four) into one for any inside function: - $\frac{d}{dx}\sin u=\cos u\cdot u'$ and $\frac{d}{dx}\cos u=-\sin u\cdot u'$; - $\frac{d}{dx}\tan u=\sec^2u\cdot u'$ and $\frac{d}{dx}\cot u=-\csc^2u\cdot u'$; - $\frac{d}{dx}\sec u=\sec u\tan u\cdot u'$ and $\frac{d}{dx}\csc u=-\csc u\cot u\cdot u'$; - $\frac{d}{dx}e^u=e^u\cdot u'$. **Example 3.** Differentiate $\sin\left(x^2+e^x\right)$. The outside is the sine, the inside is $x^2+e^x$, and the inside has derivative $2x+e^x$: $$\frac{d}{dx}\sin\left(x^2+e^x\right)$$ $$=\cos\left(x^2+e^x\right)\cdot\left(2x+e^x\right).$$ **Example 4.** Differentiate $y=e^{\cos x}$. The outside is the exponential, and its derivative at the inside $\cos x$ is $e^{\cos x}$ again. The inside has derivative $-\sin x$: $$\frac{dy}{dx}=e^{\cos x}\cdot(-\sin x)=-\sin x\,e^{\cos x}.$$ **A constant inside.** For a constant $k$ the inside $kx$ has derivative $k$, so $$\frac{d}{dx}e^{kx}=k\,e^{kx}$$ $$\frac{d}{dx}\sin(kx)=k\cos(kx)$$ $$\frac{d}{dx}\tan(4x)=4\sec^2(4x).$$ Also $\frac{d}{dx}e^{x^2}=e^{x^2}\cdot2x$ and $\frac{d}{dx}\sec\left(x^2\right)=2x\sec\left(x^2\right)\tan\left(x^2\right)$. The chain rule works together with the other rules: for $x\sin2x$ the product rule gives $\sin2x+x\cdot\frac{d}{dx}\sin2x=\sin2x+2x\cos2x$. Type any function below built from these pieces, and read off each rule it uses, with its outside and inside function. ## What do you do when functions are nested three or more deep? **Apply the chain rule once for each layer, from the outside in: differentiate the outermost function with everything inside left alone, multiply by the derivative of what was inside, and repeat on that until the inside is just $x$.** Write the layers down first, and the derivative is a product with one factor for each of them. **Example 5.** Find the derivative of $g(t)=\tan\left(5-\sin2t\right)$. The tangent is a function of $5-\sin2t$; the sine is a function of $2t$, which is itself a function of $t$. Peel the layers: $$g'(t)=\sec^2\left(5-\sin2t\right)$$ $$\cdot\frac{d}{dt}\left(5-\sin2t\right)$$ $$=\sec^2\left(5-\sin2t\right)$$ $$\cdot\left(-\cos2t\cdot\frac{d}{dt}(2t)\right)$$ $$=-2\cos2t\,\sec^2\left(5-\sin2t\right).$$ **Example 6.** The function $\sin\left(\cos(\tan x)\right)$ has three layers, so three factors: $$\frac{d}{dx}\sin\left(\cos(\tan x)\right)$$ $$=\cos\left(\cos(\tan x)\right)$$ $$\cdot\left(-\sin(\tan x)\right)\cdot\sec^2x.$$ Each factor is the derivative of one layer with the layers inside it left alone: the cosine of the cosine, the minus sine of the tangent, and the secant squared. **Example 7.** For $y=\sqrt{1+\cos^2x}$ the layers are a square root, "$1$ plus", a square, and a cosine: $$y'=\frac{1}{2\sqrt{1+\cos^2x}}\cdot2\cos x\cdot(-\sin x)$$ $$=-\frac{\sin x\cos x}{\sqrt{1+\cos^2x}}.$$ Try the function of Example 5, and any of your own, in the tool of the previous section: it lists one chain rule step for each layer. ## What is the power chain rule, and when does it replace the quotient rule? **If $u$ is a differentiable function of $x$ and $n$ is any real number, then $\frac{d}{dx}u^n=n\,u^{n-1}\,\frac{du}{dx}$.** This is the chain rule with the outside function $f(u)=u^n$, whose derivative is the [power rule](https://nunada.my.id/articles/differentiation-rules/#constants-and-powers) $nu^{n-1}$. The inside function $u$ may be any function: a sum, a sine, a quotient. **Example 8.** Four derivatives with the power chain rule. - $\frac{d}{dx}\left(5x^3-x^4\right)^7=7\left(5x^3-x^4\right)^6\cdot\left(15x^2-4x^3\right)$. - $\frac{d}{dx}\frac{1}{3x-2}=\frac{d}{dx}(3x-2)^{-1}=-(3x-2)^{-2}\cdot3=-\frac{3}{(3x-2)^2}$. The [quotient rule](https://nunada.my.id/articles/differentiation-rules/#quotient-rule) gives the same answer, with more writing. - $\frac{d}{dx}\sin^5x=5\sin^4x\cdot\cos x$, because $\sin^5x$ means $(\sin x)^5$. - $\frac{d}{dx}e^{\sqrt{3x+1}}=e^{\sqrt{3x+1}}\cdot\frac{d}{dx}(3x+1)^{1/2}=e^{\sqrt{3x+1}}\cdot\frac{3}{2\sqrt{3x+1}}$. Two layers sit inside the exponential, so there are two chain steps. **Example 9: the absolute value.** Since $|x|=\sqrt{x^2}$, the power chain rule with $u=x^2$ and $n=\frac12$ gives, for $x\ne0$, $$\frac{d}{dx}|x|=\frac12\left(x^2\right)^{-1/2}\cdot2x$$ $$=\frac{x}{\sqrt{x^2}}=\frac{x}{|x|}.$$ That is $1$ for $x>0$ and $-1$ for $x<0$. At $x=0$ the formula is undefined, which agrees with the corner of the graph, a point [where there is no derivative](https://nunada.my.id/articles/tangent-lines-and-derivative-at-a-point/#no-derivative). **Example 10: always uphill.** Show that every tangent line to $y=\frac{1}{(1-2x)^3}$ has a positive slope. Write $y=(1-2x)^{-3}$. Then $$\frac{dy}{dx}=-3(1-2x)^{-4}\cdot(-2)=\frac{6}{(1-2x)^4}.$$ At any point of the curve $x\ne\frac12$, so the denominator is a fourth power and positive: the slope is a quotient of two positive numbers. **Another useful one.** $\frac{d}{dx}\sqrt{x^2+1}=\frac{1}{2\sqrt{x^2+1}}\cdot2x=\frac{x}{\sqrt{x^2+1}}$, which is the slope of the curve whose points are $\sqrt{x^2+1}$ above the axis, a hyperbola. ## How does the chain rule explain frequency, amplitude and degrees? **A constant $k$ inside a sine multiplies the derivative by $k$: $\frac{d}{dx}\sin(kx)=k\cos(kx)$, so a wave that oscillates $k$ times as fast is $k$ times as steep.** The inside function $kx$ has derivative $k$, and nothing else changes. The curves $y=\sin x$, $y=\sin2x$ and $y=\sin\frac{x}{2}$ cross the axis at the origin with slopes $1$, $2$ and $\frac12$. *sin x (green), sin 2x (orange) and sin(x/2) (blue): at the origin the slopes are 1, 2 and 1/2, the constant inside.* **Higher derivatives.** Each derivative of $\sin(kx)$ brings out one more factor $k$, so the derivatives follow the [cycle of four](https://nunada.my.id/articles/derivatives-of-trigonometric-functions/#higher-trig-derivatives) with $k^n$ in front: $k\cos(kx)$, then $-k^2\sin(kx)$, then $-k^3\cos(kx)$, then $k^4\sin(kx)$. **A piston.** Let a piston's position be $s=A\cos(2\pi bt)$, with amplitude $A$ and frequency $b$ cycles per second. Put $w=2\pi b$. Then $$v=-wA\sin(wt)$$ $$a=-w^2A\cos(wt)$$ $$j=w^3A\sin(wt),$$ so the greatest velocity, acceleration and jerk are $wA$, $w^2A$ and $w^3A$. **Doubling the frequency doubles the velocity, quadruples the acceleration and multiplies the jerk by $8$.** This is why machinery can break when it is run too fast: the forces, which follow the acceleration, grow with the square of the speed of the motion. The [motion along a line](https://nunada.my.id/articles/the-derivative-as-a-rate-of-change/#motion-along-a-line) of the spring is the case $b=\frac{1}{2\pi}$. **Temperature in Fairbanks, Alaska.** The average temperature on day $x$ of the year, in degrees Celsius, is approximately $$y=20\sin\left(\frac{2\pi}{365}(x-101)\right)-4.$$ By the chain rule its rate of change is $$y'=\frac{40\pi}{365}\cos\left(\frac{2\pi}{365}(x-101)\right).$$ The temperature is rising fastest when the cosine equals $1$, at $x=101$, which is April 11, and then it rises $\frac{40\pi}{365}\approx0.34$ degrees per day. The factor $\frac{40\pi}{365}$ is the amplitude $20$ times the constant inside, $\frac{2\pi}{365}$. **Degrees.** Since $x^\circ=\frac{\pi x}{180}$ radians, the inside function of $\sin\left(x^\circ\right)$ is $\frac{\pi x}{180}$, and $$\frac{d}{dx}\sin\left(x^\circ\right)=\frac{\pi}{180}\cos\left(x^\circ\right).$$ The sine of $x$ degrees oscillates only $\frac{\pi}{180}\approx0.01745$ times as often as $\sin x$, and its greatest slope is $\frac{\pi}{180}$. The factor would appear again in every derivative, which is the advantage of radian measure that the [limit of sin h over h](https://nunada.my.id/articles/derivatives-of-trigonometric-functions/#sine-limits) already showed. Change $k$, switch to degrees, or double the frequency of the piston below. ## How do you find the second derivative of a composite function? **Differentiate $f'(g(x))\cdot g'(x)$ with the product rule, and the chain rule on its first factor, and you get $(f\circ g)''=f''(g(x))\cdot\left(g'(x)\right)^2+f'(g(x))\cdot g''(x)$.** Here is the step. The first derivative is $y'=f'(g)\,g'$. The product rule gives $$y''=\left(\frac{d}{dx}f'(g)\right)g'+f'(g)\,g''.$$ By the chain rule $\frac{d}{dx}f'(g)=f''(g)\,g'$, so the first term is $f''(g)\,g'\cdot g'=f''(g)\left(g'\right)^2$. There are two terms because the inside function enters twice: once through its rate $g'$ and once through its own rate of change $g''$. **Example 11.** Find $y''$ for $y=\sin\left(x^2\right)$. With $f=\sin$ and $g=x^2$: $f'(g)=\cos\left(x^2\right)$, $g'=2x$, $f''(g)=-\sin\left(x^2\right)$, $g''=2$. So $$y'=2x\cos\left(x^2\right),$$ $$y''=-\sin\left(x^2\right)\cdot4x^2+\cos\left(x^2\right)\cdot2$$ $$=2\cos\left(x^2\right)-4x^2\sin\left(x^2\right).$$ **Example 12.** For $y=\left(x^2+1\right)^3$ take $f=u^3$ and $g=x^2+1$: $f'=3u^2$, $f''=6u$, $g'=2x$, $g''=2$. Then $$y''=6\left(x^2+1\right)\cdot4x^2$$ $$+3\left(x^2+1\right)^2\cdot2$$ $$=30x^4+36x^2+6.$$ Expanding first gives $y=x^6+3x^4+3x^2+1$ and $y''=30x^4+36x^2+6$, the same. **The common slip** is to write $f''(g)\cdot g''$ for the second derivative. The term $f'(g)\,g''$ is lost, and the factor $\left(g'\right)^2$ too. If the inside is a straight line $g=ax+b$, then $g''=0$ and only $f''(g)\cdot a^2$ is left: that is why $\frac{d^2}{dx^2}\sin(kx)=-k^2\sin(kx)$. The tool of the section on nested functions also shows second and third derivatives of what you type. ## When does the chain rule apply, and what happens when it does not? **The chain rule is an if statement: if the inside function is differentiable at $x$ and the outside function is differentiable at $g(x)$, then the composite is differentiable and the formula holds.** It does not say what happens when a hypothesis fails, and in that case the composite may or may not be differentiable. **Example 13: the inside is not differentiable, the composite is.** Let $f(x)=x^2$ and $g(x)=|x|$. Both $f\circ g$ and $g\circ f$ equal $x^2$, because $|x|^2=x^2$ and $\left|x^2\right|=x^2$, and both are differentiable at $x=0$ although $g=|x|$ is not. This does not contradict the chain rule: the rule needs $g$ to be differentiable at $0$, it does not say the composite is not differentiable otherwise. **A derivative that is not continuous.** Consider $f(x)=x^2\sin\frac1x$ for $x\ne0$, with $f(0)=0$. For $x\ne0$ the chain rule on $\sin\frac1x$ and the product rule give $$f'(x)=2x\sin\frac1x-\cos\frac1x.$$ At $x=0$ the inside function $\frac1x$ does not exist, so the chain rule cannot be used; we go back to the definition. The quotient is $\frac{h^2\sin(1/h)}{h}=h\sin\frac1h$, and since $\left|h\sin\frac1h\right|\le|h|$ it tends to $0$: $f'(0)=0$. Yet $f'(x)$ has no limit as $x\to0$, because $\cos\frac1x$ oscillates between $-1$ and $1$. So $f$ is differentiable everywhere, and its derivative is not continuous at $0$. **A function that is continuous but has no derivative.** For $x\sin\frac1x$ (and $0$ at $0$) the quotient at $0$ is $\sin\frac1h$, which oscillates and has no limit: the function is continuous at $0$ and not differentiable there. This is the kind of rapid oscillation that caused the gap in the proof of the chain rule. ## How do you apply the chain rule in code? **SymPy applies the chain rule to any composite function: `sp.diff(sp.sin(2x), x)` gives `2cos(2*x)`, and `sp.diff(f, x, 2)` gives the second derivative.** It writes $\sec^2u$ as `tan(u)**2 + 1`, the same function. The numbers of the examples above come out as they should: `(3*x**2 + 1)**2` has the derivative `12x(3*x**2 + 1)`, and `sp.simplify` turns the derivative of `(5*x**3 - x**4)**7` into `x**20(105 - 28x)*(x - 5)**6`, which is $7\left(5x^3-x^4\right)^6\left(15x^2-4x^3\right)$ with the common factors collected. ```python import sympy as sp x = sp.symbols('x') for f in (sp.sin(2 * x), (3 * x**2 + 1) ** 2, sp.exp(sp.cos(x)), sp.sin(x**2 + sp.exp(x)), sp.sqrt(3 * x + 1), sp.tan(5 - sp.sin(2 * x))): print(f, '->', sp.diff(f, x)) # sin(2*x) -> 2*cos(2*x) # (3*x**2 + 1)**2 -> 12*x*(3*x**2 + 1) # exp(cos(x)) -> -exp(cos(x))*sin(x) # sin(x**2 + exp(x)) -> (2*x + exp(x))*cos(x**2 + exp(x)) # sqrt(3*x + 1) -> 3/(2*sqrt(3*x + 1)) # -tan(sin(2*x) - 5) -> -2*(tan(sin(2*x) - 5)**2 + 1)*cos(2*x) print(sp.diff(sp.sin(x**2), x, 2)) # 2*(-2*x**2*sin(x**2) + cos(x**2)) print(sp.simplify(sp.diff((5 * x**3 - x**4) ** 7, x))) # x**20*(105 - 28*x)*(x - 5)**6 ``` **A program can apply the chain rule to numbers instead of formulas.** Carry with every value its derivative, a pair $(v,d)$, and give each operation its chain rule: for the sine, $(v,d)\mapsto\left(\sin v,\ \cos v\cdot d\right)$, which is $f'(u)\cdot u'$ again. Start with $x=(0.7,1)$, because $x$ has derivative $1$, and the program computes $\sin\left(x^2+e^x\right)$ and its derivative at the same time. This is forward-mode automatic differentiation. It gives $-2.742554$, the same as the formula $\cos\left(x^2+e^x\right)\left(2x+e^x\right)$ at $x=0.7$ and the same as a central difference. Applying the rule from the outside in, to a program of millions of steps, is reverse-mode automatic differentiation, which is what backpropagation in a neural network does: one pass computes the output, and one pass back multiplies the rates of the layers. ```python import math f = lambda x: math.sin(x**2 + math.exp(x)) x0 = 0.7 chain = math.cos(x0**2 + math.exp(x0)) * (2 * x0 + math.exp(x0)) # the formula central = (f(x0 + 1e-6) - f(x0 - 1e-6)) / 2e-6 # a difference quotient print(round(chain, 6), round(central, 6)) # -2.742554 -2.742554 class Dual: """A number and its derivative, carried together.""" def __init__(self, v, d=0.0): self.v, self.d = v, d def __add__(self, o): o = o if isinstance(o, Dual) else Dual(o) return Dual(self.v + o.v, self.d + o.d) __radd__ = __add__ def __mul__(self, o): o = o if isinstance(o, Dual) else Dual(o) return Dual(self.v * o.v, self.d * o.v + self.v * o.d) # the product rule __rmul__ = __mul__ def sin(u): return Dual(math.sin(u.v), math.cos(u.v) * u.d) # the chain rule: f'(u) * u' def exp(u): return Dual(math.exp(u.v), math.exp(u.v) * u.d) x = Dual(0.7, 1.0) # x has derivative 1 y = sin(x * x + exp(x)) print(round(y.v, 6), round(y.d, 6)) # 0.595461 -2.742554 ``` ```cpp #include #include #include using namespace std; // A dual number is {value, derivative}: the two travel together through every operation. void add(const double a[], const double b[], double r[]) { r[0] = a[0] + b[0]; r[1] = a[1] + b[1]; } void mul(const double a[], const double b[], double r[]) { r[0] = a[0] * b[0]; r[1] = a[1] * b[0] + a[0] * b[1]; // the product rule } void dsin(const double u[], double r[]) { r[0] = sin(u[0]); r[1] = cos(u[0]) * u[1]; } // the chain rule: f'(u) u' void dexp(const double u[], double r[]) { r[0] = exp(u[0]); r[1] = exp(u[0]) * u[1]; } double f(double x) { return sin(x * x + exp(x)); } int main() { double x0 = 0.7; double chain = cos(x0 * x0 + exp(x0)) * (2 * x0 + exp(x0)); // the formula double central = (f(x0 + 1e-6) - f(x0 - 1e-6)) / 2e-6; // a difference quotient printf("%.6f %.6f\n", chain, central); double x[2] = {0.7, 1}; // x has derivative 1 double xx[2], e[2], s[2], y[2]; mul(x, x, xx); dexp(x, e); add(xx, e, s); dsin(s, y); // y = sin(x * x + exp(x)) printf("%.6f %.6f\n", y[0], y[1]); return 0; } /* output: -2.742554 -2.742554 0.595461 -2.742554 */ ``` ## Who discovered the chain rule, and how was it first proved? **The chain rule is as old as the calculus, but a proof that has no gap took about two centuries more.** - **Leibniz.** The chain rule seems to have been used first by Gottfried Leibniz, in a manuscript of 1676, to differentiate the square root of $a+bz+cz^2$ as a square root of a quadratic. His notation $\frac{dy}{dx}=\frac{dy}{du}\cdot\frac{du}{dx}$ makes the rule look like fractions that cancel, which is why it is easy to remember, and why it is not a proof. - **Bernoulli and l'Hôpital.** Johann Bernoulli taught the new calculus to the Marquis de l'Hôpital, whose 1696 textbook Analyse des infiniment petits spread it across Europe. - **Lagrange.** The prime notation $f'(x)$, which writes the chain rule as $f'(g(x))\cdot g'(x)$ and shows where each derivative is taken, was introduced by Joseph-Louis Lagrange. - **A proof without the gap.** In the 20th century Constantin Carathéodory's way of defining the derivative, $f(x)-f(a)=\varphi(x)(x-a)$ with $\varphi$ continuous at $a$, gave a short proof of the chain rule that never divides by $\Delta u$. - **Backpropagation.** Applying the rule from the output back to the input of a computation, in reverse mode, was described by Seppo Linnainmaa in 1970, and David Rumelhart, Geoffrey Hinton and Ronald Williams made it the standard way of training neural networks in 1986. ## What mistakes do people make with the chain rule? **The most common mistakes with the chain rule are the nine below, each with the correct statement.** | Mistake | Correct | |---|---| | ❌ $\frac{d}{dx}\sin2x=\cos2x$ | The derivative of the inside is a factor: $\frac{d}{dx}\sin2x=2\cos2x$. | | ❌ $\frac{d}{dx}\left(x^2+1\right)^5=5\left(x^2+1\right)^4$ | The power rule gives only the outside: multiply by $2x$ to get $10x\left(x^2+1\right)^4$. | | ❌ $\frac{d}{dx}e^{2x}=2x\,e^{2x-1}$ | The exponent contains $x$, so the power rule does not apply. The derivative of $e^u$ is $e^u\cdot u'$, which is $2e^{2x}$. | | ❌ $\frac{d}{dx}\cos\left(x^2\right)=-\sin x\cdot2x$ | The outside derivative is evaluated at the inside, not at $x$: $-\sin\left(x^2\right)\cdot2x$. | | ❌ $\frac{d}{dx}\sin^2x=2\sin x$ | There are two layers, a square and a sine: $2\sin x\cdot\cos x$. | | ❌ The second derivative of $f(g(x))$ is $f''(g(x))\cdot g''(x)$ | It is $f''(g)\left(g'\right)^2+f'(g)\,g''$: the second term and the square were lost. | | ❌ $(f\circ g)'=f'\circ g'$, the composition of the derivatives | It is a product: $f'(g(x))\cdot g'(x)$, with $f'$ taken at $g(x)$. | | ❌ If $g$ is not differentiable at $a$, then $f(g(x))$ is not either | Not necessarily: with $g=|x|$ and $f=x^2$ the composite is $x^2$, differentiable at $0$. | | ❌ $\frac{d}{dx}\sin\left(x^\circ\right)=\cos\left(x^\circ\right)$ | The inside $\frac{\pi x}{180}$ adds a factor: $\frac{\pi}{180}\cos\left(x^\circ\right)$. | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: the chain rule at a glance - **The rule:** $(f\circ g)'(x)=f'(g(x))\cdot g'(x)$, or $\frac{dy}{dx}=\frac{dy}{du}\cdot\frac{du}{dx}$: differentiate the outside with the inside left alone, then multiply by the derivative of the inside. - **Layers:** find the outside by asking what is done last to $x$; with three or more layers, one factor for each, from the outside in. - **Formulas:** $(\sin u)'=\cos u\cdot u'$, $(e^u)'=e^u\cdot u'$, $\left(u^n\right)'=n\,u^{n-1}u'$, and likewise for the other functions. - **Constants inside:** $\frac{d}{dx}\sin(kx)=k\cos(kx)$; doubling a piston's frequency multiplies velocity, acceleration and jerk by $2$, $4$, $8$; in degrees the factor is $\frac{\pi}{180}$. - **Second derivative:** $f''(g)\left(g'\right)^2+f'(g)\,g''$. - **Limits of the rule:** both functions must be differentiable where used; a composite can be differentiable when the inside is not, as $|x|^2$ is. - **Code:** `sp.diff` for formulas; a pair $(v,d)$ with $f'(u)\cdot u'$ for numbers. ## Glossary: key terms - **Composite function**: A function formed by applying one function to the output of another, written f of g of x, where the inside function g is applied first and the outside function f last. - **Inside function**: The function in a composite that is applied first, so that its output is the input of the outside function; it is the u in y equals f of u. - **Outside function**: The function in a composite that is applied last, to the result of the inside function; it is the f in y equals f of u. - **Chain rule**: The rule that the derivative of a composite function is the derivative of the outside function evaluated at the inside function, times the derivative of the inside function. - **Power chain rule**: The chain rule for a power of a function: the derivative of u to the n is n times u to the n minus 1 times the derivative of u. - **Frequency**: The number of complete cycles an oscillation makes per unit of time; in the sine of 2 pi b t it is b, and every derivative multiplies the motion by 2 pi b. - **Automatic differentiation**: A way of computing exact derivatives of a program by carrying a derivative along with every value and applying the chain rule at every operation. ## Frequently asked questions ### What is the chain rule in calculus? The chain rule gives the derivative of a composite function. It says to differentiate the outside function at the inside function and multiply by the derivative of the inside function, so the derivative of f of g of x is f prime of g of x times g prime of x. ### How do you know when to use the chain rule? Use it when one function is put inside another, such as sine of two x, e to the x squared or a power of a sum. If the last operation done to x is a function applied to an expression, and not a sum or product of separate pieces, there is a chain. ### What is the outside-inside rule? It is the chain rule in words: differentiate the outside function and evaluate it at the inside function left alone, then multiply by the derivative of the inside function. It reminds you that the outside derivative is evaluated at the inside, not at x. ### What is the derivative of sin 2x? It is two cosine of two x. The outside function is sine, whose derivative is cosine evaluated at two x, and the inside function two x has derivative 2, so the factor 2 comes out in front. Forgetting it is the most common mistake. ### What is the derivative of e to the x squared? It is two x times e to the x squared. The derivative of e to the u is e to the u times the derivative of u, and here u is x squared with derivative two x. The power rule does not apply to an exponent that contains x. ### How do you use the chain rule more than once? Work from the outside in, one layer at a time. Differentiate the outermost function with everything inside it left alone, multiply by the derivative of what was inside, and apply the rule again to that, until the inside is just x. Each layer gives one factor. ### What is the power chain rule? It is the chain rule for a power of a function: the derivative of u to the n is n times u to the n minus one times the derivative of u. It handles powers of sums, reciprocals and square roots of any expression. ### What is the second derivative of a composite function? It is f double prime of g times the square of g prime, plus f prime of g times g double prime. The product rule makes two terms, and the chain rule on f prime of g supplies the extra factor g prime in the first one. ### Does the chain rule work if the inside function is not differentiable? The rule itself needs the inside function to be differentiable where it is used. The composite may still be differentiable, though: the square of the absolute value of x is x squared, which has a derivative at zero even though the absolute value does not. --- # Aturan Rantai Source: https://nunada.my.id/artikel/aturan-rantai/ Updated: 2026-10-15 ## Jawaban singkat **Aturan rantai menyatakan bahwa turunan suatu fungsi komposit adalah turunan fungsi luar, dihitung pada fungsi dalam, dikali turunan fungsi dalam: $(f\circ g)'(x)=f'(g(x))\cdot g'(x)$.** Dalam notasi Leibniz, dengan $y=f(u)$ dan $u=g(x)$, ia berbunyi $\frac{dy}{dx}=\frac{dy}{du}\cdot\frac{du}{dx}$: laju perubahan saling dikalikan. Itulah sebabnya $\frac{d}{dx}\sin 2x=2\cos 2x$ dan $\frac{d}{dx}e^{x^2}=2x\,e^{x^2}$. ### Poin penting - Fungsi komposit $f(g(x))$ memasukkan fungsi dalam $g$ ke fungsi luar $f$; fungsi luar adalah hal terakhir yang dilakukan pada $x$, dan menemukan kedua lapisan itu adalah langkah pertama setiap soal aturan rantai. - $\frac{dy}{dx}=\frac{dy}{du}\cdot\frac{du}{dx}$: jika $y$ berubah separuh secepat $u$ dan $u$ berubah tiga kali secepat $x$, maka $y$ berubah $\frac32$ kali secepat $x$, seperti rangkaian roda gigi. - Aturan luar-dalam: turunkan fungsi luar dan biarkan fungsi dalam apa adanya, lalu kalikan dengan turunan fungsi dalam; misalnya $\frac{d}{dx}e^u=e^u\frac{du}{dx}$ dan $\frac{d}{dx}\sin u=\cos u\,\frac{du}{dx}$. - Aturan rantai pangkat $\frac{d}{dx}u^n=n\,u^{n-1}\frac{du}{dx}$ menangani $\left(5x^3-x^4\right)^7$, $\frac{1}{3x-2}$, $\sin^5x$, dan $\sqrt{3x+1}$, dan memberi $\frac{d}{dx}|x|=\frac{x}{|x|}$ untuk $x\ne0$. - Konstanta $k$ di dalam sinus memunculkan faktor $k$: menggandakan frekuensi piston menggandakan kecepatannya, melipatempatkan percepatannya, dan mengalikan sentakannya dengan $8$; dalam derajat faktornya $\frac{\pi}{180}$. - Turunan kedua fungsi komposit adalah $f''(g)\,(g')^2+f'(g)\,g''$, bukan $f''(g)\,g''$; dan aturan ini memerlukan kedua fungsi terdiferensialkan di tempat ia dipakai. ## Apa itu fungsi komposit, dan bagaimana menemukan fungsi dalam dan luarnya? **Fungsi komposit menerapkan satu fungsi pada hasil fungsi lain: $(f\circ g)(x)=f(g(x))$, dengan $g$ adalah fungsi dalam, diterapkan lebih dulu, dan $f$ adalah fungsi luar, diterapkan terakhir.** Fungsi $F(x)=\sin\left(x^2-4\right)$ adalah jenis ini. Ia tidak dapat diturunkan dengan [aturan-aturan sejauh ini](https://nunada.my.id/artikel/aturan-turunan/#product-rule), tetapi ia dibangun dari dua fungsi yang dapat: fungsi luar $f(u)=\sin u$ dan fungsi dalam $u=g(x)=x^2-4$. Untuk menemukan lapisannya, tanyakan apa hal terakhir yang dilakukan pada $x$? Itulah fungsi luar. Apa yang dikenainya adalah fungsi dalam. | Fungsi | Luar $f(u)$ | Dalam $u=g(x)$ | |---|---|---| | $\left(3x^2+1\right)^2$ | $u^2$ | $3x^2+1$ | | $\sin\left(x^2-4\right)$ | $\sin u$ | $x^2-4$ | | $e^{\cos x}$ | $e^u$ | $\cos x$ | | $\sqrt{3x+1}$ | $\sqrt u$ | $3x+1$ | | $\frac{1}{3x-2}$ | $u^{-1}$ | $3x-2$ | | $\sin^5x$ | $u^5$ | $\sin x$ | **Urutannya penting.** $f(g(x))$ bukan $g(f(x))$: $\sin\left(x^2\right)$ menaruh kuadrat di dalam sinus, sedangkan $\sin^2x=(\sin x)^2$ menaruh sinus di dalam kuadrat. Di $x=2$ keduanya $\sin4\approx-0{,}757$ dan $\sin^22\approx0{,}827$. **Lebih dari dua lapisan.** Fungsi $\tan\left(5-\sin2x\right)$ adalah tangen dari $5-\sin2x$, yaitu $5$ dikurangi sinus dari $2x$, yaitu dua kali $x$. Mengupasnya seperti bawang memberi empat lapisan: tangen, "$5$ dikurangi", sinus, dan "dua kali". Tiap lapisan akan menambah satu faktor pada turunannya. **Tidak setiap kombinasi adalah komposisi.** $x^2\sin x$ adalah hasil kali dua fungsi dari $x$, dan $x^2+\sin x$ adalah jumlah: keduanya tidak menaruh satu fungsi di dalam fungsi lain, sehingga [aturan hasil kali](https://nunada.my.id/artikel/aturan-turunan/#product-rule) dan aturan jumlahlah yang dipakai. Satu fungsi dapat memerlukan keduanya, seperti $x\sin2x$. ## Apa itu aturan rantai? **Aturan rantai menyatakan bahwa jika $g$ terdiferensialkan di $x$ dan $f$ terdiferensialkan di $g(x)$, maka $f\circ g$ terdiferensialkan di $x$ dan $(f\circ g)'(x)=f'(g(x))\cdot g'(x)$.** Dalam notasi Leibniz, dengan $y=f(u)$ dan $u=g(x)$, $$\frac{dy}{dx}=\frac{dy}{du}\cdot\frac{du}{dx},$$ dengan $\frac{dy}{du}$ dihitung pada $u=g(x)$. **Mengapa laju saling dikalikan.** Tiga roda gigi dipasang berderet. Saat roda A berputar $x$ kali, roda B berputar $u=3x$ kali, karena B berputar tiga kali untuk tiap putaran A, dan roda C berputar $y=\frac{u}{2}$ kali, karena C berputar setengah putaran untuk tiap putaran B. Jadi $y=\frac{3x}{2}$ dan $$\frac{dy}{dx}=\frac32=\frac12\cdot3=\frac{dy}{du}\cdot\frac{du}{dx}.$$ Jika $y$ berubah separuh secepat $u$ dan $u$ berubah tiga kali secepat $x$, maka $y$ berubah $\frac32$ kali secepat $x$. Untuk kurva hal yang sama berlaku saat demi saat: gradien komposit di $x$ adalah laju fungsi luar di titik $g(x)$ yang telah dicapai fungsi dalam dikali laju fungsi dalam di $x$. **Aturan luar-dalam.** Dengan kata-kata: turunkan fungsi luar dan hitung pada fungsi dalam yang dibiarkan apa adanya, lalu kalikan dengan turunan fungsi dalam. Bentuk Leibniz menyembunyikan di mana tiap turunan dihitung; bentuk fungsional $f'(g(x))\cdot g'(x)$ menunjukkannya: $f'$ di $g(x)$, bukan di $x$. **Contoh 1.** Tentukan turunan $y=\left(3x^2+1\right)^2$. Fungsi luarnya $y=u^2$ dan fungsi dalamnya $u=3x^2+1$, sehingga $\frac{dy}{du}=2u=2\left(3x^2+1\right)$ dan $\frac{du}{dx}=6x$: $$\frac{dy}{dx}=2\left(3x^2+1\right)\cdot6x=36x^3+12x.$$ Menjabarkan lebih dulu memberi $y=9x^4+6x^2+1$ dan $36x^3+12x$ yang sama. Aturan rantai tidak diperlukan untuk yang satu ini, tetapi diperlukan untuk $\left(3x^2+1\right)^{50}$. **Contoh 2.** Sebuah benda bergerak sepanjang garis lurus dengan posisi $x(t)=\cos\left(t^2+1\right)$ pada waktu $t\ge0$. Fungsi luarnya $\cos u$, berturunan $-\sin u$, dan fungsi dalamnya $u=t^2+1$, berturunan $2t$. Kecepatannya $$v=-\sin\left(t^2+1\right)\cdot2t$$ $$=-2t\sin\left(t^2+1\right).$$ **Bukti satu kasus, dan celahnya.** Misalkan $\Delta u=g(x+\Delta x)-g(x)$ dan $\Delta y=f(u+\Delta u)-f(u)$. Jika $\Delta u\ne0$ kita dapat menulis $$\frac{\Delta y}{\Delta x}=\frac{\Delta y}{\Delta u}\cdot\frac{\Delta u}{\Delta x}.$$ Saat $\Delta x\to0$ kita juga punya $\Delta u\to0$, karena $g$ kontinu, sehingga ruas kanan menuju $f'(u)\cdot g'(x)$. Celahnya adalah bahwa jika $g$ berosilasi cepat di dekat $x$, $\Delta u$ dapat bernilai $0$ walaupun $\Delta x\ne0$, dan pencoretan itu tidak diperbolehkan. Bukti lengkap menghindari pembagian dengan $\Delta u$: ia menulis $\Delta y=\left(f'(u)+\varepsilon\right)\Delta u$, dengan $\varepsilon\to0$ saat $\Delta u\to0$ dan $\varepsilon=0$ saat $\Delta u=0$. Bentuk itu benar dalam setiap kasus. Pilih fungsi luar dan fungsi dalam di bawah, geser $x$, dan bandingkan hasil kali kedua laju dengan gradien grafik komposit. ## Bagaimana menurunkan sin u, e^u, dan fungsi lain dari suatu fungsi? **Untuk setiap fungsi $u(x)$ yang terdiferensialkan, tiap rumus untuk $x$ mendapat satu faktor tambahan $\frac{du}{dx}$: $\frac{d}{dx}\sin u=\cos u\cdot\frac{du}{dx}$, $\frac{d}{dx}\cos u=-\sin u\cdot\frac{du}{dx}$, $\frac{d}{dx}e^u=e^u\cdot\frac{du}{dx}$, dan seterusnya.** Aturan rantai mengubah tabel [turunan fungsi trigonometri](https://nunada.my.id/artikel/turunan-fungsi-trigonometri/#other-four) menjadi tabel untuk fungsi dalam apa pun: - $\frac{d}{dx}\sin u=\cos u\cdot u'$ dan $\frac{d}{dx}\cos u=-\sin u\cdot u'$; - $\frac{d}{dx}\tan u=\sec^2u\cdot u'$ dan $\frac{d}{dx}\cot u=-\csc^2u\cdot u'$; - $\frac{d}{dx}\sec u=\sec u\tan u\cdot u'$ dan $\frac{d}{dx}\csc u=-\csc u\cot u\cdot u'$; - $\frac{d}{dx}e^u=e^u\cdot u'$. **Contoh 3.** Turunkan $\sin\left(x^2+e^x\right)$. Fungsi luarnya sinus, fungsi dalamnya $x^2+e^x$, dan fungsi dalam itu berturunan $2x+e^x$: $$\frac{d}{dx}\sin\left(x^2+e^x\right)$$ $$=\cos\left(x^2+e^x\right)\cdot\left(2x+e^x\right).$$ **Contoh 4.** Turunkan $y=e^{\cos x}$. Fungsi luarnya eksponensial, dan turunannya di fungsi dalam $\cos x$ adalah $e^{\cos x}$ lagi. Fungsi dalamnya berturunan $-\sin x$: $$\frac{dy}{dx}=e^{\cos x}\cdot(-\sin x)=-\sin x\,e^{\cos x}.$$ **Konstanta di dalam.** Untuk konstanta $k$ fungsi dalam $kx$ berturunan $k$, sehingga $$\frac{d}{dx}e^{kx}=k\,e^{kx}$$ $$\frac{d}{dx}\sin(kx)=k\cos(kx)$$ $$\frac{d}{dx}\tan(4x)=4\sec^2(4x).$$ Juga $\frac{d}{dx}e^{x^2}=e^{x^2}\cdot2x$ dan $\frac{d}{dx}\sec\left(x^2\right)=2x\sec\left(x^2\right)\tan\left(x^2\right)$. Aturan rantai bekerja bersama aturan lain: untuk $x\sin2x$ aturan hasil kali memberi $\sin2x+x\cdot\frac{d}{dx}\sin2x=\sin2x+2x\cos2x$. Ketik fungsi apa saja di bawah yang dibangun dari bagian-bagian ini, dan baca tiap aturan yang dipakai, dengan fungsi luar dan fungsi dalamnya. ## Apa yang dilakukan bila fungsi bersarang tiga lapis atau lebih? **Terapkan aturan rantai sekali untuk tiap lapisan, dari luar ke dalam: turunkan fungsi paling luar dengan semua yang ada di dalamnya dibiarkan, kalikan dengan turunan apa yang ada di dalamnya, dan ulangi pada itu sampai bagian dalamnya hanya $x$.** Tulis dulu lapisannya, dan turunannya adalah hasil kali dengan satu faktor untuk tiap lapisan. **Contoh 5.** Tentukan turunan $g(t)=\tan\left(5-\sin2t\right)$. Tangen adalah fungsi dari $5-\sin2t$; sinus adalah fungsi dari $2t$, yang sendiri adalah fungsi dari $t$. Kupas lapisannya: $$g'(t)=\sec^2\left(5-\sin2t\right)$$ $$\cdot\frac{d}{dt}\left(5-\sin2t\right)$$ $$=\sec^2\left(5-\sin2t\right)$$ $$\cdot\left(-\cos2t\cdot\frac{d}{dt}(2t)\right)$$ $$=-2\cos2t\,\sec^2\left(5-\sin2t\right).$$ **Contoh 6.** Fungsi $\sin\left(\cos(\tan x)\right)$ memiliki tiga lapisan, sehingga tiga faktor: $$\frac{d}{dx}\sin\left(\cos(\tan x)\right)$$ $$=\cos\left(\cos(\tan x)\right)$$ $$\cdot\left(-\sin(\tan x)\right)\cdot\sec^2x.$$ Tiap faktor adalah turunan satu lapisan dengan lapisan di dalamnya dibiarkan: kosinus dari kosinus, minus sinus dari tangen, dan sekan kuadrat. **Contoh 7.** Untuk $y=\sqrt{1+\cos^2x}$ lapisannya adalah akar kuadrat, "$1$ ditambah", kuadrat, dan kosinus: $$y'=\frac{1}{2\sqrt{1+\cos^2x}}\cdot2\cos x\cdot(-\sin x)$$ $$=-\frac{\sin x\cos x}{\sqrt{1+\cos^2x}}.$$ Coba fungsi pada Contoh 5, dan fungsi apa saja milikmu, pada alat di bagian sebelumnya: ia mendaftar satu langkah aturan rantai untuk tiap lapisan. ## Apa itu aturan rantai pangkat, dan kapan ia menggantikan aturan hasil bagi? **Jika $u$ adalah fungsi $x$ yang terdiferensialkan dan $n$ bilangan real mana pun, maka $\frac{d}{dx}u^n=n\,u^{n-1}\,\frac{du}{dx}$.** Ini adalah aturan rantai dengan fungsi luar $f(u)=u^n$, yang turunannya adalah [aturan pangkat](https://nunada.my.id/artikel/aturan-turunan/#constants-and-powers) $nu^{n-1}$. Fungsi dalam $u$ boleh fungsi apa pun: jumlah, sinus, hasil bagi. **Contoh 8.** Empat turunan dengan aturan rantai pangkat. - $\frac{d}{dx}\left(5x^3-x^4\right)^7=7\left(5x^3-x^4\right)^6\cdot\left(15x^2-4x^3\right)$. - $\frac{d}{dx}\frac{1}{3x-2}=\frac{d}{dx}(3x-2)^{-1}=-(3x-2)^{-2}\cdot3=-\frac{3}{(3x-2)^2}$. [Aturan hasil bagi](https://nunada.my.id/artikel/aturan-turunan/#quotient-rule) memberi jawaban yang sama, dengan lebih banyak tulisan. - $\frac{d}{dx}\sin^5x=5\sin^4x\cdot\cos x$, karena $\sin^5x$ berarti $(\sin x)^5$. - $\frac{d}{dx}e^{\sqrt{3x+1}}=e^{\sqrt{3x+1}}\cdot\frac{d}{dx}(3x+1)^{1/2}=e^{\sqrt{3x+1}}\cdot\frac{3}{2\sqrt{3x+1}}$. Dua lapisan berada di dalam eksponensial, sehingga ada dua langkah rantai. **Contoh 9: nilai mutlak.** Karena $|x|=\sqrt{x^2}$, aturan rantai pangkat dengan $u=x^2$ dan $n=\frac12$ memberi, untuk $x\ne0$, $$\frac{d}{dx}|x|=\frac12\left(x^2\right)^{-1/2}\cdot2x$$ $$=\frac{x}{\sqrt{x^2}}=\frac{x}{|x|}.$$ Itu $1$ untuk $x>0$ dan $-1$ untuk $x<0$. Di $x=0$ rumusnya tak terdefinisi, yang sesuai dengan sudut pada grafiknya, titik [tempat tidak ada turunan](https://nunada.my.id/artikel/garis-singgung-dan-turunan-di-suatu-titik/#no-derivative). **Contoh 10: selalu menanjak.** Tunjukkan bahwa setiap garis singgung pada $y=\frac{1}{(1-2x)^3}$ bergradien positif. Tulis $y=(1-2x)^{-3}$. Maka $$\frac{dy}{dx}=-3(1-2x)^{-4}\cdot(-2)=\frac{6}{(1-2x)^4}.$$ Di setiap titik pada kurva $x\ne\frac12$, sehingga penyebutnya pangkat empat dan positif: gradiennya adalah hasil bagi dua bilangan positif. **Satu lagi yang berguna.** $\frac{d}{dx}\sqrt{x^2+1}=\frac{1}{2\sqrt{x^2+1}}\cdot2x=\frac{x}{\sqrt{x^2+1}}$, yaitu gradien kurva yang titik-titiknya setinggi $\sqrt{x^2+1}$ di atas sumbu, sebuah hiperbola. ## Bagaimana aturan rantai menjelaskan frekuensi, amplitudo, dan derajat? **Konstanta $k$ di dalam sinus mengalikan turunannya dengan $k$: $\frac{d}{dx}\sin(kx)=k\cos(kx)$, sehingga gelombang yang berosilasi $k$ kali secepat itu $k$ kali lebih curam.** Fungsi dalam $kx$ berturunan $k$, dan tidak ada lagi yang berubah. Kurva $y=\sin x$, $y=\sin2x$, dan $y=\sin\frac{x}{2}$ memotong sumbu di titik asal dengan gradien $1$, $2$, dan $\frac12$. *sin x (hijau), sin 2x (jingga), dan sin(x/2) (biru): di titik asal gradiennya 1, 2, dan 1/2, yaitu konstanta di dalamnya.* **Turunan tingkat tinggi.** Setiap turunan $\sin(kx)$ memunculkan satu faktor $k$ lagi, sehingga turunannya mengikuti [siklus empat](https://nunada.my.id/artikel/turunan-fungsi-trigonometri/#higher-trig-derivatives) dengan $k^n$ di depannya: $k\cos(kx)$, lalu $-k^2\sin(kx)$, lalu $-k^3\cos(kx)$, lalu $k^4\sin(kx)$. **Sebuah piston.** Misalkan posisi sebuah piston $s=A\cos(2\pi bt)$, dengan amplitudo $A$ dan frekuensi $b$ siklus per detik. Ambil $w=2\pi b$. Maka $$v=-wA\sin(wt)$$ $$a=-w^2A\cos(wt)$$ $$j=w^3A\sin(wt),$$ sehingga kecepatan, percepatan, dan sentakan terbesarnya $wA$, $w^2A$, dan $w^3A$. **Menggandakan frekuensi menggandakan kecepatan, melipatempatkan percepatan, dan mengalikan sentakan dengan $8$.** Inilah sebabnya mesin dapat rusak bila dijalankan terlalu cepat: gaya, yang mengikuti percepatan, tumbuh sebesar kuadrat kecepatan geraknya. [Gerak sepanjang garis lurus](https://nunada.my.id/artikel/turunan-sebagai-laju-perubahan/#motion-along-a-line) pada pegas adalah kasus $b=\frac{1}{2\pi}$. **Suhu di Fairbanks, Alaska.** Suhu rata-rata pada hari ke-$x$ dalam setahun, dalam derajat Celsius, kira-kira $$y=20\sin\left(\frac{2\pi}{365}(x-101)\right)-4.$$ Dengan aturan rantai laju perubahannya $$y'=\frac{40\pi}{365}\cos\left(\frac{2\pi}{365}(x-101)\right).$$ Suhu naik paling cepat saat kosinus sama dengan $1$, di $x=101$, yaitu 11 April, dan saat itu ia naik $\frac{40\pi}{365}\approx0{,}34$ derajat per hari. Faktor $\frac{40\pi}{365}$ adalah amplitudo $20$ kali konstanta di dalam, $\frac{2\pi}{365}$. **Derajat.** Karena $x^\circ=\frac{\pi x}{180}$ radian, fungsi dalam $\sin\left(x^\circ\right)$ adalah $\frac{\pi x}{180}$, dan $$\frac{d}{dx}\sin\left(x^\circ\right)=\frac{\pi}{180}\cos\left(x^\circ\right).$$ Sinus $x$ derajat berosilasi hanya $\frac{\pi}{180}\approx0{,}01745$ kali sesering $\sin x$, dan gradien terbesarnya $\frac{\pi}{180}$. Faktor itu akan muncul lagi pada setiap turunan, yaitu keuntungan ukuran radian yang sudah ditunjukkan oleh [limit sin h per h](https://nunada.my.id/artikel/turunan-fungsi-trigonometri/#sine-limits). Ubah $k$, ganti ke derajat, atau gandakan frekuensi piston di bawah. ## Bagaimana mencari turunan kedua fungsi komposit? **Turunkan $f'(g(x))\cdot g'(x)$ dengan aturan hasil kali, dan aturan rantai pada faktor pertamanya, dan kamu mendapat $(f\circ g)''=f''(g(x))\cdot\left(g'(x)\right)^2+f'(g(x))\cdot g''(x)$.** Inilah langkahnya. Turunan pertamanya $y'=f'(g)\,g'$. Aturan hasil kali memberi $$y''=\left(\frac{d}{dx}f'(g)\right)g'+f'(g)\,g''.$$ Dengan aturan rantai $\frac{d}{dx}f'(g)=f''(g)\,g'$, sehingga suku pertamanya $f''(g)\,g'\cdot g'=f''(g)\left(g'\right)^2$. Ada dua suku karena fungsi dalam masuk dua kali: sekali lewat lajunya $g'$ dan sekali lewat laju perubahannya sendiri $g''$. **Contoh 11.** Tentukan $y''$ untuk $y=\sin\left(x^2\right)$. Dengan $f=\sin$ dan $g=x^2$: $f'(g)=\cos\left(x^2\right)$, $g'=2x$, $f''(g)=-\sin\left(x^2\right)$, $g''=2$. Jadi $$y'=2x\cos\left(x^2\right),$$ $$y''=-\sin\left(x^2\right)\cdot4x^2+\cos\left(x^2\right)\cdot2$$ $$=2\cos\left(x^2\right)-4x^2\sin\left(x^2\right).$$ **Contoh 12.** Untuk $y=\left(x^2+1\right)^3$ ambil $f=u^3$ dan $g=x^2+1$: $f'=3u^2$, $f''=6u$, $g'=2x$, $g''=2$. Maka $$y''=6\left(x^2+1\right)\cdot4x^2$$ $$+3\left(x^2+1\right)^2\cdot2$$ $$=30x^4+36x^2+6.$$ Menjabarkan lebih dulu memberi $y=x^6+3x^4+3x^2+1$ dan $y''=30x^4+36x^2+6$, sama saja. **Kekeliruan yang umum** adalah menulis $f''(g)\cdot g''$ untuk turunan kedua. Suku $f'(g)\,g''$ hilang, dan faktor $\left(g'\right)^2$ juga. Bila fungsi dalamnya garis lurus $g=ax+b$, maka $g''=0$ dan hanya $f''(g)\cdot a^2$ yang tersisa: itulah sebabnya $\frac{d^2}{dx^2}\sin(kx)=-k^2\sin(kx)$. Alat pada bagian fungsi bersarang juga menampilkan turunan kedua dan ketiga dari apa yang kamu ketik. ## Kapan aturan rantai berlaku, dan apa yang terjadi bila tidak? **Aturan rantai adalah pernyataan jika: jika fungsi dalam terdiferensialkan di $x$ dan fungsi luar terdiferensialkan di $g(x)$, maka komposit terdiferensialkan dan rumusnya berlaku.** Ia tidak menyatakan apa yang terjadi bila suatu syarat gagal, dan dalam hal itu komposit mungkin atau mungkin tidak terdiferensialkan. **Contoh 13: fungsi dalam tidak terdiferensialkan, komposit terdiferensialkan.** Misalkan $f(x)=x^2$ dan $g(x)=|x|$. Baik $f\circ g$ maupun $g\circ f$ sama dengan $x^2$, karena $|x|^2=x^2$ dan $\left|x^2\right|=x^2$, dan keduanya terdiferensialkan di $x=0$ walaupun $g=|x|$ tidak. Ini tidak bertentangan dengan aturan rantai: aturan itu memerlukan $g$ terdiferensialkan di $0$, dan tidak menyatakan komposit tidak terdiferensialkan bila tidak demikian. **Turunan yang tidak kontinu.** Tinjau $f(x)=x^2\sin\frac1x$ untuk $x\ne0$, dengan $f(0)=0$. Untuk $x\ne0$ aturan rantai pada $\sin\frac1x$ dan aturan hasil kali memberi $$f'(x)=2x\sin\frac1x-\cos\frac1x.$$ Di $x=0$ fungsi dalam $\frac1x$ tidak ada, sehingga aturan rantai tidak dapat dipakai; kita kembali ke definisi. Hasil baginya $\frac{h^2\sin(1/h)}{h}=h\sin\frac1h$, dan karena $\left|h\sin\frac1h\right|\le|h|$ ia menuju $0$: $f'(0)=0$. Namun $f'(x)$ tidak memiliki limit saat $x\to0$, karena $\cos\frac1x$ berosilasi di antara $-1$ dan $1$. Jadi $f$ terdiferensialkan di mana-mana, dan turunannya tidak kontinu di $0$. **Fungsi yang kontinu tetapi tidak memiliki turunan.** Untuk $x\sin\frac1x$ (dan $0$ di $0$) hasil bagi di $0$ adalah $\sin\frac1h$, yang berosilasi dan tidak memiliki limit: fungsi itu kontinu di $0$ dan tidak terdiferensialkan di sana. Inilah jenis osilasi cepat yang menyebabkan celah pada bukti aturan rantai. ## Bagaimana menerapkan aturan rantai dalam kode? **SymPy menerapkan aturan rantai pada fungsi komposit apa pun: `sp.diff(sp.sin(2x), x)` memberi `2cos(2*x)`, dan `sp.diff(f, x, 2)` memberi turunan kedua.** Ia menulis $\sec^2u$ sebagai `tan(u)**2 + 1`, fungsi yang sama. Angka-angka pada contoh di atas keluar sebagaimana mestinya: `(3*x**2 + 1)**2` berturunan `12x(3*x**2 + 1)`, dan `sp.simplify` mengubah turunan `(5*x**3 - x**4)**7` menjadi `x**20(105 - 28x)*(x - 5)**6`, yaitu $7\left(5x^3-x^4\right)^6\left(15x^2-4x^3\right)$ dengan faktor persekutuan dikumpulkan. ```python import sympy as sp x = sp.symbols('x') for f in (sp.sin(2 * x), (3 * x**2 + 1) ** 2, sp.exp(sp.cos(x)), sp.sin(x**2 + sp.exp(x)), sp.sqrt(3 * x + 1), sp.tan(5 - sp.sin(2 * x))): print(f, '->', sp.diff(f, x)) # sin(2*x) -> 2*cos(2*x) # (3*x**2 + 1)**2 -> 12*x*(3*x**2 + 1) # exp(cos(x)) -> -exp(cos(x))*sin(x) # sin(x**2 + exp(x)) -> (2*x + exp(x))*cos(x**2 + exp(x)) # sqrt(3*x + 1) -> 3/(2*sqrt(3*x + 1)) # -tan(sin(2*x) - 5) -> -2*(tan(sin(2*x) - 5)**2 + 1)*cos(2*x) print(sp.diff(sp.sin(x**2), x, 2)) # 2*(-2*x**2*sin(x**2) + cos(x**2)) print(sp.simplify(sp.diff((5 * x**3 - x**4) ** 7, x))) # x**20*(105 - 28*x)*(x - 5)**6 ``` **Sebuah program dapat menerapkan aturan rantai pada bilangan dan bukan rumus.** Bawa bersama setiap nilai turunannya, sepasang $(v,d)$, dan beri tiap operasi aturan rantainya: untuk sinus, $(v,d)\mapsto\left(\sin v,\ \cos v\cdot d\right)$, yaitu $f'(u)\cdot u'$ lagi. Mulai dengan $x=(0{,}7;1)$, karena $x$ berturunan $1$, dan program menghitung $\sin\left(x^2+e^x\right)$ dan turunannya sekaligus. Inilah diferensiasi otomatis mode maju. Hasilnya $-2{,}742554$, sama dengan rumus $\cos\left(x^2+e^x\right)\left(2x+e^x\right)$ di $x=0{,}7$ dan sama dengan selisih terpusat. Menerapkan aturan itu dari luar ke dalam, pada program dengan jutaan langkah, adalah diferensiasi otomatis mode mundur, yang dilakukan propagasi balik dalam jaringan saraf: satu lintasan menghitung keluaran, dan satu lintasan balik mengalikan laju tiap lapisan. ```python import math f = lambda x: math.sin(x**2 + math.exp(x)) x0 = 0.7 chain = math.cos(x0**2 + math.exp(x0)) * (2 * x0 + math.exp(x0)) # the formula central = (f(x0 + 1e-6) - f(x0 - 1e-6)) / 2e-6 # a difference quotient print(round(chain, 6), round(central, 6)) # -2.742554 -2.742554 class Dual: """A number and its derivative, carried together.""" def __init__(self, v, d=0.0): self.v, self.d = v, d def __add__(self, o): o = o if isinstance(o, Dual) else Dual(o) return Dual(self.v + o.v, self.d + o.d) __radd__ = __add__ def __mul__(self, o): o = o if isinstance(o, Dual) else Dual(o) return Dual(self.v * o.v, self.d * o.v + self.v * o.d) # the product rule __rmul__ = __mul__ def sin(u): return Dual(math.sin(u.v), math.cos(u.v) * u.d) # the chain rule: f'(u) * u' def exp(u): return Dual(math.exp(u.v), math.exp(u.v) * u.d) x = Dual(0.7, 1.0) # x has derivative 1 y = sin(x * x + exp(x)) print(round(y.v, 6), round(y.d, 6)) # 0.595461 -2.742554 ``` ```cpp #include #include #include using namespace std; // A dual number is {value, derivative}: the two travel together through every operation. void add(const double a[], const double b[], double r[]) { r[0] = a[0] + b[0]; r[1] = a[1] + b[1]; } void mul(const double a[], const double b[], double r[]) { r[0] = a[0] * b[0]; r[1] = a[1] * b[0] + a[0] * b[1]; // the product rule } void dsin(const double u[], double r[]) { r[0] = sin(u[0]); r[1] = cos(u[0]) * u[1]; } // the chain rule: f'(u) u' void dexp(const double u[], double r[]) { r[0] = exp(u[0]); r[1] = exp(u[0]) * u[1]; } double f(double x) { return sin(x * x + exp(x)); } int main() { double x0 = 0.7; double chain = cos(x0 * x0 + exp(x0)) * (2 * x0 + exp(x0)); // the formula double central = (f(x0 + 1e-6) - f(x0 - 1e-6)) / 2e-6; // a difference quotient printf("%.6f %.6f\n", chain, central); double x[2] = {0.7, 1}; // x has derivative 1 double xx[2], e[2], s[2], y[2]; mul(x, x, xx); dexp(x, e); add(xx, e, s); dsin(s, y); // y = sin(x * x + exp(x)) printf("%.6f %.6f\n", y[0], y[1]); return 0; } /* output: -2.742554 -2.742554 0.595461 -2.742554 */ ``` ## Siapa yang menemukan aturan rantai, dan bagaimana ia pertama dibuktikan? **Aturan rantai setua kalkulus, tetapi bukti tanpa celah memerlukan sekitar dua abad lagi.** - **Leibniz.** Aturan rantai tampaknya pertama kali dipakai oleh Gottfried Leibniz, dalam naskah tahun 1676, untuk menurunkan akar kuadrat dari $a+bz+cz^2$ sebagai akar kuadrat dari kuadrat. Notasinya $\frac{dy}{dx}=\frac{dy}{du}\cdot\frac{du}{dx}$ membuat aturan itu tampak seperti pecahan yang saling mencoret, itulah sebabnya ia mudah diingat, dan itulah sebabnya ia bukan bukti. - **Bernoulli dan l'Hôpital.** Johann Bernoulli mengajarkan kalkulus baru kepada Marquis de l'Hôpital, yang buku teksnya pada 1696, Analyse des infiniment petits, menyebarkannya ke seluruh Eropa. - **Lagrange.** Notasi aksen $f'(x)$, yang menulis aturan rantai sebagai $f'(g(x))\cdot g'(x)$ dan menunjukkan di mana tiap turunan diambil, diperkenalkan oleh Joseph-Louis Lagrange. - **Bukti tanpa celah.** Pada abad ke-20 cara Constantin Carathéodory mendefinisikan turunan, $f(x)-f(a)=\varphi(x)(x-a)$ dengan $\varphi$ kontinu di $a$, memberi bukti singkat aturan rantai yang tidak pernah membagi dengan $\Delta u$. - **Propagasi balik.** Menerapkan aturan itu dari keluaran kembali ke masukan suatu perhitungan, dalam mode mundur, diuraikan oleh Seppo Linnainmaa pada 1970, dan David Rumelhart, Geoffrey Hinton, dan Ronald Williams menjadikannya cara baku melatih jaringan saraf pada 1986. ## Kesalahan apa yang sering terjadi pada aturan rantai? **Kesalahan paling umum pada aturan rantai adalah sembilan hal berikut, masing-masing dengan pernyataan yang benar.** | Kesalahan | Yang benar | |---|---| | ❌ $\frac{d}{dx}\sin2x=\cos2x$ | Turunan fungsi dalam adalah faktor: $\frac{d}{dx}\sin2x=2\cos2x$. | | ❌ $\frac{d}{dx}\left(x^2+1\right)^5=5\left(x^2+1\right)^4$ | Aturan pangkat hanya memberi fungsi luar: kalikan dengan $2x$ untuk mendapat $10x\left(x^2+1\right)^4$. | | ❌ $\frac{d}{dx}e^{2x}=2x\,e^{2x-1}$ | Pangkatnya memuat $x$, sehingga aturan pangkat tidak berlaku. Turunan $e^u$ adalah $e^u\cdot u'$, yaitu $2e^{2x}$. | | ❌ $\frac{d}{dx}\cos\left(x^2\right)=-\sin x\cdot2x$ | Turunan fungsi luar dihitung pada fungsi dalam, bukan pada $x$: $-\sin\left(x^2\right)\cdot2x$. | | ❌ $\frac{d}{dx}\sin^2x=2\sin x$ | Ada dua lapisan, kuadrat dan sinus: $2\sin x\cdot\cos x$. | | ❌ Turunan kedua $f(g(x))$ adalah $f''(g(x))\cdot g''(x)$ | Yang benar $f''(g)\left(g'\right)^2+f'(g)\,g''$: suku kedua dan kuadratnya hilang. | | ❌ $(f\circ g)'=f'\circ g'$, komposisi turunan-turunan | Ia hasil kali: $f'(g(x))\cdot g'(x)$, dengan $f'$ diambil di $g(x)$. | | ❌ Jika $g$ tidak terdiferensialkan di $a$, maka $f(g(x))$ juga tidak | Belum tentu: dengan $g=|x|$ dan $f=x^2$ komposit itu $x^2$, terdiferensialkan di $0$. | | ❌ $\frac{d}{dx}\sin\left(x^\circ\right)=\cos\left(x^\circ\right)$ | Fungsi dalam $\frac{\pi x}{180}$ menambah faktor: $\frac{\pi}{180}\cos\left(x^\circ\right)$. | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: aturan rantai sekilas - **Aturannya:** $(f\circ g)'(x)=f'(g(x))\cdot g'(x)$, atau $\frac{dy}{dx}=\frac{dy}{du}\cdot\frac{du}{dx}$: turunkan fungsi luar dengan fungsi dalam dibiarkan, lalu kalikan dengan turunan fungsi dalam. - **Lapisan:** temukan fungsi luar dengan bertanya apa yang dilakukan terakhir pada $x$; dengan tiga lapisan atau lebih, satu faktor untuk tiap lapisan, dari luar ke dalam. - **Rumus:** $(\sin u)'=\cos u\cdot u'$, $(e^u)'=e^u\cdot u'$, $\left(u^n\right)'=n\,u^{n-1}u'$, dan begitu pula untuk fungsi lainnya. - **Konstanta di dalam:** $\frac{d}{dx}\sin(kx)=k\cos(kx)$; menggandakan frekuensi piston mengalikan kecepatan, percepatan, dan sentakan dengan $2$, $4$, $8$; dalam derajat faktornya $\frac{\pi}{180}$. - **Turunan kedua:** $f''(g)\left(g'\right)^2+f'(g)\,g''$. - **Batas aturan:** kedua fungsi harus terdiferensialkan di tempat ia dipakai; komposit dapat terdiferensialkan bila fungsi dalamnya tidak, seperti $|x|^2$. - **Kode:** `sp.diff` untuk rumus; sepasang $(v,d)$ dengan $f'(u)\cdot u'$ untuk bilangan. ## Glosarium: istilah penting - **Fungsi komposit**: Fungsi yang dibentuk dengan menerapkan satu fungsi pada keluaran fungsi lain, ditulis f dari g dari x, dengan fungsi dalam g diterapkan lebih dulu dan fungsi luar f terakhir. - **Fungsi dalam**: Fungsi dalam suatu komposit yang diterapkan lebih dulu, sehingga keluarannya menjadi masukan fungsi luar; ia adalah u pada y sama dengan f dari u. - **Fungsi luar**: Fungsi pada suatu komposit yang diterapkan terakhir, pada hasil fungsi dalam; ia adalah f pada y sama dengan f dari u. - **Aturan rantai**: Aturan bahwa turunan suatu fungsi komposit adalah turunan fungsi luar yang dihitung pada fungsi dalam, dikali turunan fungsi dalam. - **Aturan rantai pangkat**: Aturan rantai untuk pangkat dari suatu fungsi: turunan u pangkat n adalah n kali u pangkat n dikurangi 1 kali turunan u. - **Frekuensi**: Banyak siklus lengkap yang dibuat suatu osilasi per satuan waktu; pada sinus dari 2 pi b t nilainya b, dan setiap turunan mengalikan gerak dengan 2 pi b. - **Diferensiasi otomatis**: Cara menghitung turunan eksak suatu program dengan membawa turunan bersama setiap nilai dan menerapkan aturan rantai pada setiap operasi. ## Pertanyaan yang sering diajukan ### Apa itu aturan rantai dalam kalkulus? Aturan rantai memberi turunan suatu fungsi komposit. Ia menyatakan untuk menurunkan fungsi luar pada fungsi dalam lalu mengalikannya dengan turunan fungsi dalam, sehingga turunan f dari g dari x adalah f aksen dari g dari x kali g aksen dari x. ### Bagaimana mengetahui kapan memakai aturan rantai? Pakai ia bila satu fungsi diletakkan di dalam fungsi lain, seperti sinus dari dua x, e pangkat x kuadrat, atau pangkat dari suatu jumlah. Jika operasi terakhir pada x adalah fungsi yang diterapkan pada suatu ekspresi, dan bukan jumlah atau hasil kali bagian-bagian terpisah, ada rantai. ### Apa itu aturan luar-dalam? Itu aturan rantai dengan kata-kata: turunkan fungsi luar dan hitung pada fungsi dalam yang dibiarkan, lalu kalikan dengan turunan fungsi dalam. Ia mengingatkan bahwa turunan fungsi luar dihitung pada fungsi dalam, bukan pada x. ### Berapa turunan sin 2x? Turunannya dua kosinus dari dua x. Fungsi luarnya sinus, yang turunannya kosinus dihitung pada dua x, dan fungsi dalam dua x berturunan 2, sehingga faktor 2 muncul di depan. Melupakannya adalah kesalahan yang paling umum. ### Berapa turunan e pangkat x kuadrat? Turunannya dua x kali e pangkat x kuadrat. Turunan e pangkat u adalah e pangkat u kali turunan u, dan di sini u adalah x kuadrat dengan turunan dua x. Aturan pangkat tidak berlaku untuk pangkat yang memuat x. ### Bagaimana memakai aturan rantai lebih dari sekali? Kerjakan dari luar ke dalam, satu lapisan dalam satu waktu. Turunkan fungsi paling luar dengan semua yang ada di dalamnya dibiarkan, kalikan dengan turunan apa yang ada di dalamnya, dan terapkan aturan lagi pada itu, sampai bagian dalamnya hanya x. Tiap lapisan memberi satu faktor. ### Apa itu aturan rantai pangkat? Itu aturan rantai untuk pangkat dari suatu fungsi: turunan u pangkat n adalah n kali u pangkat n dikurangi satu kali turunan u. Ia menangani pangkat dari jumlah, kebalikan, dan akar kuadrat dari ekspresi apa pun. ### Berapa turunan kedua fungsi komposit? Turunan keduanya adalah f aksen ganda dari g kali kuadrat g aksen, ditambah f aksen dari g kali g aksen ganda. Aturan hasil kali membuat dua suku, dan aturan rantai pada f aksen dari g memberi faktor tambahan g aksen pada suku pertama. ### Apakah aturan rantai bekerja jika fungsi dalamnya tidak terdiferensialkan? Aturan itu sendiri memerlukan fungsi dalam terdiferensialkan di tempat ia dipakai. Komposit itu mungkin tetap terdiferensialkan: kuadrat nilai mutlak x adalah x kuadrat, yang memiliki turunan di nol walaupun nilai mutlak tidak. --- # Derivatives of Trigonometric Functions Source: https://nunada.my.id/articles/derivatives-of-trigonometric-functions/ Updated: 2026-10-14 ## Quick answer **The derivative of sine is cosine and the derivative of cosine is minus sine, for angles in radians: $\frac{d}{dx}\sin x=\cos x$ and $\frac{d}{dx}\cos x=-\sin x$.** The other four follow from the quotient rule: $\tan'x=\sec^2x$, $\cot'x=-\csc^2x$, $\sec'x=\sec x\tan x$ and $\csc'x=-\csc x\cot x$. Everything rests on two limits, $\frac{\sin h}{h}\to1$ and $\frac{\cos h-1}{h}\to0$, which are true only when $h$ is measured in radians. ### Key takeaways - The two limits $\lim_{h\to0}\frac{\sin h}{h}=1$ and $\lim_{h\to0}\frac{\cos h-1}{h}=0$ follow from the squeeze $\sin h0$) the acceleration points upward, and when it is above ($s<0$) it points downward: it always points back to the rest position. A spring pulling with a force proportional to the stretch, $F=-ks$, gives exactly this, and that is Hooke's law. - **Jerk.** $j=\frac{da}{dt}=5\sin t$. **Where is the speed greatest?** The speed is $|v|=5|\sin t|$. It is greatest, $5$ cm/s, when $\sin t=\pm1$, that is, when $\cos t=0$, which is when the weight passes the **rest position** $s=0$. It is $0$ at the ends of the swing, $s=\pm5$, where the weight turns around. The acceleration is the opposite way round: it is greatest, in size, at the ends, and $0$ at the rest position. The jerk is greatest at the rest position, where the acceleration changes sign fastest. **Energy check.** From $s=5\cos t$ and $v=-5\sin t$, $$s^2+v^2=25\cos^2t+25\sin^2t$$ $$=25=A^2,$$ so a point with coordinates $(s,v)$ goes around a circle of radius $5$: when the position is large the velocity is small, and the other way round. **Other periods.** A stiffer spring or a lighter weight swings faster, with $s=A\cos(\omega t)$ for a constant $\omega$, and then each derivative picks up a factor $\omega$. That is the chain rule at work, which this article does not need yet: here $\omega=1$. Change the amplitude and the time below and watch the weight, the two graphs and the numbers. ## What is the nth derivative of sin x or cos x? **The derivatives of sine and cosine repeat every four steps, so the $n$th derivative depends only on the remainder of $n$ divided by $4$.** Starting from sine the derivatives go $\sin x$, $\cos x$, $-\sin x$, $-\cos x$ and then $\sin x$ again; starting from cosine they go $\cos x$, $-\sin x$, $-\cos x$, $\sin x$ and then $\cos x$ again. | $n$ divided by $4$ leaves | $\frac{d^n}{dx^n}\sin x$ | $\frac{d^n}{dx^n}\cos x$ | |---|---|---| | $0$ | $\sin x$ | $\cos x$ | | $1$ | $\cos x$ | $-\sin x$ | | $2$ | $-\sin x$ | $-\cos x$ | | $3$ | $-\cos x$ | $\sin x$ | The reason is that the derivative of sine is a quarter of a turn ahead of it: four such steps bring the wave back to where it started. Both functions satisfy $y''=-y$, which is the equation of the spring in the previous section. **Three examples.** The ordinary [higher-order derivative](https://nunada.my.id/articles/differentiation-rules/#higher-order) is $n$ steps of differentiation, so reduce $n$ first. - $\frac{d^{999}}{dx^{999}}\cos x$: $999=4\cdot249+3$, remainder $3$, so the answer is $\sin x$. - $\frac{d^{110}}{dx^{110}}\left(\sin x-3\cos x\right)$: $110=4\cdot27+2$, remainder $2$, so each function is replaced by its own negative and the answer is $-\sin x+3\cos x$. - $\frac{d^{73}}{dx^{73}}\sin x$: $73=4\cdot18+1$, remainder $1$, so the answer is $\cos x$. **The other four do not repeat.** The derivatives of tangent grow instead: $\tan'x=\sec^2x$, $\tan''x=2\sec^2x\tan x$ by the product rule, and each next one is longer, since $\sec$ and $\tan$ keep multiplying by one another. Only sine and cosine, being waves that sit in a circle, cycle. ## How do you differentiate trigonometric functions in code? **SymPy knows the whole table: `sp.diff(sp.sin(x), x)` gives `cos(x)`, and `sp.diff(f, x, n)` takes the $n$th derivative, even for $n=999$.** SymPy writes $\sec^2x$ as `tan(x)**2 + 1`, which is the same function by $\sec^2x=1+\tan^2x$. The second program checks the limits numerically. In radians, `sin(h)/h` climbs to $1$ and `(cos(h) - 1)/h` shrinks like $-\frac h2$; in degrees, after converting with `h * pi/180`, the first quotient settles at $\frac{\pi}{180}=0.0174533$. ```python import sympy as sp x = sp.symbols('x') for f in (sp.sin(x), sp.cos(x), sp.tan(x), sp.cot(x), sp.sec(x), sp.csc(x)): print(f, '->', sp.diff(f, x)) # sin(x) -> cos(x) # cos(x) -> -sin(x) # tan(x) -> tan(x)**2 + 1 (that is sec(x)**2) # cot(x) -> -cot(x)**2 - 1 (that is -csc(x)**2) # sec(x) -> tan(x)*sec(x) # csc(x) -> -cot(x)*csc(x) print(sp.diff(sp.exp(x) * sp.sin(x), x)) # exp(x)*sin(x) + exp(x)*cos(x) print(sp.simplify(sp.diff(sp.cos(x) / (1 - sp.sin(x)), x))) # -1/(sin(x) - 1), which is 1/(1 - sin(x)) print(sp.diff(sp.cos(x), x, 999)) # sin(x) print(sp.diff(sp.sin(x) - 3 * sp.cos(x), x, 110)) # -sin(x) + 3*cos(x) ``` ```python import math for h in (0.1, 0.01, 0.001, 0.0001): print(h, round(math.sin(h) / h, 8), round((math.cos(h) - 1) / h, 8)) # 0.1 0.99833417 -0.04995835 # 0.01 0.99998333 -0.00499996 # 0.001 0.99999983 -0.0005 # 0.0001 1.0 -5e-05 d = math.pi / 180 # one degree, in radians for h in (1, 0.1, 0.01): print(h, round(math.sin(h * d) / h, 8)) # 0.01745241, 0.01745328, 0.01745329 print(round(d, 8)) # 0.01745329: the limit is pi/180, not 1 print(math.sin(30), math.sin(math.radians(30))) # -0.988... and 0.5: sin(30) treats 30 as radians for h in (0.1, 0.01, 0.001): print(h, (math.sin(1 + h) - math.sin(1 - h)) / (2 * h)) # 0.5394, 0.54029, 0.5403022 print(math.cos(1)) # 0.5403023: the central difference reaches cos(1) ``` ```cpp #include #include #include using namespace std; const double PI = acos(-1.0); int main() { double hs[4] = {0.1, 0.01, 0.001, 0.0001}; for (int i = 0; i < 4; i++) { double h = hs[i]; printf("%.4f %.8f %.8f\n", h, sin(h) / h, (cos(h) - 1) / h); // the two limits: 1 and 0 } double d = PI / 180; // one degree, in radians double ds[3] = {1, 0.1, 0.01}; for (int i = 0; i < 3; i++) printf("%.2f %.8f\n", ds[i], sin(ds[i] * d) / ds[i]); printf("%.8f\n", d); // the limit in degrees is pi/180, not 1 printf("%.6f %.6f\n", sin(30.0), sin(30 * d)); // sin(30) treats 30 as radians for (int i = 0; i < 3; i++) { double h = hs[i]; printf("%.4f %.7f\n", h, (sin(1 + h) - sin(1 - h)) / (2 * h)); // the central difference of sin at 1 } printf("%.7f\n", cos(1.0)); // ... reaches cos(1) return 0; } /* output: 0.1000 0.99833417 -0.04995835 0.0100 0.99998333 -0.00499996 0.0010 0.99999983 -0.00050000 0.0001 1.00000000 -0.00005000 1.00 0.01745241 0.10 0.01745328 0.01 0.01745329 0.01745329 -0.988032 0.500000 0.1000 0.5394023 0.0100 0.5402933 0.0010 0.5403022 0.5403023 */ ``` **The trap in any language is the unit.** `math.sin`, `Math.sin` and NumPy's `np.sin` all expect radians, so `math.sin(30)` is the sine of $30$ radians, $-0.988$, and not $0.5$. Convert with `math.radians` first. The same unit is behind the derivative formulas: the numbers `cos(1)` and the central difference above agree only because $x=1$ is a radian measure. ## Who first studied sine, and when did it become a function of calculus? **The sine began as a table of lengths in astronomy, and it became a function with a derivative only when radians and infinite series arrived.** - **Chords and the first sine.** Greek astronomers such as Hipparchus and, around 150, Ptolemy tabulated the lengths of chords of a circle. Indian astronomers, in the fifth century and after, replaced the chord by half the chord, the jya, which is the sine. The word "sine" comes from it by way of Arabic, translated into the Latin sinus. - **Series.** In the Kerala school in India, Madhava of Sangamagrama and his successors, around the 14th century, found infinite series for sine and cosine, about two centuries before they were found again in Europe. Isaac Newton had them in the 1660s and used them in calculus. - **Radians.** Roger Cotes in 1714 saw that the natural measure of an angle is the length of its arc on a circle of radius $1$. The word "radian" itself first appeared in print in 1873. - **The modern functions.** Leonhard Euler, in his Introductio in analysin infinitorum (1748), treated sine and cosine as functions of a number, in radians, with the notation we use today. - **Hooke's law.** Robert Hooke published "as the extension, so the force" in 1678, the spring law behind simple harmonic motion. ## What mistakes do people make with trigonometric derivatives? **The most common mistakes with trigonometric derivatives are the nine below, each with the correct statement.** | Mistake | Correct | |---|---| | ❌ $\frac{d}{dx}\cos x=\sin x$ | The derivative of cosine has a minus sign: $-\sin x$. The cosine starts at its peak and falls, so its slope is negative. | | ❌ $\frac{d}{dx}\sin 2x=\cos 2x$ | The table is for $\sin x$ with a plain $x$ inside. With $2x$ inside the wave is twice as steep: the derivative is $2\cos 2x$, from the [chain rule](https://nunada.my.id/articles/the-chain-rule/#chain-rule). | | ❌ $\frac{d}{dx}\tan x=\sec x$ | The derivative of tangent is $\sec^2x$. The expression $\sec x\tan x$ is the derivative of $\sec x$. | | ❌ $\frac{d}{dx}\sec x=\sec^2x$ | $\sec^2x$ is the derivative of $\tan x$. For secant, $\sec'x=\sec x\tan x$. | | ❌ $\frac{d}{dx}\sin^2x=\cos^2x$ | $\sin^2x=\sin x\cdot\sin x$, and the product rule gives $\cos x\sin x+\sin x\cos x=2\sin x\cos x$. | | ❌ $\frac{d}{dx}(\sin x\cos x)=\cos x\cdot(-\sin x)$ | The product rule has two terms: $\cos x\cdot\cos x+\sin x\cdot(-\sin x)=\cos^2x-\sin^2x$. | | ❌ $\frac{d}{dx}\sec x=\frac{1}{-\sin x}$ | The derivative of a reciprocal is $-\frac{f'}{f^2}$, not one over the derivative: $\left(\frac{1}{\cos x}\right)'=\frac{\sin x}{\cos^2x}=\sec x\tan x$. | | ❌ $\lim_{h\to0}\frac{\sin h}{h}=0$ because $\sin 0=0$ | It is a $\frac00$ form: top and bottom both go to $0$, and the squeeze $\cos h<\frac{\sin h}{h}<1$ shows the limit is $1$. | | ❌ $\frac{d}{dx}\sin x=\cos x$ also holds when $x$ is in degrees | Only in radians. In degrees $\frac{d}{dx}\sin x^\circ=\frac{\pi}{180}\cos x^\circ$. | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: derivatives of trigonometric functions at a glance - **Two limits:** $\frac{\sin h}{h}\to1$ and $\frac{\cos h-1}{h}\to0$, from the squeeze $\cos h<\frac{\sin h}{h}<1$; in radians only (in degrees the first is $\frac{\pi}{180}$). - **Sine and cosine:** $(\sin x)'=\cos x$ and $(\cos x)'=-\sin x$, by the angle-sum formulas. - **The other four:** $(\tan x)'=\sec^2x$, $(\cot x)'=-\csc^2x$, $(\sec x)'=\sec x\tan x$, $(\csc x)'=-\csc x\cot x$, by the quotient rule; the "co" functions are negative. - **Slopes:** the slope of $\tan x$ is at least $1$; $y=x+2\sin x$ has horizontal tangents at $\frac{2\pi}{3}$ and $\frac{4\pi}{3}$ on $[0,2\pi]$. - **Spring:** $s=5\cos t$, $v=-5\sin t$, $a=-s$; the speed is greatest at the rest position and zero at the ends. - **Higher derivatives:** sine and cosine repeat every four steps; reduce $n$ modulo $4$. - **Not yet:** $\sin 2x$ and $\sin^2x$ need the chain rule. - **Code:** `sp.diff(f, x, n)`; angles in `math.sin` are in radians. ## Glossary: key terms - **Radian**: The angle at the center of a circle that cuts off an arc as long as the radius; the unit in which the derivatives of sine and cosine take their simple form. - **Squeeze theorem**: If a quantity lies between two others that tend to the same limit, it tends to that limit too; it gives the limit of sin h over h as 1. - **Cofunction**: One of the functions cosine, cotangent and cosecant, whose derivative carries a minus sign, as in the derivative of cosine being minus sine. - **Secant function**: The reciprocal of the cosine, one over cos x; its derivative is sec x times tan x. - **Simple harmonic motion**: Motion in which the acceleration is always proportional to the displacement and points back to the rest position, so the position is a sine or cosine of time. - **Amplitude**: The greatest distance of an oscillating quantity from its rest position, such as the 5 in the motion s equals 5 cos t. - **Period**: The time after which an oscillation repeats itself; for sine and cosine of t it is 2π. - **Hooke's law**: The law that the force of a spring is proportional to its stretch and points back toward the rest position, which leads to simple harmonic motion. ## Frequently asked questions ### What is the derivative of sin x? The derivative of sine of x is cosine of x, when x is measured in radians. It follows from the angle-sum formula and the limits of sine h over h, which is 1, and cosine h minus 1 over h, which is 0, as h tends to zero. ### What is the derivative of cos x? The derivative of cosine of x is minus sine of x. The minus sign is there because the cosine starts at its peak and falls, so just after zero its slope is negative, and the slope curve is the sine curve turned upside down. ### What are the derivatives of tan, cot, sec and csc? Tangent has derivative secant squared, cotangent has minus cosecant squared, secant has secant times tangent, and cosecant has minus cosecant times cotangent. All four come from the quotient rule applied to sine and cosine. ### Why does calculus use radians for trigonometric derivatives? Only in radians does sine h over h tend to 1. In degrees the limit is pi over 180, about 0.01745, and every derivative of sine and cosine would carry that factor. Radians remove it, so the derivative of sine is exactly cosine. ### What is the limit of sin x over x as x approaches zero? It is 1, when x is in radians. The proof squeezes the quotient between cosine x and 1, using the areas of a triangle, a circular sector and a larger triangle, which give the inequality sine x is less than x, which is less than tangent x. ### What is the nth derivative of sin x? The derivatives of sine repeat every four steps: cosine, minus sine, minus cosine, then sine again. So divide n by 4 and look at the remainder: 1 gives cosine, 2 gives minus sine, 3 gives minus cosine, and 0 gives sine itself. ### What is simple harmonic motion? It is motion in which the acceleration is proportional to the displacement and points back to the rest position, like a weight on a spring. Its position is a sine or cosine of time, and its speed is greatest as it passes the rest position. ### How do you differentiate sin x times cos x? Use the product rule: the derivative of sine times cosine, plus sine times the derivative of cosine. That gives cosine squared minus sine squared, which is also the cosine of two x. --- # Turunan Fungsi Trigonometri Source: https://nunada.my.id/artikel/turunan-fungsi-trigonometri/ Updated: 2026-10-14 ## Jawaban singkat **Turunan sinus adalah kosinus dan turunan kosinus adalah minus sinus, untuk sudut dalam radian: $\frac{d}{dx}\sin x=\cos x$ dan $\frac{d}{dx}\cos x=-\sin x$.** Keempat fungsi lainnya mengikuti dari aturan hasil bagi: $\tan'x=\sec^2x$, $\cot'x=-\csc^2x$, $\sec'x=\sec x\tan x$, dan $\csc'x=-\csc x\cot x$. Semuanya bertumpu pada dua limit, $\frac{\sin h}{h}\to1$ dan $\frac{\cos h-1}{h}\to0$, yang hanya benar bila $h$ diukur dalam radian. ### Poin penting - Dua limit $\lim_{h\to0}\frac{\sin h}{h}=1$ dan $\lim_{h\to0}\frac{\cos h-1}{h}=0$ mengikuti dari apitan $\sin h0$) percepatannya mengarah ke atas, dan saat di atasnya ($s<0$) mengarah ke bawah: ia selalu mengarah kembali ke posisi diam. Pegas yang menarik dengan gaya sebanding dengan regangan, $F=-ks$, memberi tepat ini, dan itulah hukum Hooke. - **Sentakan.** $j=\frac{da}{dt}=5\sin t$. **Di mana laju terbesar?** Lajunya $|v|=5|\sin t|$. Ia terbesar, $5$ cm/s, bila $\sin t=\pm1$, yaitu bila $\cos t=0$, saat beban melewati **posisi diam** $s=0$. Ia $0$ di ujung ayunan, $s=\pm5$, tempat beban berbalik arah. Percepatan sebaliknya: besarnya terbesar di ujung, dan $0$ di posisi diam. Sentakan terbesar di posisi diam, tempat percepatan berganti tanda paling cepat. **Pemeriksaan energi.** Dari $s=5\cos t$ dan $v=-5\sin t$, $$s^2+v^2=25\cos^2t+25\sin^2t$$ $$=25=A^2,$$ sehingga titik berkoordinat $(s,v)$ mengelilingi lingkaran berjari-jari $5$: saat posisi besar kecepatan kecil, dan sebaliknya. **Periode lain.** Pegas yang lebih kaku atau beban yang lebih ringan berayun lebih cepat, dengan $s=A\cos(\omega t)$ untuk konstanta $\omega$, dan tiap turunan lalu mendapat faktor $\omega$. Itulah aturan rantai yang bekerja, yang belum diperlukan artikel ini: di sini $\omega=1$. Ubah amplitudo dan waktu di bawah dan perhatikan beban, kedua grafik, dan angkanya. ## Berapa turunan ke-n dari sin x atau cos x? **Turunan sinus dan kosinus berulang setiap empat langkah, sehingga turunan ke-$n$ hanya bergantung pada sisa $n$ dibagi $4$.** Mulai dari sinus turunannya berjalan $\sin x$, $\cos x$, $-\sin x$, $-\cos x$ lalu $\sin x$ lagi; mulai dari kosinus berjalan $\cos x$, $-\sin x$, $-\cos x$, $\sin x$ lalu $\cos x$ lagi. | $n$ dibagi $4$ bersisa | $\frac{d^n}{dx^n}\sin x$ | $\frac{d^n}{dx^n}\cos x$ | |---|---|---| | $0$ | $\sin x$ | $\cos x$ | | $1$ | $\cos x$ | $-\sin x$ | | $2$ | $-\sin x$ | $-\cos x$ | | $3$ | $-\cos x$ | $\sin x$ | Alasannya, turunan sinus mendahuluinya seperempat putaran: empat langkah seperti itu mengembalikan gelombang ke tempat ia mulai. Kedua fungsi memenuhi $y''=-y$, yaitu persamaan pegas pada bagian sebelumnya. **Tiga contoh.** [Turunan tingkat tinggi](https://nunada.my.id/artikel/aturan-turunan/#higher-order) biasa adalah $n$ langkah penurunan, jadi sederhanakan $n$ lebih dulu. - $\frac{d^{999}}{dx^{999}}\cos x$: $999=4\cdot249+3$, bersisa $3$, sehingga jawabannya $\sin x$. - $\frac{d^{110}}{dx^{110}}\left(\sin x-3\cos x\right)$: $110=4\cdot27+2$, bersisa $2$, sehingga tiap fungsi diganti negatifnya sendiri dan jawabannya $-\sin x+3\cos x$. - $\frac{d^{73}}{dx^{73}}\sin x$: $73=4\cdot18+1$, bersisa $1$, sehingga jawabannya $\cos x$. **Keempat fungsi lain tidak berulang.** Turunan tangen justru bertambah panjang: $\tan'x=\sec^2x$, $\tan''x=2\sec^2x\tan x$ dengan aturan hasil kali, dan tiap turunan berikutnya lebih panjang, karena $\sec$ dan $\tan$ terus saling mengalikan. Hanya sinus dan kosinus, gelombang yang berputar dalam lingkaran, yang berulang. ## Bagaimana menurunkan fungsi trigonometri dalam kode? **SymPy mengenal seluruh tabel: `sp.diff(sp.sin(x), x)` memberi `cos(x)`, dan `sp.diff(f, x, n)` mengambil turunan ke-$n$, bahkan untuk $n=999$.** SymPy menulis $\sec^2x$ sebagai `tan(x)**2 + 1`, yang fungsi yang sama menurut $\sec^2x=1+\tan^2x$. Program kedua memeriksa limit secara numerik. Dalam radian, `sin(h)/h` naik menuju $1$ dan `(cos(h) - 1)/h` mengecil seperti $-\frac h2$; dalam derajat, setelah diubah dengan `h * pi/180`, hasil bagi pertama menetap di $\frac{\pi}{180}=0{,}0174533$. ```python import sympy as sp x = sp.symbols('x') for f in (sp.sin(x), sp.cos(x), sp.tan(x), sp.cot(x), sp.sec(x), sp.csc(x)): print(f, '->', sp.diff(f, x)) # sin(x) -> cos(x) # cos(x) -> -sin(x) # tan(x) -> tan(x)**2 + 1 (that is sec(x)**2) # cot(x) -> -cot(x)**2 - 1 (that is -csc(x)**2) # sec(x) -> tan(x)*sec(x) # csc(x) -> -cot(x)*csc(x) print(sp.diff(sp.exp(x) * sp.sin(x), x)) # exp(x)*sin(x) + exp(x)*cos(x) print(sp.simplify(sp.diff(sp.cos(x) / (1 - sp.sin(x)), x))) # -1/(sin(x) - 1), which is 1/(1 - sin(x)) print(sp.diff(sp.cos(x), x, 999)) # sin(x) print(sp.diff(sp.sin(x) - 3 * sp.cos(x), x, 110)) # -sin(x) + 3*cos(x) ``` ```python import math for h in (0.1, 0.01, 0.001, 0.0001): print(h, round(math.sin(h) / h, 8), round((math.cos(h) - 1) / h, 8)) # 0.1 0.99833417 -0.04995835 # 0.01 0.99998333 -0.00499996 # 0.001 0.99999983 -0.0005 # 0.0001 1.0 -5e-05 d = math.pi / 180 # one degree, in radians for h in (1, 0.1, 0.01): print(h, round(math.sin(h * d) / h, 8)) # 0.01745241, 0.01745328, 0.01745329 print(round(d, 8)) # 0.01745329: the limit is pi/180, not 1 print(math.sin(30), math.sin(math.radians(30))) # -0.988... and 0.5: sin(30) treats 30 as radians for h in (0.1, 0.01, 0.001): print(h, (math.sin(1 + h) - math.sin(1 - h)) / (2 * h)) # 0.5394, 0.54029, 0.5403022 print(math.cos(1)) # 0.5403023: the central difference reaches cos(1) ``` ```cpp #include #include #include using namespace std; const double PI = acos(-1.0); int main() { double hs[4] = {0.1, 0.01, 0.001, 0.0001}; for (int i = 0; i < 4; i++) { double h = hs[i]; printf("%.4f %.8f %.8f\n", h, sin(h) / h, (cos(h) - 1) / h); // the two limits: 1 and 0 } double d = PI / 180; // one degree, in radians double ds[3] = {1, 0.1, 0.01}; for (int i = 0; i < 3; i++) printf("%.2f %.8f\n", ds[i], sin(ds[i] * d) / ds[i]); printf("%.8f\n", d); // the limit in degrees is pi/180, not 1 printf("%.6f %.6f\n", sin(30.0), sin(30 * d)); // sin(30) treats 30 as radians for (int i = 0; i < 3; i++) { double h = hs[i]; printf("%.4f %.7f\n", h, (sin(1 + h) - sin(1 - h)) / (2 * h)); // the central difference of sin at 1 } printf("%.7f\n", cos(1.0)); // ... reaches cos(1) return 0; } /* output: 0.1000 0.99833417 -0.04995835 0.0100 0.99998333 -0.00499996 0.0010 0.99999983 -0.00050000 0.0001 1.00000000 -0.00005000 1.00 0.01745241 0.10 0.01745328 0.01 0.01745329 0.01745329 -0.988032 0.500000 0.1000 0.5394023 0.0100 0.5402933 0.0010 0.5403022 0.5403023 */ ``` **Jebakan di bahasa apa pun adalah satuannya.** `math.sin`, `Math.sin`, dan `np.sin` dari NumPy semuanya mengharapkan radian, sehingga `math.sin(30)` adalah sinus $30$ radian, $-0{,}988$, bukan $0{,}5$. Ubah dengan `math.radians` lebih dulu. Satuan yang sama berada di balik rumus-rumus turunan: bilangan `cos(1)` dan selisih terpusat di atas hanya cocok karena $x=1$ adalah ukuran radian. ## Siapa yang pertama mempelajari sinus, dan kapan ia menjadi fungsi kalkulus? **Sinus bermula sebagai tabel panjang dalam astronomi, dan ia menjadi fungsi yang memiliki turunan hanya ketika radian dan deret tak hingga tiba.** - **Tali busur dan sinus pertama.** Astronom Yunani seperti Hipparchus dan, sekitar tahun 150, Ptolemeus menyusun tabel panjang tali busur lingkaran. Astronom India, pada abad kelima dan sesudahnya, mengganti tali busur dengan setengah tali busur, yaitu jya, yang adalah sinus. Kata "sinus" berasal darinya lewat bahasa Arab, yang diterjemahkan menjadi sinus dalam bahasa Latin. - **Deret.** Di mazhab Kerala di India, Madhava dari Sangamagrama dan penerusnya, sekitar abad ke-14, menemukan deret tak hingga untuk sinus dan kosinus, sekitar dua abad sebelum ditemukan kembali di Eropa. Isaac Newton memilikinya pada 1660-an dan memakainya dalam kalkulus. - **Radian.** Roger Cotes pada 1714 melihat bahwa ukuran alami sebuah sudut adalah panjang busurnya pada lingkaran berjari-jari $1$. Kata "radian" sendiri pertama kali muncul dalam cetakan pada 1873. - **Fungsi modern.** Leonhard Euler, dalam Introductio in analysin infinitorum (1748), memperlakukan sinus dan kosinus sebagai fungsi dari sebuah bilangan, dalam radian, dengan lambang yang kita pakai sekarang. - **Hukum Hooke.** Robert Hooke menerbitkan "seperti regangannya, begitu gayanya" pada 1678, hukum pegas di balik gerak harmonik sederhana. ## Kesalahan apa yang sering terjadi pada turunan trigonometri? **Kesalahan paling umum pada turunan trigonometri adalah sembilan hal berikut, masing-masing dengan pernyataan yang benar.** | Kesalahan | Yang benar | |---|---| | ❌ $\frac{d}{dx}\cos x=\sin x$ | Turunan kosinus bertanda minus: $-\sin x$. Kosinus mulai dari puncaknya lalu turun, sehingga gradiennya negatif. | | ❌ $\frac{d}{dx}\sin 2x=\cos 2x$ | Tabel itu untuk $\sin x$ dengan $x$ polos di dalamnya. Dengan $2x$ di dalam, gelombangnya dua kali lebih curam: turunannya $2\cos 2x$, dari [aturan rantai](https://nunada.my.id/artikel/aturan-rantai/#chain-rule). | | ❌ $\frac{d}{dx}\tan x=\sec x$ | Turunan tangen adalah $\sec^2x$. Ekspresi $\sec x\tan x$ adalah turunan $\sec x$. | | ❌ $\frac{d}{dx}\sec x=\sec^2x$ | $\sec^2x$ adalah turunan $\tan x$. Untuk sekan, $\sec'x=\sec x\tan x$. | | ❌ $\frac{d}{dx}\sin^2x=\cos^2x$ | $\sin^2x=\sin x\cdot\sin x$, dan aturan hasil kali memberi $\cos x\sin x+\sin x\cos x=2\sin x\cos x$. | | ❌ $\frac{d}{dx}(\sin x\cos x)=\cos x\cdot(-\sin x)$ | Aturan hasil kali memiliki dua suku: $\cos x\cdot\cos x+\sin x\cdot(-\sin x)=\cos^2x-\sin^2x$. | | ❌ $\frac{d}{dx}\sec x=\frac{1}{-\sin x}$ | Turunan sebuah kebalikan adalah $-\frac{f'}{f^2}$, bukan satu per turunannya: $\left(\frac{1}{\cos x}\right)'=\frac{\sin x}{\cos^2x}=\sec x\tan x$. | | ❌ $\lim_{h\to0}\frac{\sin h}{h}=0$ karena $\sin 0=0$ | Itu bentuk $\frac00$: pembilang dan penyebut sama-sama menuju $0$, dan apitan $\cos h<\frac{\sin h}{h}<1$ menunjukkan limitnya $1$. | | ❌ $\frac{d}{dx}\sin x=\cos x$ juga berlaku bila $x$ dalam derajat | Hanya dalam radian. Dalam derajat $\frac{d}{dx}\sin x^\circ=\frac{\pi}{180}\cos x^\circ$. | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: turunan fungsi trigonometri sekilas - **Dua limit:** $\frac{\sin h}{h}\to1$ dan $\frac{\cos h-1}{h}\to0$, dari apitan $\cos h<\frac{\sin h}{h}<1$; hanya dalam radian (dalam derajat yang pertama adalah $\frac{\pi}{180}$). - **Sinus dan kosinus:** $(\sin x)'=\cos x$ dan $(\cos x)'=-\sin x$, dengan rumus jumlah sudut. - **Empat lainnya:** $(\tan x)'=\sec^2x$, $(\cot x)'=-\csc^2x$, $(\sec x)'=\sec x\tan x$, $(\csc x)'=-\csc x\cot x$, dengan aturan hasil bagi; fungsi "ko" negatif. - **Gradien:** gradien $\tan x$ paling sedikit $1$; $y=x+2\sin x$ memiliki garis singgung mendatar di $\frac{2\pi}{3}$ dan $\frac{4\pi}{3}$ pada $[0,2\pi]$. - **Pegas:** $s=5\cos t$, $v=-5\sin t$, $a=-s$; laju terbesar di posisi diam dan nol di ujung. - **Turunan tingkat tinggi:** sinus dan kosinus berulang setiap empat langkah; sederhanakan $n$ modulo $4$. - **Belum:** $\sin 2x$ dan $\sin^2x$ memerlukan aturan rantai. - **Kode:** `sp.diff(f, x, n)`; sudut pada `math.sin` dalam radian. ## Glosarium: istilah penting - **Radian**: Sudut di pusat lingkaran yang memotong busur sepanjang jari-jarinya; satuan tempat turunan sinus dan kosinus berbentuk sederhana. - **Teorema apit**: Jika suatu besaran terletak di antara dua besaran lain yang menuju limit yang sama, ia menuju limit itu juga; teorema ini memberi limit sin h per h sebesar 1. - **Kofungsi**: Salah satu dari fungsi kosinus, kotangen, dan kosekan, yang turunannya bertanda minus, seperti turunan kosinus yang adalah minus sinus. - **Fungsi sekan**: Kebalikan kosinus, satu per cos x; turunannya adalah sec x kali tan x. - **Gerak harmonik sederhana**: Gerak yang percepatannya selalu sebanding dengan simpangan dan mengarah kembali ke posisi diam, sehingga posisinya adalah sinus atau kosinus dari waktu. - **Amplitudo**: Jarak terbesar besaran yang berosilasi dari posisi diamnya, seperti 5 pada gerak s sama dengan 5 cos t. - **Periode**: Waktu setelah mana suatu osilasi mengulang dirinya; untuk sinus dan kosinus dari t nilainya 2π. - **Hukum Hooke**: Hukum bahwa gaya pegas sebanding dengan regangannya dan mengarah kembali ke posisi diam, yang menghasilkan gerak harmonik sederhana. ## Pertanyaan yang sering diajukan ### Apa turunan sin x? Turunan sinus dari x adalah kosinus dari x, bila x diukur dalam radian. Ini mengikuti dari rumus jumlah sudut dan limit sin h per h, yaitu 1, dan cos h dikurangi 1 per h, yaitu 0, saat h menuju nol. ### Apa turunan cos x? Turunan kosinus dari x adalah minus sinus dari x. Tanda minusnya ada karena kosinus mulai dari puncaknya lalu turun, sehingga sesaat setelah nol gradiennya negatif, dan kurva gradiennya adalah kurva sinus yang dibalik. ### Apa turunan tan, cot, sec, dan csc? Tangen memiliki turunan sekan kuadrat, kotangen minus kosekan kuadrat, sekan sekan kali tangen, dan kosekan minus kosekan kali kotangen. Keempatnya berasal dari aturan hasil bagi yang diterapkan pada sinus dan kosinus. ### Mengapa kalkulus memakai radian untuk turunan trigonometri? Hanya dalam radian sin h per h menuju 1. Dalam derajat limitnya pi per 180, sekitar 0,01745, dan setiap turunan sinus dan kosinus akan membawa faktor itu. Radian menghilangkannya, sehingga turunan sinus tepat kosinus. ### Berapa limit sin x per x saat x mendekati nol? Nilainya 1, bila x dalam radian. Buktinya mengapit hasil bagi itu di antara kosinus x dan 1, memakai luas segitiga, juring, dan segitiga yang lebih besar, yang memberi pertidaksamaan sinus x kurang dari x, yang kurang dari tangen x. ### Berapa turunan ke-n dari sin x? Turunan sinus berulang setiap empat langkah: kosinus, minus sinus, minus kosinus, lalu sinus lagi. Jadi bagi n dengan 4 dan lihat sisanya: 1 memberi kosinus, 2 memberi minus sinus, 3 memberi minus kosinus, dan 0 memberi sinus sendiri. ### Apa itu gerak harmonik sederhana? Itu gerak yang percepatannya sebanding dengan simpangan dan mengarah kembali ke posisi diam, seperti beban pada pegas. Posisinya adalah sinus atau kosinus dari waktu, dan lajunya terbesar saat melewati posisi diam. ### Bagaimana menurunkan sin x kali cos x? Pakai aturan hasil kali: turunan sinus dikali kosinus, ditambah sinus dikali turunan kosinus. Hasilnya kosinus kuadrat dikurangi sinus kuadrat, yang juga adalah kosinus dua x. --- # The Derivative as a Rate of Change Source: https://nunada.my.id/articles/the-derivative-as-a-rate-of-change/ Updated: 2026-10-14 ## Quick answer **A derivative is a rate of change: it says how fast one quantity changes per unit of another, in the units of the first divided by the units of the second.** For a body moving along a line with position $s(t)$, velocity is $\frac{ds}{dt}$, speed is its absolute value, acceleration is $\frac{d^2s}{dt^2}$ and jerk is $\frac{d^3s}{dt^3}$. In economics the derivative of cost is the marginal cost, close to the price of one more unit. ### Key takeaways - The derivative $\frac{dy}{dx}$ is the instantaneous rate of change of $y$ with respect to $x$; its units are units of $y$ per unit of $x$, and it changes if you change the variable (area against radius or against diameter). - Velocity is $v=\frac{ds}{dt}$ and its sign is the direction; speed is $|v|$; acceleration is $a=\frac{dv}{dt}=\frac{d^2s}{dt^2}$; jerk is $\frac{da}{dt}$. A body speeds up when $v$ and $a$ have the same sign and slows down when they differ. - In free fall $s=4.9t^2$ metres gives $v=9.8t$ and the constant acceleration $9.8\ \text{m/s}^2$; a rock thrown up at $49$ m/s peaks after $5$ s at $122.5$ m and lands after $10$ s. - Marginal cost $c'(x)$ approximates the cost of one more unit, and marginal revenue $r'(x)$ the extra revenue; their difference estimates the extra profit. The approximation is good when the slope changes slowly. - A large $|f'|$ means that $f$ is sensitive to its input: a small change in $x$ makes a large change in $f(x)$. - From data, a derivative is a difference quotient, and every differentiation amplifies measurement noise: position noise of $0.01$ m becomes a velocity error of $0.7$ m/s and an acceleration error of about $60$ m/s². ## How do you measure how fast one quantity changes with another? **You take the derivative of the first quantity with respect to the second, and read it in units of the first per unit of the second.** If $y$ depends on $x$, the difference quotient $\frac{\Delta y}{\Delta x}$ is the average rate of change over a step, and its limit $\frac{dy}{dx}$ is the instantaneous rate of change. The word "instantaneous" is used even when $x$ is not time, and it is often dropped: "the rate of change" means the instantaneous one. This is the same limit as the [derivative at a point](https://nunada.my.id/articles/tangent-lines-and-derivative-at-a-point/#rates-of-change), now read as a rate. The units come out of the quotient. If the area $A$ of a circle is measured in square meters and its diameter $D$ in meters, then $\frac{dA}{dD}$ is in square meters per meter. For $A=\frac{\pi D^2}{4}$, $$\frac{dA}{dD}=\frac{\pi D}{2},$$ so when $D=10$ m the area is growing at $5\pi\approx15.71$ square meters for every extra meter of diameter. **The rate depends on the variable you choose.** The same circle measured by its radius has $A=\pi r^2$ and $\frac{dA}{dr}=2\pi r$. At $D=2r$ that is twice as large as $\frac{dA}{dD}$, because the diameter grows twice as fast as the radius. Like kilometers per hour against meters per second, a rate always belongs to a pair of units. **The rates that turn out to be geometry.** For a circle, $\frac{dA}{dr}=2\pi r$ is its circumference; for a sphere, $\frac{dV}{dr}=4\pi r^2$ is its surface area; for a cube, $\frac{dV}{da}=3a^2$ is the area of three faces. The reason is the same in each: a slightly larger shape is the old one plus a thin layer, and the layer's volume is its area times its thickness. **Estimating a change.** Since $\Delta y\approx\frac{dy}{dx}\,\Delta x$ for a small step, the rate gives a quick estimate. A sphere's radius grows from $2$ m to $2.2$ m: the volume rate at $r=2$ is $4\pi\cdot4\approx50.27$ cubic meters per meter, so $\Delta V\approx50.27\cdot0.2\approx10.05$ cubic meters. The exact change is $\frac43\pi\left(2.2^3-2^3\right)\approx11.09$, about $10\%$ more: the estimate uses the slope at the start of the step, and the surface grows as the sphere does. A smaller step shrinks the error. Pick a shape below and compare the exact increase with the rate. ## How do velocity, speed and acceleration come from derivatives? **For a body moving along a line with position $s(t)$, velocity is the derivative of position, acceleration is the derivative of velocity, and jerk is the derivative of acceleration: $v=\frac{ds}{dt}$, $a=\frac{dv}{dt}=\frac{d^2s}{dt^2}$ and $j=\frac{da}{dt}=\frac{d^3s}{dt^3}$.** The line is usually horizontal or vertical, and $s$ is the coordinate on it. - **Displacement and average velocity.** From $t$ to $t+\Delta t$ the displacement is $\Delta s=s(t+\Delta t)-s(t)$ and the average velocity is $\frac{\Delta s}{\Delta t}$. - **Velocity** is the limit of the average velocity as $\Delta t\to0$. Its sign is the direction: positive when $s$ is increasing (forward, or upward on a vertical line), negative when $s$ is decreasing. - **Speed** is the absolute value $|v|$, the rate of progress with no direction. A car driven to a friend's house and back at 50 km/h has a speedometer that shows 50 both ways, though its velocity is $+50$ then $-50$. - **Acceleration** says how fast the velocity changes: it is the second derivative of position. It is measured in units of velocity per unit of time, such as $\text{m/s}^2$. - **Jerk** is the rate of change of acceleration. A ride feels jerky when the acceleration changes abruptly, not necessarily when it is large. A graph of $s$ against $t$ is not the path of the body: the path lies on the line, and the graph shows where the body is when. Its slope is the velocity. **Speeding up or slowing down.** A body speeds up when velocity and acceleration have the same sign (it picks up speed in the direction it is going) and slows down when they have opposite signs. Acceleration alone does not tell you: $a<0$ with $v<0$ is a body moving backward and speeding up. **An example.** Take $s=t^3-6t^2+9t$ meters for $0\le t\le4$ seconds. Then $v=3t^2-12t+9=3(t-1)(t-3)$ and $a=6t-12$. The velocity is zero at $t=1$ and $t=3$, where the body turns round: $s(1)=4$ and $s(3)=0$. The table of the motion is - $00$, $a<0$, forward and slowing down; - $10$, backward and slowing down; - $30$, $a>0$, forward and speeding up. The displacement over $[0,4]$ is $s(4)-s(0)=4$ m and the average velocity is $1$ m/s, but the body actually travels $4+4+4=12$ m, because the distance is added up piece by piece between the turns. At $t=2$, where $a=0$, the speed is $|v(2)|=3$ m/s. Type your own position function below: it finds the turns exactly (even when they are not fractions), classifies every interval, and adds up the distance. ## How do you analyze free fall and a thrown object? **Near the surface of the Earth every falling body has the same constant acceleration $g\approx9.8\ \text{m/s}^2$, so its distance fallen from rest is $s=\frac12gt^2=4.9t^2$ meters, its velocity is $v=9.8t$ and its acceleration is the constant $9.8$.** The formula comes from Galileo's experiments and holds in a vacuum; it models a dense, heavy object well for the first few seconds, before air resistance matters. **A dropped ball bearing.** In the first $3$ s it falls $s(3)=4.9\cdot9=44.1$ m. Its velocity at that time is $v(3)=9.8\cdot3=29.4$ m/s downward, its speed is $29.4$ m/s and its acceleration is $9.8\ \text{m/s}^2$. Because the acceleration is constant, its jerk is $\frac{d}{dt}(9.8)=0$: nothing about free fall is jerky. **A rock thrown straight up.** A blast sends a rock up with launch speed $49$ m/s, so its height is $s=49t-4.9t^2$ meters, measured upward, and $v=49-9.8t$. - How high does it go? At the top the velocity is $0$: $49-9.8t=0$ gives $t=5$ s and $s(5)=245-122.5=122.5$ m. - Its speed at $78.4$ m, going up and coming down. Solving $49t-4.9t^2=78.4$ gives $4.9(t^2-10t+16)=0$, which [factors](https://nunada.my.id/articles/algebraic-expressions/#factor) as $(t-2)(t-8)=0$: the rock is at $78.4$ m after $2$ s going up and after $8$ s coming down. The velocities are $v(2)=29.4$ and $v(8)=-29.4$ m/s: the same speed, in opposite directions. - Its acceleration. $a=\frac{d}{dt}(49-9.8t)=-9.8\ \text{m/s}^2$ the whole time, up and down: gravity pulls downward, so the rock slows on the way up and speeds up on the way down. At the very top the velocity is zero and the acceleration is still $-9.8$. - When does it land? $s=49t-4.9t^2=4.9\,t\,(10-t)=0$ gives $t=0$ (the blast) and $t=10$ s. Its velocity on landing is $v(10)=-49$ m/s: it comes back at the speed it left with. **The same story with any launch speed $v_0$.** From $s=v_0t-\frac12gt^2$ the top is at $t=\frac{v_0}{g}$, its height is $\frac{v_0^2}{2g}$, the landing is at $t=\frac{2v_0}{g}$ (twice as long as the way up) and the landing velocity is $-v_0$. With $v_0=49$ and $g=9.8$ those are $5$ s, $\frac{2401}{19.6}=122.5$ m and $10$ s. The graph of $s$ against $t$ is a parabola, but the rock moves along a vertical line: the parabola shows height against time, and its slope at each instant is the velocity. The tool of the previous section handles these: try the preset `49t - 4.9t^2` on $0\le t\le10$. ## What are marginal cost, marginal revenue and marginal profit? **In economics a marginal quantity is a derivative: the marginal cost is the rate of change of the cost $c(x)$ with respect to the number of units $x$, $\frac{dc}{dx}$, and it estimates what one more unit costs.** The average cost of the next $h$ units is $\frac{c(x+h)-c(x)}{h}$; its limit as $h\to0$ is the marginal cost. Loosely, the marginal cost is defined as the extra cost of one more unit, $c(x+1)-c(x)$, which is approximated by $c'(x)$ when the slope of $c$ does not change quickly near $x$. The approximation often works well for large $x$. **Cost, fixed and variable.** A total cost function is often a cubic polynomial $c(x)=\alpha x^3+\beta x^2+\gamma x+\delta$. The constant $\delta$ is the fixed cost (rent, equipment, management) that does not depend on $x$; the other terms are variable costs (materials, labor). A cubic is usually enough to capture how cost behaves over a realistic range. **An example.** Let the cost of making $x$ radiators a day be $c(x)=x^3-6x^2+15x$ dollars, and the revenue from selling them $r(x)=x^3-3x^2+12x$ dollars. The shop makes $10$ a day. What does an eleventh cost, and what does it bring? - Marginal cost: $c'(x)=3x^2-12x+15$, so $c'(10)=300-120+15=195$ dollars. - Marginal revenue: $r'(x)=3x^2-6x+12$, so $r'(10)=300-60+12=252$ dollars. - Estimated profit from the extra radiator: $252-195=57$ dollars. The exact figures are $c(11)-c(10)=770-550=220$ dollars and $r(11)-r(10)=1100-820=280$ dollars, a profit of $60$. The estimates $195$, $252$ and $57$ are close but not equal, because the cost and revenue slopes rise as the output grows: the derivative is the rate at $x=10$, and one whole unit is a big step. A smaller step would agree better. **Marginal profit.** Profit is revenue minus cost, $p=r-c$, so marginal profit is $r'-c'$. It is zero where marginal revenue equals marginal cost, a place where producing a little more or a little less changes the profit by about nothing. Finding the best production level among such places is a question about optimization, taken up later. **Marginal tax rate.** Marginal rates appear in taxes too. If your marginal income tax rate is $28\%$ and your income rises by $1000$ dollars, you pay about $280$ dollars more in tax. That does not mean you pay $28\%$ of your whole income: it means $\frac{dT}{dI}=0.28$, the tax on each extra dollar. As income rises you may enter a higher bracket, and the marginal rate rises. Type any cost and revenue below and compare each marginal value with the exact one-unit change. ## How does the derivative measure sensitivity to change? **A function is sensitive to its input where a small change in $x$ produces a large change in $f(x)$, and the derivative $f'(x)$ measures exactly that: the larger $|f'(x)|$, the more sensitive $f$ is at $x$.** On a graph that is the steepness of the tangent line. **Peas and genes.** Gregor Mendel found that if $p$ (between $0$ and $1$) is the frequency of the gene for smooth skin in peas and $1-p$ that of wrinkled skin, then the proportion of smooth peas in the next generation is $$y=2p(1-p)+p^2=2p-p^2.$$ The derivative is $\frac{dy}{dp}=2-2p$, close to $2$ for $p$ near $0$ and close to $0$ for $p$ near $1$. So the result is much more sensitive to $p$ when $p$ is small: adding a few smooth-skin genes to a population that is mostly wrinkled has a much bigger effect on later generations than adding the same number to a population that is already mostly smooth. **Braking distance.** A model of the total stopping distance of a car at speed $V$ km/h is $s=0.21V+0.0063V^2$ meters: the linear part is the distance covered while the driver reacts, the quadratic part the braking distance. The derivative is $\frac{ds}{dV}=0.21+0.0126V$, which is $0.84$ meters per km/h at $50$ km/h and $1.47$ meters per km/h at $100$ km/h. The stopping distance is much more sensitive to speed when you are already going fast: from $50$ to $100$ km/h the speed doubles but the stopping distance goes from $26.25$ m to $84$ m, more than three times as far. **How to read a sensitivity.** The derivative is an absolute rate (units of $f$ per unit of $x$), so it is the right measure when the units mean something to you: meters of distance for each km/h. A graph of $f'$ next to the graph of $f$, as in [graphing the derivative](https://nunada.my.id/articles/the-derivative-as-a-function/#graphing-the-derivative), shows at a glance where $f$ is most and least sensitive. *Mendel's y = 2p − p² (green) and its derivative 2 − 2p (orange): the derivative is near 2 where p is small, so y is sensitive to p there, and near 0 where p is near 1.* ## How do you find rates of change from data in code? **When you have measurements instead of a formula, a derivative is a difference quotient of the data: use `numpy.gradient` on the positions to get velocities, and again on the velocities to get accelerations.** The function uses central differences inside the data and one-sided differences at the two ends. For a quadratic like free fall the central difference is exact, so the interior velocities are exactly $9.8t$ and the interior accelerations $9.8$, while the two end values are off, because a one-sided difference is only first-order accurate. ```python import numpy as np t = np.linspace(0, 3, 7) # a reading every half second s = 4.9 * t**2 # distance fallen, in meters v = np.gradient(s, t) # velocity a = np.gradient(v, t) # acceleration print(np.round(v, 2)) # [ 2.45 4.9 9.8 14.7 19.6 24.5 26.95] print(np.round(9.8 * t, 2)) # [ 0. 4.9 9.8 14.7 19.6 24.5 29.4 ] (the exact velocities) print(np.round(a, 2)) # [4.9 7.35 9.8 9.8 9.8 7.35 4.9 ] (the exact value is 9.8) c = lambda x: x**3 - 6*x**2 + 15*x # the radiators' cost print(c(11) - c(10), 3*10**2 - 12*10 + 15) # 220 195: the next unit against the marginal cost ``` **Differentiating data makes noise louder.** Real measurements have errors, and a derivative divides a difference of two nearby readings by a small time step, so a tiny position error becomes a larger velocity error, and differentiating again makes it far larger. The run below adds random noise of about $0.01$ m (a centimeter) to $301$ position readings of the same fall, $0.01$ s apart. The velocity from them is off by about $0.7$ m/s, and the acceleration by about $60$ m/s², which is six times the true value. To get usable rates from noisy data, smooth the data first, fit a model such as $s=\frac12gt^2$ to it, or use readings farther apart. ```python rng = np.random.default_rng(0) t = np.linspace(0, 3, 301) # a reading every 0.01 s s = 4.9 * t**2 + rng.normal(0, 0.01, t.size) # the same fall, with 1 cm of noise v = np.gradient(s, t) a = np.gradient(v, t) print(round(float(np.std(s - 4.9*t**2)), 4)) # 0.0102 position error, in m print(round(float(np.std(v[2:-2] - 9.8*t[2:-2])), 3)) # 0.716 velocity error, in m/s print(round(float(np.std(a[4:-4] - 9.8)), 1)) # 62.7 acceleration error, in m/s^2 ``` ```cpp #include #include using namespace std; int main() { double t[7], s[7], v[7], a[7]; // a reading every half second for (int i = 0; i < 7; i++) { t[i] = 0.5 * i; s[i] = 4.9 * t[i] * t[i]; } // distance fallen, in meters v[0] = (s[1] - s[0]) / 0.5; // velocity: one-sided at the ends, central inside v[6] = (s[6] - s[5]) / 0.5; for (int i = 1; i < 6; i++) v[i] = (s[i + 1] - s[i - 1]) / 1.0; a[0] = (v[1] - v[0]) / 0.5; // acceleration: the same, applied to the velocity a[6] = (v[6] - v[5]) / 0.5; for (int i = 1; i < 6; i++) a[i] = (v[i + 1] - v[i - 1]) / 1.0; for (int i = 0; i < 7; i++) printf("%6.2f", v[i]); // 2.45 4.9 9.8 14.7 19.6 24.5 26.95 cout << endl; for (int i = 0; i < 7; i++) printf("%6.2f", 9.8 * t[i]); // the exact velocities cout << endl; for (int i = 0; i < 7; i++) printf("%6.2f", a[i]); // the exact acceleration is 9.8 cout << endl; cout << (11 * 11 * 11 - 6 * 11 * 11 + 15 * 11) - (10 * 10 * 10 - 6 * 10 * 10 + 15 * 10) << " " << 3 * 10 * 10 - 12 * 10 + 15 << endl; // 220 195: the next unit against the marginal cost // noise grows with every derivative: readings every 0.01 s, each off by 0, +0.01 or -0.01 m double noise[3] = {0.01, -0.01, 0}; double e[40], ve[40], ae[40], h = 0.01; for (int i = 0; i < 40; i++) e[i] = noise[i % 3]; for (int i = 1; i < 39; i++) ve[i] = (e[i + 1] - e[i - 1]) / (2 * h); double maxS = 0, maxV = 0, maxA = 0; for (int i = 0; i < 40; i++) if (e[i] > maxS) maxS = e[i]; for (int i = 2; i < 38; i++) { ae[i] = (ve[i + 1] - ve[i - 1]) / (2 * h); if (ve[i] > maxV) maxV = ve[i]; if (ae[i] > maxA) maxA = ae[i]; } printf("%.2f %.1f %.1f\n", maxS, maxV, maxA); // the error in m, in m/s and in m/s^2 return 0; } /* output: 2.45 4.90 9.80 14.70 19.60 24.50 26.95 0.00 4.90 9.80 14.70 19.60 24.50 29.40 4.90 7.35 9.80 9.80 9.80 7.35 4.90 220 195 0.01 1.0 75.0 */ ``` ## Who first measured instantaneous speed and marginal change? **Speed at an instant was a puzzle for two thousand years before calculus gave it a definition, and the economists' "margin" arrived two centuries after that.** - **Galileo.** In his Discourses on Two New Sciences (1638) Galileo showed that a body falling from rest covers distances in proportion to the square of the time, $s\propto t^2$, which is the law $s=\frac12gt^2$ used here. He found it by rolling balls down inclined planks, which slows the motion enough to time it. - **The Oxford Calculators.** Scholars at Merton College, Oxford, in the 1330s distinguished uniform from non-uniform motion and defined "instantaneous velocity" in words; their mean speed theorem was drawn as a graph of speed against time by Nicole Oresme around 1350, centuries before the derivative. - **Newton.** In the 1660s Isaac Newton treated velocity as the fluxion of position, the rate at which a flowing quantity changes, and acceleration as the fluxion of velocity: the derivative was invented, in part, to talk about motion. - **Marginal economics.** Augustin Cournot used the derivative in his 1838 book on the mathematical theory of wealth to find the output that maximizes a firm's profit. The word "marginal" in economics comes from Friedrich von Wieser (1884), and the "marginal revolution" of the 1870s made it central. ## What mistakes do people make with rates of change? **The most common mistakes with rates of change are the nine below, each with the correct statement.** | Mistake | Correct | |---|---| | ❌ Speed can be negative | Speed is the absolute value of velocity and is never negative; velocity is the one with a sign. | | ❌ A negative acceleration means the body is slowing down | Only when the velocity is positive. A body with $v<0$ and $a<0$ moves backward and speeds up. | | ❌ When the velocity is zero the acceleration is zero | A rock at the top of its flight has $v=0$ but still $a=-9.8\ \text{m/s}^2$. | | ❌ The graph of $s$ against $t$ is the path of the body | The path is the line the body moves on; the graph shows position against time, and its slope is the velocity. | | ❌ Total distance equals displacement | Displacement is $s(t_1)-s(t_0)$; distance adds up the sizes of the changes of $s$ between the turns, so it can be larger (12 m against 4 m in the example). | | ❌ The average velocity is always $\frac{v_0+v_1}{2}$ | That holds only when the acceleration is constant. The average velocity is displacement over time. | | ❌ Marginal cost is the total cost divided by the number of units | That is the average cost. Marginal cost is the derivative $c'(x)$, the cost of one more unit. | | ❌ With a 28% marginal tax rate you pay 28% of your whole income in tax | You pay 28% of each extra unit of income; the marginal rate is $\frac{dT}{dI}$. | | ❌ The rate $\frac{dA}{dr}$ and the rate $\frac{dA}{dD}$ of a circle are the same | They differ because the variables differ: $\frac{dA}{dr}=2\pi r$ but $\frac{dA}{dD}=\frac{\pi D}{2}=\pi r$, half as large. | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: the derivative as a rate of change at a glance - **Rate of change:** $\frac{dy}{dx}=\lim\frac{\Delta y}{\Delta x}$ in units of $y$ per unit of $x$; it depends on the variable chosen; $\Delta y\approx\frac{dy}{dx}\Delta x$ for small steps. - **Motion:** $v=\frac{ds}{dt}$ (sign = direction), speed $=|v|$, $a=\frac{d^2s}{dt^2}$, $j=\frac{da}{dt}$; speeding up when $v$ and $a$ have the same sign; distance adds $|\Delta s|$ between the turns, displacement is $s(t_1)-s(t_0)$. - **Free fall:** $s=4.9t^2$, $v=9.8t$, $a=9.8$, $j=0$; thrown up at $v_0$: top at $\frac{v_0}{g}$, height $\frac{v_0^2}{2g}$, landing at $\frac{2v_0}{g}$ with velocity $-v_0$. - **Marginals:** marginal cost $c'(x)\approx c(x+1)-c(x)$, marginal revenue $r'$, marginal profit $r'-c'$; marginal tax rate is the tax on the next unit of income. - **Sensitivity:** a large $|f'|$ means a small change in $x$ makes a large change in $f$ (Mendel's peas, braking distance). - **Data and code:** `numpy.gradient` for velocity and acceleration from readings; each derivative amplifies noise. ## Glossary: key terms - **Velocity**: The derivative of position with respect to time; its size is the speed and its sign is the direction of motion along a line. - **Speed**: The absolute value of velocity, the rate of progress regardless of direction, which is never negative. - **Acceleration**: The derivative of velocity with respect to time, which is also the second derivative of position; it measures how fast a body gains or loses velocity. - **Jerk**: The derivative of acceleration with respect to time, which is the third derivative of position; a ride is jerky when the acceleration changes abruptly. - **Displacement**: The change in position from the start to the end of a time interval, found by subtracting the starting position from the final one; it can be smaller than the distance travelled. - **Marginal cost**: The derivative of the cost of production with respect to the number of units produced, which approximates the cost of making one more unit. - **Marginal revenue**: The derivative of revenue with respect to the number of units sold, which approximates the extra revenue from selling one more unit. - **Sensitivity to change**: How strongly a function responds to a small change in its input, measured by the size of its derivative: the steeper the graph, the more sensitive the function. ## Frequently asked questions ### What is the derivative of position? The derivative of position with respect to time is velocity. Differentiate velocity and you get acceleration, which is the second derivative of position. The sign of the velocity tells the direction of motion along the line, and its size is the speed. ### What is the difference between velocity and speed? Velocity is the derivative of position and has a sign that gives the direction, so it can be negative. Speed is the absolute value of velocity and is never negative. A car driven out and back at 50 kilometers per hour has speed 50 both ways but velocity 50 and then minus 50. ### What is acceleration in calculus? Acceleration is the derivative of velocity with respect to time, which is the second derivative of position. It is measured in units of velocity per unit of time, such as meters per second squared. In free fall near the Earth it is the constant 9.8. ### What is jerk? Jerk is the derivative of acceleration with respect to time, the third derivative of position. A ride feels jerky when the acceleration changes abruptly, not necessarily when it is large. In free fall the acceleration is constant, so the jerk is zero. ### How do you tell whether an object is speeding up or slowing down? Compare the signs of velocity and acceleration. If they are the same the object speeds up, and if they are opposite it slows down. A negative acceleration with a negative velocity means moving backward and speeding up, so acceleration alone is not enough. ### What is marginal cost? Marginal cost is the derivative of the cost of production with respect to the number of units made. It approximates the extra cost of making one more unit, and the approximation is good when the slope of the cost curve changes slowly near the current output. ### What is the difference between marginal cost and average cost? Average cost is the total cost divided by the number of units, so it spreads the whole cost over all units. Marginal cost is the derivative of the total cost, the cost of the next unit. They are equal only at special production levels. ### How far does an object fall in free fall? Starting from rest near the surface of the Earth and ignoring air resistance, an object falls 4.9 times the square of the time in meters. After 3 seconds that is 44.1 meters, and its velocity is then 9.8 times the time, which is 29.4 meters per second. ### What are the units of a derivative? The units of the quantity being differentiated divided by the units of the variable. Position in meters against time in seconds gives meters per second, and cost in dollars against units made gives dollars per unit. Changing the variable, such as radius to diameter, changes the number. --- # Turunan sebagai Laju Perubahan Source: https://nunada.my.id/artikel/turunan-sebagai-laju-perubahan/ Updated: 2026-10-14 ## Jawaban singkat **Turunan adalah laju perubahan: ia menyatakan seberapa cepat satu besaran berubah per satuan besaran lain, dalam satuan yang pertama dibagi satuan yang kedua.** Untuk benda yang bergerak sepanjang garis lurus dengan posisi $s(t)$, kecepatan adalah $\frac{ds}{dt}$, laju adalah nilai mutlaknya, percepatan adalah $\frac{d^2s}{dt^2}$, dan sentakan adalah $\frac{d^3s}{dt^3}$. Dalam ekonomi turunan biaya adalah biaya marjinal, yang dekat dengan harga satu satuan lagi. ### Poin penting - Turunan $\frac{dy}{dx}$ adalah laju perubahan sesaat $y$ terhadap $x$; satuannya adalah satuan $y$ per satuan $x$, dan ia berubah bila peubahnya diganti (luas terhadap jari-jari atau terhadap diameter). - Kecepatan adalah $v=\frac{ds}{dt}$ dan tandanya adalah arah; laju adalah $|v|$; percepatan adalah $a=\frac{dv}{dt}=\frac{d^2s}{dt^2}$; sentakan adalah $\frac{da}{dt}$. Benda makin cepat bila $v$ dan $a$ bertanda sama dan makin lambat bila berbeda. - Pada jatuh bebas $s=4{,}9t^2$ meter memberi $v=9{,}8t$ dan percepatan tetap $9{,}8\ \text{m/s}^2$; batu yang dilempar ke atas dengan $49$ m/s mencapai puncak setelah $5$ detik pada $122{,}5$ m dan mendarat setelah $10$ detik. - Biaya marjinal $c'(x)$ menghampiri biaya satu satuan lagi, dan pendapatan marjinal $r'(x)$ pendapatan tambahannya; selisihnya menaksir laba tambahan. Hampiran itu baik bila gradiennya berubah pelan. - $|f'|$ yang besar berarti $f$ peka terhadap masukannya: perubahan kecil pada $x$ membuat perubahan besar pada $f(x)$. - Dari data, turunan adalah hasil bagi selisih, dan setiap penurunan memperbesar derau pengukuran: derau posisi $0{,}01$ m menjadi galat kecepatan $0{,}7$ m/s dan galat percepatan sekitar $60$ m/s². ## Bagaimana mengukur seberapa cepat satu besaran berubah terhadap besaran lain? **Kamu menurunkan besaran pertama terhadap besaran kedua, dan membacanya dalam satuan yang pertama per satuan yang kedua.** Jika $y$ bergantung pada $x$, hasil bagi selisih $\frac{\Delta y}{\Delta x}$ adalah laju perubahan rata-rata pada suatu langkah, dan limitnya $\frac{dy}{dx}$ adalah laju perubahan sesaat. Kata "sesaat" dipakai juga bila $x$ bukan waktu, dan sering dihilangkan: "laju perubahan" berarti yang sesaat. Ini limit yang sama dengan [turunan di suatu titik](https://nunada.my.id/artikel/garis-singgung-dan-turunan-di-suatu-titik/#rates-of-change), kini dibaca sebagai laju. Satuannya muncul dari hasil bagi. Jika luas $A$ lingkaran diukur dalam meter persegi dan diameternya $D$ dalam meter, maka $\frac{dA}{dD}$ dalam meter persegi per meter. Untuk $A=\frac{\pi D^2}{4}$, $$\frac{dA}{dD}=\frac{\pi D}{2},$$ sehingga saat $D=10$ m luasnya bertambah $5\pi\approx15{,}71$ meter persegi untuk setiap tambahan satu meter diameter. **Laju bergantung pada peubah yang kamu pilih.** Lingkaran yang sama diukur dengan jari-jarinya memiliki $A=\pi r^2$ dan $\frac{dA}{dr}=2\pi r$. Pada $D=2r$ itu dua kali lebih besar daripada $\frac{dA}{dD}$, karena diameter bertambah dua kali lebih cepat daripada jari-jari. Seperti kilometer per jam terhadap meter per detik, laju selalu milik sepasang satuan. **Laju yang ternyata geometri.** Untuk lingkaran, $\frac{dA}{dr}=2\pi r$ adalah kelilingnya; untuk bola, $\frac{dV}{dr}=4\pi r^2$ adalah luas permukaannya; untuk kubus, $\frac{dV}{da}=3a^2$ adalah luas tiga sisinya. Alasannya sama pada tiap kasus: bangun yang sedikit lebih besar adalah bangun lama ditambah selapis tipis, dan volume lapisan itu adalah luasnya kali tebalnya. **Menaksir perubahan.** Karena $\Delta y\approx\frac{dy}{dx}\,\Delta x$ untuk langkah kecil, laju memberi taksiran cepat. Jari-jari bola bertambah dari $2$ m ke $2{,}2$ m: laju volume di $r=2$ adalah $4\pi\cdot4\approx50{,}27$ meter kubik per meter, sehingga $\Delta V\approx50{,}27\cdot0{,}2\approx10{,}05$ meter kubik. Perubahan eksaknya $\frac43\pi\left(2{,}2^3-2^3\right)\approx11{,}09$, sekitar $10\%$ lebih besar: taksiran memakai gradien di awal langkah, dan permukaannya membesar bersama bola. Langkah yang lebih kecil memperkecil galatnya. Pilih sebuah bangun di bawah dan bandingkan pertambahan eksak dengan lajunya. ## Bagaimana kecepatan, laju, dan percepatan berasal dari turunan? **Untuk benda yang bergerak sepanjang garis lurus dengan posisi $s(t)$, kecepatan adalah turunan posisi, percepatan adalah turunan kecepatan, dan sentakan adalah turunan percepatan: $v=\frac{ds}{dt}$, $a=\frac{dv}{dt}=\frac{d^2s}{dt^2}$, dan $j=\frac{da}{dt}=\frac{d^3s}{dt^3}$.** Garisnya biasanya mendatar atau tegak, dan $s$ adalah koordinat pada garis itu. - **Perpindahan dan kecepatan rata-rata.** Dari $t$ sampai $t+\Delta t$ perpindahannya $\Delta s=s(t+\Delta t)-s(t)$ dan kecepatan rata-ratanya $\frac{\Delta s}{\Delta t}$. - **Kecepatan** adalah limit kecepatan rata-rata saat $\Delta t\to0$. Tandanya adalah arah: positif bila $s$ bertambah (maju, atau naik pada garis tegak), negatif bila $s$ berkurang. - **Laju** adalah nilai mutlak $|v|$, kemajuan tanpa arah. Mobil yang dikendarai ke rumah teman dan kembali dengan 50 km/jam memiliki spidometer yang menunjukkan 50 pada kedua arah, padahal kecepatannya $+50$ lalu $-50$. - **Percepatan** menyatakan seberapa cepat kecepatan berubah: ia turunan kedua posisi. Satuannya satuan kecepatan per satuan waktu, seperti $\text{m/s}^2$. - **Sentakan** adalah laju perubahan percepatan. Perjalanan terasa tersentak-sentak bila percepatan berubah mendadak, belum tentu bila ia besar. Grafik $s$ terhadap $t$ bukan lintasan benda: lintasannya terletak pada garis, dan grafik memperlihatkan di mana benda itu kapan. Gradiennya adalah kecepatan. **Makin cepat atau makin lambat.** Benda makin cepat bila kecepatan dan percepatan bertanda sama (ia menambah laju searah geraknya) dan makin lambat bila bertanda berlawanan. Percepatan saja belum menentukan: $a<0$ dengan $v<0$ adalah benda yang bergerak mundur dan makin cepat. **Contoh.** Ambil $s=t^3-6t^2+9t$ meter untuk $0\le t\le4$ detik. Maka $v=3t^2-12t+9=3(t-1)(t-3)$ dan $a=6t-12$. Kecepatan nol di $t=1$ dan $t=3$, tempat benda berbalik arah: $s(1)=4$ dan $s(3)=0$. Tabel geraknya: - $00$, $a<0$, maju dan makin lambat; - $10$, mundur dan makin lambat; - $30$, $a>0$, maju dan makin cepat. Perpindahan pada $[0,4]$ adalah $s(4)-s(0)=4$ m dan kecepatan rata-ratanya $1$ m/s, tetapi benda sebenarnya menempuh $4+4+4=12$ m, karena jarak dijumlahkan bagian demi bagian di antara putaran balik. Di $t=2$, tempat $a=0$, lajunya $|v(2)|=3$ m/s. Ketik fungsi posisimu sendiri di bawah: alat itu menemukan putaran balik secara eksak (bahkan bila bukan pecahan), mengklasifikasi setiap selang, dan menjumlahkan jaraknya. ## Bagaimana menganalisis jatuh bebas dan benda yang dilempar? **Di dekat permukaan Bumi setiap benda jatuh memiliki percepatan tetap yang sama $g\approx9{,}8\ \text{m/s}^2$, sehingga jarak jatuhnya dari keadaan diam adalah $s=\frac12gt^2=4{,}9t^2$ meter, kecepatannya $v=9{,}8t$, dan percepatannya tetap $9{,}8$.** Rumus ini berasal dari percobaan Galileo dan berlaku dalam ruang hampa; ia memodelkan benda padat dan berat dengan baik selama beberapa detik pertama, sebelum hambatan udara berarti. **Bola baja yang dijatuhkan.** Dalam $3$ detik pertama ia jatuh $s(3)=4{,}9\cdot9=44{,}1$ m. Kecepatannya saat itu $v(3)=9{,}8\cdot3=29{,}4$ m/s ke bawah, lajunya $29{,}4$ m/s, dan percepatannya $9{,}8\ \text{m/s}^2$. Karena percepatannya tetap, sentakannya $\frac{d}{dt}(9{,}8)=0$: tidak ada yang tersentak-sentak pada jatuh bebas. **Batu yang dilempar lurus ke atas.** Sebuah ledakan melontarkan batu ke atas dengan laju awal $49$ m/s, sehingga tingginya $s=49t-4{,}9t^2$ meter, diukur ke atas, dan $v=49-9{,}8t$. - Seberapa tinggi ia naik? Di puncak kecepatannya $0$: $49-9{,}8t=0$ memberi $t=5$ detik dan $s(5)=245-122{,}5=122{,}5$ m. - Lajunya di $78{,}4$ m, saat naik dan saat turun. Menyelesaikan $49t-4{,}9t^2=78{,}4$ memberi $4{,}9(t^2-10t+16)=0$, yang [difaktorkan](https://nunada.my.id/artikel/bentuk-aljabar/#factor) menjadi $(t-2)(t-8)=0$: batu berada di $78{,}4$ m setelah $2$ detik saat naik dan setelah $8$ detik saat turun. Kecepatannya $v(2)=29{,}4$ dan $v(8)=-29{,}4$ m/s: laju yang sama, dengan arah berlawanan. - Percepatannya. $a=\frac{d}{dt}(49-9{,}8t)=-9{,}8\ \text{m/s}^2$ sepanjang waktu, naik dan turun: gravitasi menarik ke bawah, sehingga batu melambat saat naik dan makin cepat saat turun. Di puncak kecepatannya nol dan percepatannya tetap $-9{,}8$. - Kapan ia mendarat? $s=49t-4{,}9t^2=4{,}9\,t\,(10-t)=0$ memberi $t=0$ (ledakan) dan $t=10$ detik. Kecepatannya saat mendarat $v(10)=-49$ m/s: ia kembali dengan laju yang sama dengan saat berangkat. **Cerita yang sama untuk laju awal $v_0$ mana pun.** Dari $s=v_0t-\frac12gt^2$ puncaknya di $t=\frac{v_0}{g}$, tingginya $\frac{v_0^2}{2g}$, pendaratannya di $t=\frac{2v_0}{g}$ (dua kali lebih lama daripada naiknya) dan kecepatan mendaratnya $-v_0$. Dengan $v_0=49$ dan $g=9{,}8$ nilainya $5$ detik, $\frac{2401}{19{,}6}=122{,}5$ m, dan $10$ detik. Grafik $s$ terhadap $t$ adalah parabola, tetapi batu bergerak sepanjang garis tegak: parabola itu menunjukkan tinggi terhadap waktu, dan gradiennya di tiap saat adalah kecepatan. Alat pada bagian sebelumnya menangani semua ini: coba prasetel `49t - 4.9t^2` pada $0\le t\le10$. ## Apa itu biaya, pendapatan, dan laba marjinal? **Dalam ekonomi besaran marjinal adalah turunan: biaya marjinal adalah laju perubahan biaya $c(x)$ terhadap banyak satuan $x$, $\frac{dc}{dx}$, dan ia menaksir berapa biaya satu satuan lagi.** Biaya rata-rata $h$ satuan berikutnya adalah $\frac{c(x+h)-c(x)}{h}$; limitnya saat $h\to0$ adalah biaya marjinal. Secara longgar, biaya marjinal didefinisikan sebagai tambahan biaya satu satuan lagi, $c(x+1)-c(x)$, yang dihampiri oleh $c'(x)$ bila gradien $c$ tidak berubah cepat di dekat $x$. Hampiran itu sering bekerja baik untuk $x$ besar. **Biaya tetap dan biaya variabel.** Fungsi biaya total sering berupa polinomial kubik $c(x)=\alpha x^3+\beta x^2+\gamma x+\delta$. Konstanta $\delta$ adalah biaya tetap (sewa, peralatan, manajemen) yang tidak bergantung pada $x$; suku lainnya adalah biaya variabel (bahan, tenaga kerja). Kubik biasanya cukup untuk menangkap perilaku biaya pada rentang yang realistis. **Contoh.** Misalkan biaya membuat $x$ radiator sehari adalah $c(x)=x^3-6x^2+15x$ ribu rupiah, dan pendapatan dari menjualnya $r(x)=x^3-3x^2+12x$ ribu rupiah. Toko membuat $10$ sehari. Berapa biaya radiator kesebelas, dan berapa yang dihasilkannya? - Biaya marjinal: $c'(x)=3x^2-12x+15$, sehingga $c'(10)=300-120+15=195$ ribu rupiah. - Pendapatan marjinal: $r'(x)=3x^2-6x+12$, sehingga $r'(10)=300-60+12=252$ ribu rupiah. - Taksiran laba dari radiator tambahan itu: $252-195=57$ ribu rupiah. Angka eksaknya $c(11)-c(10)=770-550=220$ ribu rupiah dan $r(11)-r(10)=1100-820=280$ ribu rupiah, laba $60$. Taksiran $195$, $252$, dan $57$ dekat tetapi tidak sama, karena gradien biaya dan pendapatan naik seiring produksi: turunan adalah laju di $x=10$, dan satu satuan penuh adalah langkah yang besar. Langkah yang lebih kecil akan lebih cocok. **Laba marjinal.** Laba adalah pendapatan dikurangi biaya, $p=r-c$, sehingga laba marjinal adalah $r'-c'$. Ia nol di tempat pendapatan marjinal sama dengan biaya marjinal, tempat memproduksi sedikit lebih banyak atau lebih sedikit mengubah laba hampir tidak sama sekali. Mencari tingkat produksi terbaik di antara tempat-tempat seperti itu adalah soal optimasi, yang dibahas kemudian. **Tarif pajak marjinal.** Laju marjinal muncul juga pada pajak. Jika tarif pajak penghasilan marjinalmu $28\%$ dan penghasilanmu naik Rp1.000.000, kamu membayar sekitar Rp280.000 lebih banyak. Itu tidak berarti kamu membayar $28\%$ dari seluruh penghasilan: artinya $\frac{dT}{dI}=0{,}28$, pajak atas setiap rupiah tambahan. Saat penghasilan naik kamu mungkin masuk lapisan yang lebih tinggi, dan tarif marjinalnya naik. Ketik biaya dan pendapatan apa pun di bawah dan bandingkan setiap nilai marjinal dengan perubahan eksak satu satuan. ## Bagaimana turunan mengukur kepekaan terhadap perubahan? **Fungsi peka terhadap masukannya di tempat perubahan kecil pada $x$ menghasilkan perubahan besar pada $f(x)$, dan turunan $f'(x)$ mengukur tepat itu: makin besar $|f'(x)|$, makin peka $f$ di $x$.** Pada grafik itu adalah kecuraman garis singgung. **Kacang polong dan gen.** Gregor Mendel menemukan bahwa jika $p$ (di antara $0$ dan $1$) adalah frekuensi gen kulit halus pada kacang polong dan $1-p$ frekuensi gen kulit keriput, maka proporsi kacang halus pada generasi berikutnya adalah $$y=2p(1-p)+p^2=2p-p^2.$$ Turunannya $\frac{dy}{dp}=2-2p$, dekat $2$ untuk $p$ dekat $0$ dan dekat $0$ untuk $p$ dekat $1$. Jadi hasilnya jauh lebih peka terhadap $p$ ketika $p$ kecil: menambahkan beberapa gen kulit halus ke populasi yang kebanyakan keriput berpengaruh jauh lebih besar pada generasi berikutnya daripada menambahkan jumlah yang sama ke populasi yang sudah kebanyakan halus. **Jarak pengereman.** Sebuah model jarak henti total mobil pada kecepatan $V$ km/jam adalah $s=0{,}21V+0{,}0063V^2$ meter: bagian linear adalah jarak yang ditempuh selagi pengemudi bereaksi, bagian kuadrat adalah jarak pengereman. Turunannya $\frac{ds}{dV}=0{,}21+0{,}0126V$, yaitu $0{,}84$ meter per km/jam pada $50$ km/jam dan $1{,}47$ meter per km/jam pada $100$ km/jam. Jarak henti jauh lebih peka terhadap kecepatan ketika kamu sudah melaju cepat: dari $50$ ke $100$ km/jam kecepatan menjadi dua kali, tetapi jarak henti naik dari $26{,}25$ m menjadi $84$ m, lebih dari tiga kali. **Cara membaca kepekaan.** Turunan adalah laju mutlak (satuan $f$ per satuan $x$), sehingga ia ukuran yang tepat bila satuannya bermakna bagimu: meter jarak untuk setiap km/jam. Grafik $f'$ di samping grafik $f$, seperti pada [menggambar grafik turunan](https://nunada.my.id/artikel/turunan-sebagai-fungsi/#graphing-the-derivative), memperlihatkan sekilas di mana $f$ paling dan paling kurang peka. *y = 2p − p² dari Mendel (hijau) dan turunannya 2 − 2p (jingga): turunan dekat 2 di tempat p kecil, sehingga y peka terhadap p di sana, dan dekat 0 di tempat p dekat 1.* ## Bagaimana mencari laju perubahan dari data dalam kode? **Bila yang kamu miliki pengukuran dan bukan rumus, turunan adalah hasil bagi selisih dari data: pakai `numpy.gradient` pada posisi untuk mendapat kecepatan, dan sekali lagi pada kecepatan untuk mendapat percepatan.** Fungsi itu memakai selisih terpusat di bagian dalam data dan selisih sepihak di kedua ujung. Untuk kuadrat seperti jatuh bebas selisih terpusat eksak, sehingga kecepatan di bagian dalam tepat $9{,}8t$ dan percepatannya $9{,}8$, sedangkan kedua nilai ujung meleset, karena selisih sepihak hanya akurat orde pertama. ```python import numpy as np t = np.linspace(0, 3, 7) # a reading every half second s = 4.9 * t**2 # distance fallen, in meters v = np.gradient(s, t) # velocity a = np.gradient(v, t) # acceleration print(np.round(v, 2)) # [ 2.45 4.9 9.8 14.7 19.6 24.5 26.95] print(np.round(9.8 * t, 2)) # [ 0. 4.9 9.8 14.7 19.6 24.5 29.4 ] (the exact velocities) print(np.round(a, 2)) # [4.9 7.35 9.8 9.8 9.8 7.35 4.9 ] (the exact value is 9.8) c = lambda x: x**3 - 6*x**2 + 15*x # the radiators' cost print(c(11) - c(10), 3*10**2 - 12*10 + 15) # 220 195: the next unit against the marginal cost ``` **Menurunkan data membuat derau makin keras.** Pengukuran nyata memiliki galat, dan turunan membagi selisih dua bacaan berdekatan dengan langkah waktu yang kecil, sehingga galat posisi yang kecil menjadi galat kecepatan yang lebih besar, dan menurunkan lagi membuatnya jauh lebih besar. Percobaan di bawah menambahkan derau acak sekitar $0{,}01$ m (satu sentimeter) pada $301$ bacaan posisi jatuh yang sama, berjarak $0{,}01$ detik. Kecepatan dari bacaan itu meleset sekitar $0{,}7$ m/s, dan percepatannya sekitar $60$ m/s², yaitu enam kali nilai sebenarnya. Untuk mendapat laju yang berguna dari data berderau, haluskan datanya lebih dulu, cocokkan model seperti $s=\frac12gt^2$ padanya, atau pakai bacaan yang berjarak lebih jauh. ```python rng = np.random.default_rng(0) t = np.linspace(0, 3, 301) # a reading every 0.01 s s = 4.9 * t**2 + rng.normal(0, 0.01, t.size) # the same fall, with 1 cm of noise v = np.gradient(s, t) a = np.gradient(v, t) print(round(float(np.std(s - 4.9*t**2)), 4)) # 0.0102 position error, in m print(round(float(np.std(v[2:-2] - 9.8*t[2:-2])), 3)) # 0.716 velocity error, in m/s print(round(float(np.std(a[4:-4] - 9.8)), 1)) # 62.7 acceleration error, in m/s^2 ``` ```cpp #include #include using namespace std; int main() { double t[7], s[7], v[7], a[7]; // a reading every half second for (int i = 0; i < 7; i++) { t[i] = 0.5 * i; s[i] = 4.9 * t[i] * t[i]; } // distance fallen, in meters v[0] = (s[1] - s[0]) / 0.5; // velocity: one-sided at the ends, central inside v[6] = (s[6] - s[5]) / 0.5; for (int i = 1; i < 6; i++) v[i] = (s[i + 1] - s[i - 1]) / 1.0; a[0] = (v[1] - v[0]) / 0.5; // acceleration: the same, applied to the velocity a[6] = (v[6] - v[5]) / 0.5; for (int i = 1; i < 6; i++) a[i] = (v[i + 1] - v[i - 1]) / 1.0; for (int i = 0; i < 7; i++) printf("%6.2f", v[i]); // 2.45 4.9 9.8 14.7 19.6 24.5 26.95 cout << endl; for (int i = 0; i < 7; i++) printf("%6.2f", 9.8 * t[i]); // the exact velocities cout << endl; for (int i = 0; i < 7; i++) printf("%6.2f", a[i]); // the exact acceleration is 9.8 cout << endl; cout << (11 * 11 * 11 - 6 * 11 * 11 + 15 * 11) - (10 * 10 * 10 - 6 * 10 * 10 + 15 * 10) << " " << 3 * 10 * 10 - 12 * 10 + 15 << endl; // 220 195: the next unit against the marginal cost // noise grows with every derivative: readings every 0.01 s, each off by 0, +0.01 or -0.01 m double noise[3] = {0.01, -0.01, 0}; double e[40], ve[40], ae[40], h = 0.01; for (int i = 0; i < 40; i++) e[i] = noise[i % 3]; for (int i = 1; i < 39; i++) ve[i] = (e[i + 1] - e[i - 1]) / (2 * h); double maxS = 0, maxV = 0, maxA = 0; for (int i = 0; i < 40; i++) if (e[i] > maxS) maxS = e[i]; for (int i = 2; i < 38; i++) { ae[i] = (ve[i + 1] - ve[i - 1]) / (2 * h); if (ve[i] > maxV) maxV = ve[i]; if (ae[i] > maxA) maxA = ae[i]; } printf("%.2f %.1f %.1f\n", maxS, maxV, maxA); // the error in m, in m/s and in m/s^2 return 0; } /* output: 2.45 4.90 9.80 14.70 19.60 24.50 26.95 0.00 4.90 9.80 14.70 19.60 24.50 29.40 4.90 7.35 9.80 9.80 9.80 7.35 4.90 220 195 0.01 1.0 75.0 */ ``` ## Siapa yang pertama mengukur laju sesaat dan perubahan marjinal? **Laju pada satu saat adalah teka-teki selama dua ribu tahun sebelum kalkulus memberinya definisi, dan "margin" para ekonom tiba dua abad sesudahnya.** - **Galileo.** Dalam Discourses on Two New Sciences (1638) Galileo menunjukkan bahwa benda yang jatuh dari keadaan diam menempuh jarak sebanding dengan kuadrat waktu, $s\propto t^2$, yaitu hukum $s=\frac12gt^2$ yang dipakai di sini. Ia menemukannya dengan menggelindingkan bola pada papan miring, yang memperlambat geraknya cukup untuk diukur waktunya. - **Para Kalkulator Oxford.** Para sarjana di Merton College, Oxford, pada 1330-an membedakan gerak beraturan dari gerak tak beraturan dan mendefinisikan "kecepatan sesaat" dengan kata-kata; teorema kecepatan rata-rata mereka digambarkan sebagai grafik laju terhadap waktu oleh Nicole Oresme sekitar 1350, berabad-abad sebelum turunan. - **Newton.** Pada 1660-an Isaac Newton memperlakukan kecepatan sebagai fluksi posisi, laju perubahan besaran yang mengalir, dan percepatan sebagai fluksi kecepatan: turunan ditemukan, sebagian, untuk membicarakan gerak. - **Ekonomi marjinal.** Augustin Cournot memakai turunan dalam bukunya tahun 1838 tentang teori matematika kekayaan untuk mencari keluaran yang memaksimalkan laba perusahaan. Kata "marjinal" dalam ekonomi berasal dari Friedrich von Wieser (1884), dan "revolusi marjinal" pada 1870-an menjadikannya pusat. ## Kesalahan apa yang sering terjadi pada laju perubahan? **Kesalahan paling umum pada laju perubahan adalah sembilan hal berikut, masing-masing dengan pernyataan yang benar.** | Kesalahan | Yang benar | |---|---| | ❌ Laju dapat bernilai negatif | Laju adalah nilai mutlak kecepatan dan tidak pernah negatif; kecepatanlah yang memiliki tanda. | | ❌ Percepatan negatif berarti benda melambat | Hanya bila kecepatannya positif. Benda dengan $v<0$ dan $a<0$ bergerak mundur dan makin cepat. | | ❌ Saat kecepatan nol, percepatan juga nol | Batu di puncak lintasannya memiliki $v=0$ tetapi tetap $a=-9{,}8\ \text{m/s}^2$. | | ❌ Grafik $s$ terhadap $t$ adalah lintasan benda | Lintasannya adalah garis tempat benda bergerak; grafik memperlihatkan posisi terhadap waktu, dan gradiennya adalah kecepatan. | | ❌ Jarak total sama dengan perpindahan | Perpindahan adalah $s(t_1)-s(t_0)$; jarak menjumlahkan besar perubahan $s$ di antara putaran balik, sehingga dapat lebih besar (12 m terhadap 4 m pada contoh). | | ❌ Kecepatan rata-rata selalu $\frac{v_0+v_1}{2}$ | Itu hanya berlaku bila percepatannya tetap. Kecepatan rata-rata adalah perpindahan per waktu. | | ❌ Biaya marjinal adalah biaya total dibagi banyak satuan | Itu biaya rata-rata. Biaya marjinal adalah turunan $c'(x)$, biaya satu satuan lagi. | | ❌ Dengan tarif pajak marjinal 28% kamu membayar 28% dari seluruh penghasilan | Kamu membayar 28% dari setiap satuan penghasilan tambahan; tarif marjinal adalah $\frac{dT}{dI}$. | | ❌ Laju $\frac{dA}{dr}$ dan laju $\frac{dA}{dD}$ pada lingkaran sama | Keduanya berbeda karena peubahnya berbeda: $\frac{dA}{dr}=2\pi r$ tetapi $\frac{dA}{dD}=\frac{\pi D}{2}=\pi r$, separuhnya. | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: turunan sebagai laju perubahan sekilas - **Laju perubahan:** $\frac{dy}{dx}=\lim\frac{\Delta y}{\Delta x}$ dalam satuan $y$ per satuan $x$; ia bergantung pada peubah yang dipilih; $\Delta y\approx\frac{dy}{dx}\Delta x$ untuk langkah kecil. - **Gerak:** $v=\frac{ds}{dt}$ (tanda = arah), laju $=|v|$, $a=\frac{d^2s}{dt^2}$, $j=\frac{da}{dt}$; makin cepat bila $v$ dan $a$ bertanda sama; jarak menjumlahkan $|\Delta s|$ di antara putaran balik, perpindahan adalah $s(t_1)-s(t_0)$. - **Jatuh bebas:** $s=4{,}9t^2$, $v=9{,}8t$, $a=9{,}8$, $j=0$; dilempar ke atas dengan $v_0$: puncak di $\frac{v_0}{g}$, tinggi $\frac{v_0^2}{2g}$, mendarat di $\frac{2v_0}{g}$ dengan kecepatan $-v_0$. - **Marjinal:** biaya marjinal $c'(x)\approx c(x+1)-c(x)$, pendapatan marjinal $r'$, laba marjinal $r'-c'$; tarif pajak marjinal adalah pajak atas satuan penghasilan berikutnya. - **Kepekaan:** $|f'|$ yang besar berarti perubahan kecil pada $x$ membuat perubahan besar pada $f$ (kacang polong Mendel, jarak pengereman). - **Data dan kode:** `numpy.gradient` untuk kecepatan dan percepatan dari bacaan; setiap turunan memperbesar derau. ## Glosarium: istilah penting - **Kecepatan**: Turunan posisi terhadap waktu; besarnya adalah laju dan tandanya adalah arah gerak sepanjang garis. - **Laju**: Nilai mutlak kecepatan, kemajuan tanpa memandang arah, yang tidak pernah negatif. - **Percepatan**: Turunan kecepatan terhadap waktu, yang juga turunan kedua posisi; ia mengukur seberapa cepat benda menambah atau kehilangan kecepatan. - **Sentakan**: Turunan percepatan terhadap waktu, yaitu turunan ketiga posisi; perjalanan tersentak-sentak bila percepatan berubah mendadak. - **Perpindahan**: Perubahan posisi dari awal sampai akhir selang waktu, diperoleh dengan mengurangkan posisi awal dari posisi akhir; ia dapat lebih kecil daripada jarak yang ditempuh. - **Biaya marjinal**: Turunan biaya produksi terhadap banyak satuan yang diproduksi, yang menghampiri biaya membuat satu satuan lagi. - **Pendapatan marjinal**: Turunan pendapatan terhadap banyak satuan yang terjual, yang menghampiri pendapatan tambahan dari menjual satu satuan lagi. - **Kepekaan terhadap perubahan**: Seberapa kuat suatu fungsi menanggapi perubahan kecil pada masukannya, diukur dengan besar turunannya: makin curam grafik, makin peka fungsi itu. ## Pertanyaan yang sering diajukan ### Apa turunan posisi? Turunan posisi terhadap waktu adalah kecepatan. Turunkan kecepatan dan kamu mendapat percepatan, yaitu turunan kedua posisi. Tanda kecepatan menyatakan arah gerak sepanjang garis, dan besarnya adalah laju. ### Apa beda kecepatan dan laju? Kecepatan adalah turunan posisi dan memiliki tanda yang memberi arah, sehingga dapat negatif. Laju adalah nilai mutlak kecepatan dan tidak pernah negatif. Mobil yang dikendarai pergi dan pulang dengan 50 kilometer per jam memiliki laju 50 di kedua arah tetapi kecepatan 50 lalu min 50. ### Apa itu percepatan dalam kalkulus? Percepatan adalah turunan kecepatan terhadap waktu, yaitu turunan kedua posisi. Satuannya satuan kecepatan per satuan waktu, seperti meter per detik kuadrat. Pada jatuh bebas di dekat Bumi ia tetap 9,8. ### Apa itu sentakan? Sentakan adalah turunan percepatan terhadap waktu, turunan ketiga posisi. Perjalanan terasa tersentak-sentak bila percepatan berubah mendadak, belum tentu bila ia besar. Pada jatuh bebas percepatannya tetap, sehingga sentakannya nol. ### Bagaimana mengetahui apakah benda makin cepat atau makin lambat? Bandingkan tanda kecepatan dan percepatan. Jika sama benda makin cepat, dan jika berlawanan ia makin lambat. Percepatan negatif dengan kecepatan negatif berarti bergerak mundur dan makin cepat, jadi percepatan saja tidak cukup. ### Apa itu biaya marjinal? Biaya marjinal adalah turunan biaya produksi terhadap banyak satuan yang dibuat. Ia menghampiri tambahan biaya membuat satu satuan lagi, dan hampiran itu baik bila gradien kurva biaya berubah pelan di dekat produksi saat ini. ### Apa beda biaya marjinal dan biaya rata-rata? Biaya rata-rata adalah biaya total dibagi banyak satuan, sehingga ia membagi seluruh biaya ke semua satuan. Biaya marjinal adalah turunan biaya total, biaya satuan berikutnya. Keduanya sama hanya pada tingkat produksi tertentu. ### Seberapa jauh benda jatuh pada jatuh bebas? Mulai dari keadaan diam di dekat permukaan Bumi dan mengabaikan hambatan udara, benda jatuh 4,9 kali kuadrat waktu dalam meter. Setelah 3 detik itu 44,1 meter, dan kecepatannya saat itu 9,8 kali waktu, yaitu 29,4 meter per detik. ### Apa satuan sebuah turunan? Satuan besaran yang diturunkan dibagi satuan peubahnya. Posisi dalam meter terhadap waktu dalam detik memberi meter per detik, dan biaya dalam rupiah terhadap satuan yang dibuat memberi rupiah per satuan. Mengganti peubah, seperti jari-jari menjadi diameter, mengubah angkanya. --- # Differentiation Rules Source: https://nunada.my.id/articles/differentiation-rules/ Updated: 2026-10-13 ## Quick answer **The differentiation rules let you find derivatives without taking a limit each time: a constant has derivative $0$, $\frac{d}{dx}x^n=nx^{n-1}$, constants pull out and sums split, $\frac{d}{dx}e^x=e^x$, and for products and quotients $(uv)'=u'v+uv'$ and $\left(\frac uv\right)'=\frac{u'v-uv'}{v^2}$.** Together they differentiate every polynomial and every rational function, and applying them twice or more gives second and higher-order derivatives. ### Key takeaways - Constant rule: $\frac{d}{dx}c=0$. Power rule: $\frac{d}{dx}x^n=nx^{n-1}$ for every real $n$ (where the powers are defined): bring the exponent down and subtract $1$ from it. - Constant multiples and sums behave simply: $(cu)'=cu'$ and $(u\pm v)'=u'\pm v'$, so a polynomial is differentiated term by term. - The exponential function with base $e\approx2.718$ is its own derivative, $\frac{d}{dx}e^x=e^x$, because $e$ is the base for which the graph crosses the $y$-axis with slope $1$. - The derivative of a product is not the product of the derivatives: $(uv)'=u'v+uv'$. The derivative of a quotient is $\left(\frac uv\right)'=\frac{u'v-uv'}{v^2}$. - Simplify with algebra before you differentiate: expanding a product or cutting a quotient into powers often replaces a long quotient rule by a short power rule. - The second derivative $f''$ is the derivative of $f'$, the rate of change of the slope; a polynomial of degree $n$ has derivatives of every order, and the $n$-th one is the constant $n!$ times its leading coefficient. ## How do you differentiate constants and powers of x? **The derivative of a constant is $0$, and the derivative of a power of $x$ is found by bringing the exponent down and lowering it by one: $\frac{d}{dx}x^n=nx^{n-1}$.** The [derivative functions](https://nunada.my.id/articles/the-derivative-as-a-function/#from-the-definition) found from the definition showed the pattern, $x^2\to2x$ and $x^3\to3x^2$; this section proves it. **The constant rule.** If $f(x)=c$ then every difference quotient is $\frac{c-c}{h}=0$, so $\frac{d}{dx}c=0$. A horizontal line has slope $0$ everywhere. **The power rule for positive whole numbers.** The identity $$z^n-x^n=(z-x)\,S,$$ where $$S=z^{n-1}+z^{n-2}x+\cdots+zx^{n-2}+x^{n-1}$$ has $n$ terms, can be checked by multiplying out the right side: everything cancels except $z^n-x^n$. By the second form of the definition, dividing by $z-x$ leaves $S$, and as $z\to x$ each of its $n$ terms tends to $x^{n-1}$: $$\frac{d}{dx}x^n=\lim_{z\to x}S=nx^{n-1}.$$ **The same rule for every real exponent.** The formula is valid for all real $n$, not just positive whole numbers, wherever $x^n$ and $x^{n-1}$ are defined; the proof for the other kinds of exponent comes with the derivative of the logarithm, and here it is used as a tool. Subtract $1$ from the exponent and multiply by the old exponent: - $\frac{d}{dx}x^3=3x^2$. - $\frac{d}{dx}x^{2/3}=\frac23x^{-1/3}$, defined for $x\ne0$. At $0$ the function $x^{2/3}$ has a [cusp](https://nunada.my.id/articles/tangent-lines-and-derivative-at-a-point/#no-derivative), and the formula blows up there as it should. - $\frac{d}{dx}x^{\sqrt2}=\sqrt2\,x^{\sqrt2-1}$. - $\frac{d}{dx}\frac{1}{x^4}=\frac{d}{dx}x^{-4}=-4x^{-5}=-\frac{4}{x^5}$. - $\frac{d}{dx}x^{-4/3}=-\frac43x^{-7/3}$. - $\frac{d}{dx}x^{\pi+1}=(\pi+1)x^{\pi}$. The [laws of exponents](https://nunada.my.id/articles/exponents-and-radicals/#zero-negative-fractional) are what let you write roots and reciprocals as powers: $\sqrt x=x^{1/2}$ and $\frac1{x^4}=x^{-4}$. That is the first move in most problems, and it turns $\sqrt x$ into $\frac12x^{-1/2}=\frac{1}{2\sqrt x}$, the formula that took a conjugate to get from the definition. Try the tool below on any of these. It applies the rules one at a time, names each one, and checks the answer against a difference quotient. ## How do the constant multiple, sum and difference rules work? **A constant factor comes out of a derivative, and the derivative of a sum or difference is the sum or difference of the derivatives: $(cu)'=cu'$ and $(u\pm v)'=u'\pm v'$.** The proofs are one line each, because limits of constant multiples and sums behave the same way. **Constant multiple.** $$(cu)'=\lim_{h\to0}\frac{cu(x+h)-cu(x)}{h}$$ $$(cu)'=c\lim_{h\to0}\frac{u(x+h)-u(x)}{h},$$ which is $c\,u'$. In pictures: multiplying every height of a graph by $3$ multiplies every slope by $3$, so $\frac{d}{dx}(3x^2)=3\cdot2x=6x$. With $c=-1$ the rule says that the derivative of $-u$ is $-u'$. **Sum.** The difference quotient of $u+v$ is the sum of the difference quotients of $u$ and of $v$, and the limit of a sum is the sum of the limits, so $$(u+v)'=u'+v'.$$ Writing $u-v$ as $u+(-1)v$ gives the difference rule, and the sum rule extends to any finite number of terms. **Polynomials.** Together with the power rule they differentiate any polynomial term by term. For $y=x^3+\frac43x^2-5x+1$, $$y'=3x^2+\frac43\cdot2x-5\cdot1+0,$$ $$y'=3x^2+\frac83x-5.$$ Every polynomial is differentiable at every $x$. **Where is the tangent horizontal?** A horizontal tangent has slope $0$, so solve $y'=0$. For $y=x^4-2x^2+2$ the derivative is $y'=4x^3-4x=4x(x-1)(x+1)$, which is zero at $x=0$, $1$ and $-1$. The horizontal tangents touch the curve at $(0,2)$, $(1,1)$ and $(-1,1)$: the [factoring](https://nunada.my.id/articles/algebraic-expressions/#factor) of the derivative does the work. **The tangent line that results.** With a derivative formula the [tangent line](https://nunada.my.id/articles/tangent-lines-and-derivative-at-a-point/#tangent-line-equation) at any point is two substitutions away: for $y=x^3+\frac43x^2-5x+1$ at $x=1$ the point is $\left(1,-\frac53\right)$ and the slope is $3+\frac83-5=\frac23$. ## What is the derivative of e to the x? **The derivative of $e^x$ is $e^x$: the natural exponential function is its own derivative, and $e\approx2.71828$ is the one base for which that is true.** Here is why. Apply the definition to $f(x)=a^x$ with $a>0$: $$\frac{a^{x+h}-a^x}{h}=a^x\cdot\frac{a^h-1}{h}.$$ Letting $h\to0$ gives $$\frac{d}{dx}a^x=a^x\cdot L,$$ where $$L=\lim_{h\to0}\frac{a^h-1}{h},$$ and $a^x$ was taken out because it does not depend on $h$. So the derivative of $a^x$ is a constant multiple $L$ of $a^x$ itself, and $L$ is a number that depends only on $a$. Putting $x=0$ shows what it is: $L=f'(0)$, the slope of the graph of $a^x$ where it crosses the $y$-axis. That slope can be estimated from the difference quotient. With $h=0.0001$, $L\approx0.69$ for $a=2$, about $0.92$ for $a=2.5$ and about $1.10$ for $a=3$. It grows with the base, so for some base between $2.5$ and $3$ it equals exactly $1$. That base is $e$, the [number e](https://nunada.my.id/articles/irrational-numbers/#pi-e-transcendental), and with it $L=1$ and $$\frac{d}{dx}e^x=e^x\cdot1=e^x.$$ (For a general base the value turns out to be $L=\ln a$; that is shown in the study of logarithms, and it is not needed here.) By the constant multiple rule, $\frac{d}{dx}\big(c\,e^x\big)=c\,e^x$, and the only functions equal to their own derivatives are these constant multiples. Move the base in the tool below and watch $L$ pass through $1$. **A tangent through the origin.** Which line through $(0,0)$ is tangent to $y=e^x$? A line $y=mx$ touching the graph at $(a,e^a)$ has slope $m=\frac{e^a-0}{a-0}$, and the slope of the curve there is $e^a$, so $e^a=\frac{e^a}{a}$, which gives $a=1$ and $m=e$. The line is $y=ex$, touching the curve at $(1,e)$. *The line y = ex through the origin is tangent to y = eˣ at the point (1, e): the slope of eˣ at x = 1 is e.* ## How does the product rule work? **The derivative of a product is the first function times the derivative of the second, plus the derivative of the first times the second: $(uv)'=u\,v'+u'\,v$.** It is not the product of the derivatives. A quick test: with $u=v=x$ the product is $x^2$ with derivative $2x$, while $u'v'=1\cdot1=1$. The rule gives $x\cdot1+1\cdot x=2x$, as it should. **Why it is true.** Let $\Delta u$, $\Delta v$ and $\Delta(uv)$ be the changes in $u$, $v$ and $uv$ when $x$ grows by $h$. Adding and subtracting $u(x+h)v(x)$ in the numerator of the difference quotient shows that $\Delta(uv)=u(x+h)\,\Delta v+v(x)\,\Delta u$, so $$\frac{\Delta(uv)}{h}=u(x+h)\,\frac{\Delta v}{h}+v(x)\,\frac{\Delta u}{h}.$$ As $h\to0$ the two fractions tend to $v'(x)$ and $u'(x)$, and $u(x+h)\to u(x)$ because a differentiable function is [continuous](https://nunada.my.id/articles/tangent-lines-and-derivative-at-a-point/#no-derivative). So the limit is $u(x)v'(x)+v(x)u'(x)$. **A picture.** Let $u$ and $v$ be the sides of a rectangle of area $uv$. When $x$ grows by $h$ the sides grow by $\Delta u$ and $\Delta v$, and the new area exceeds the old by two strips and a small corner: $$\Delta(uv)=v\,\Delta u+u\,\Delta v+\Delta u\,\Delta v.$$ Divide by $h$: the strips give $v\frac{\Delta u}{h}$ and $u\frac{\Delta v}{h}$, which tend to $vu'$ and $uv'$, and the corner gives $\frac{\Delta u\,\Delta v}{h}=\Delta u\cdot\frac{\Delta v}{h}\to0\cdot v'=0$, because the corner is a product of two small quantities. That is the product rule, and the tool below lets you shrink the step and watch the corner become negligible. **Examples.** - For $y=(x^2+1)(x^3-3x)$, with $u=x^2+1$ and $v=x^3-3x$: $y'=2x(x^3-3x)+(x^2+1)(3x^2-3)=5x^4-6x^2-3$. As a check, [expanding the brackets](https://nunada.my.id/articles/algebraic-expressions/#expand) first gives $y=x^5-2x^3-3x$ and the power rule gives the same $y'=5x^4-6x^2-3$. - For $y=x^2e^x$: $y'=2x\,e^x+x^2e^x=(x^2+2x)e^x$. When one factor is a constant the product rule reduces to the constant multiple rule, since the constant has derivative $0$. For three factors, differentiate one at a time and add: $(uvw)'=u'vw+uv'w+uvw'$. ## How does the quotient rule work? **The derivative of a quotient is the bottom times the derivative of the top, minus the top times the derivative of the bottom, all over the bottom squared: $\left(\frac uv\right)'=\frac{u'v-uv'}{v^2}$, wherever $v\ne0$.** The order of the two terms in the numerator matters, because it is a difference. A way to remember it: "low d-high minus high d-low, over low-low". **Why it is true.** Put $\frac{u(x+h)}{v(x+h)}-\frac{u(x)}{v(x)}$ over a common denominator and subtract and add $u(x)v(x)$ in the numerator. With $\Delta u$ and $\Delta v$ as before and $\Delta(u/v)$ the change in the quotient, dividing by $h$ gives $$\frac{\Delta(u/v)}{h}=\frac{v(x)\frac{\Delta u}{h}-u(x)\frac{\Delta v}{h}}{v(x)\,v(x+h)}.$$ Letting $h\to0$ turns the two fractions into $u'$ and $v'$ and $v(x+h)$ into $v(x)$, which is the rule. **Examples.** - For $y=\frac{t^2-1}{t^3+1}$: $y'=\frac{2t(t^3+1)-(t^2-1)(3t^2)}{(t^3+1)^2}=\frac{-t^4+3t^2+2t}{(t^3+1)^2}$. - For $y=e^{-x}=\frac{1}{e^x}$: $y'=\frac{0\cdot e^x-1\cdot e^x}{(e^x)^2}=-\frac{1}{e^x}=-e^{-x}$. **The reciprocal rule and negative powers.** With $u=1$ the rule gives $\left(\frac1v\right)'=-\frac{v'}{v^2}$. Applied to $v=x^m$ it recovers the power rule for negative exponents: $\frac{d}{dx}x^{-m}=-\frac{mx^{m-1}}{x^{2m}}=-m\,x^{-m-1}$. **Simplify first when you can.** The quotient rule is the heaviest tool, and algebra is often lighter. For $y=\frac{(x-1)(x^2-2x)}{x^4}$ a quotient rule would give a long expression with many terms. Instead expand the numerator and divide by $x^4$: $$y=\frac{x^3-3x^2+2x}{x^4}=x^{-1}-3x^{-2}+2x^{-3},$$ and then the power, multiple and sum rules give $$y'=-x^{-2}+6x^{-3}-6x^{-4}.$$ In the same way $\frac{x^3+2x}{x}=x^2+2$ has derivative $2x$ with no quotient rule at all. The tool above accepts quotients, so you can compare what it does with your own steps. It refuses things that need the chain rule, such as $(x^2+1)^3$, which come later. ## What are second and higher-order derivatives? **The second derivative of $f$ is the derivative of its derivative, $f''=(f')'$, and the process can be repeated to give the third, fourth and every higher-order derivative.** If $f'$ is a function it can be differentiated again, so with a function like $y=x^6$: $$y'=6x^5,\qquad y''=30x^4,\qquad y'''=120x^3.$$ **Notation.** For $y=f(x)$ the second derivative is written $f''(x)$, $y''$, $\frac{d^2y}{dx^2}$ or $D^2f(x)$. Read $\frac{d^2y}{dx^2}$ as "$d$ squared $y$ by $dx$ squared", and $y'''$ as "$y$ triple prime". The $n$-th derivative is $y^{(n)}=\frac{d^ny}{dx^n}=D^ny$ for any positive whole number $n$: the symbol $D^2$ means differentiating twice. **What it means.** The first derivative is the slope of the graph, so the second derivative is the rate of change of the slope: where $f''>0$ the slope is increasing and the graph bends upward, and where $f''<0$ it bends downward. (The [graph of the derivative](https://nunada.my.id/articles/the-derivative-as-a-function/#graphing-the-derivative) already showed this.) **Polynomials.** Each derivative lowers the degree by one, so the derivatives of $y=x^3-3x^2+2$ are $$y'=3x^2-6x,\quad y''=6x-6,$$ $$y'''=6,\quad y^{(4)}=0,$$ and every later one is $0$. A polynomial has derivatives of all orders. For a polynomial of degree $n$ with leading coefficient $a_n$ the $n$-th derivative is the constant $n!\,a_n$ (for $x^n$ it is $n!=n(n-1)\cdots2\cdot1$) and the next one is $0$. The tool above shows derivatives up to the fourth for any function it accepts. Try $x^5$ and watch the powers fall to a constant. ## How do you apply the differentiation rules in code? **A computer algebra system knows the rules: give SymPy a formula and `diff` applies the power, product and quotient rules for you, higher orders included.** Ask it about two undefined functions $u$ and $v$ and it returns the rules themselves, which is a good way to see that the product and quotient rules are formulas, not tricks. It leaves the answer in the shape the rules produce, so `expand`, `factor` or `simplify` puts it in the form you would write: for $(x^2+1)(x^3-3x)$ the rule gives $2x(x^3-3x)+(x^2+1)(3x^2-3)$, and `expand` turns that into $5x^4-6x^2-3$, the answer found above. ```python import sympy as sp x = sp.symbols('x') u, v = sp.Function('u'), sp.Function('v') print(sp.diff(u(x) * v(x), x)) # u(x)*Derivative(v(x), x) + v(x)*Derivative(u(x), x) print(sp.diff(u(x) / v(x), x)) # -u(x)*Derivative(v(x), x)/v(x)**2 + Derivative(u(x), x)/v(x) f = (x**2 + 1) * (x**3 - 3*x) print(sp.diff(f, x)) # 2*x*(x**3 - 3*x) + (x**2 + 1)*(3*x**2 - 3) print(sp.expand(sp.diff(f, x))) # 5*x**4 - 6*x**2 - 3 print(sp.factor(sp.diff(x**2 * sp.exp(x), x))) # x*(x + 2)*exp(x) print(sp.simplify(sp.diff((x**2 - 1) / (x**3 + 1), x))) # x*(2*x**3 - 3*x*(x**2 - 1) + 2)/(x**3 + 1)**2 print(sp.diff(x**sp.pi, x)) # pi*x**pi/x print(sp.diff(x**3 - 3*x**2 + 2, x, 3), sp.diff(x**3 - 3*x**2 + 2, x, 4)) # 6 0 ``` ```cpp #include using namespace std; // A polynomial is its list of coefficients: c[0] + c[1] x + c[2] x^2 + ... int multiply(const int a[], int na, const int b[], int nb, int out[]) { for (int i = 0; i < na + nb - 1; i++) out[i] = 0; for (int i = 0; i < na; i++) for (int j = 0; j < nb; j++) out[i + j] += a[i] * b[j]; return na + nb - 1; } void derivative(int c[], int n) { // c becomes c', the last coefficient 0 for (int i = 1; i < n; i++) c[i - 1] = i * c[i]; c[n - 1] = 0; } int value(const int c[], int n, int x) { // Horner's rule int s = 0; for (int i = n - 1; i >= 0; i--) s = s * x + c[i]; return s; } int main() { int u[3] = {1, 0, 1}; // x^2 + 1 int v[4] = {0, -3, 0, 1}; // x^3 - 3x int f[6]; int n = multiply(u, 3, v, 4, f); // f = u v derivative(f, n); for (int i = 0; i < n; i++) cout << f[i] << " "; // -3 0 -6 0 5 0: that is 5x^4 - 6x^2 - 3 cout << endl; int du[3] = {0, 2, 0}; // u' = 2x int dv[4] = {-3, 0, 3, 0}; // v' = 3x^2 - 3 int bad = 0; for (int x = -5; x <= 5; x++) // the product rule against the derivative of the product if (value(f, n, x) != value(du, 3, x) * value(v, 4, x) + value(u, 3, x) * value(dv, 4, x)) bad++; cout << "product rule fails at " << bad << " points" << endl; int g[4] = {2, 0, -3, 1}; // x^3 - 3x^2 + 2 for (int k = 1; k <= 4; k++) { derivative(g, 4); cout << value(g, 4, 5) << " "; // the k-th derivative at 5 } cout << endl; return 0; } /* output: -3 0 -6 0 5 0 product rule fails at 0 points 45 24 6 0 */ ``` **A rule is only as good as its use, so check an answer numerically.** Compare the formula you found with a difference quotient at a point: if $f'(x)$ is right, the central difference $\frac{f(x+h)-f(x-h)}{2h}$ with $h$ near $10^{-5}$ agrees with it to many digits, as in the [numerical derivative](https://nunada.my.id/articles/the-derivative-as-a-function/#derivative-functions-in-code) of the previous article. The tool above does exactly that check for you. ## Where do the differentiation rules come from? **The rules were found in the seventeenth century by the people who invented calculus, and the number $e$ came from a question about money.** - **Newton.** In his work on fluxions of the 1660s and 1670s, Isaac Newton gave rules for the rate of change of sums, products, quotients and powers, including fractional powers through his binomial series. - **Leibniz.** Gottfried Leibniz worked out $d(xy)=x\,dy+y\,dx$ in manuscripts of 1675 (he first guessed that the product of differentials was the differential of the product, and then corrected himself) and stated the rules for sums, products, quotients and powers in his 1684 paper that introduced the differential calculus. His notation $d^2y$ gave the second derivative its name. - **The number $e$.** Jacob Bernoulli met it in 1683 while studying compound interest, as the limit of $\left(1+\frac1n\right)^n$. Leonhard Euler began to write it as $e$ around 1727 and, in his Introductio in analysin infinitorum (1748), made $e^x$ the central exponential function; the fact that it equals its own derivative is why it is called natural. - **Notation.** Lagrange wrote $f'$, $f''$ and $f'''$ for successive derivatives, and Louis Arbogast introduced the operator $D$ and its powers $D^n$ in 1800. ## What mistakes do people make with the differentiation rules? **The most common mistakes with the differentiation rules are the nine below, each with the correct statement.** | Mistake | Correct | |---|---| | ❌ $(uv)'=u'v'$ | $(uv)'=u'v+uv'$. Test with $u=v=x$: the product $x^2$ has derivative $2x$, not $1$. | | ❌ $\left(\frac uv\right)'=\frac{u'}{v'}$ | $\left(\frac uv\right)'=\frac{u'v-uv'}{v^2}$, with the numerator in that order and the square below. | | ❌ $\frac{d}{dx}x^n=nx^n$ | The exponent drops by one: $\frac{d}{dx}x^n=nx^{n-1}$. So $\frac{d}{dx}x^5=5x^4$. | | ❌ $\frac{d}{dx}x^{-2}=-2x^{-1}$ | Subtract $1$ from $-2$ to get $-3$: $\frac{d}{dx}x^{-2}=-2x^{-3}$. | | ❌ $\frac{d}{dx}e^x=x\,e^{x-1}$ | That is the power rule applied to the wrong thing. $e^x$ has a constant base and a variable exponent, and $\frac{d}{dx}e^x=e^x$. | | ❌ $\frac{d}{dx}\pi^2=2\pi$ | $\pi^2$ is a constant, so its derivative is $0$; the power rule is for powers of the variable. | | ❌ $\frac{d}{dx}\left(3x^2+5\right)=6x+5$ | The constant $5$ has derivative $0$, so $\frac{d}{dx}\left(3x^2+5\right)=6x$. | | ❌ For $y=x^2$, the third derivative is $2$ | $y'=2x$, $y''=2$, $y'''=0$: the derivative of a constant is $0$. | | ❌ $y''$ means $(y')^2$ | $y''$ is the derivative of $y'$, not its square. For $y=x^3$, $y''=6x$ but $(y')^2=9x^4$. | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: the differentiation rules at a glance - **Constant:** $\frac{d}{dx}c=0$. **Power:** $\frac{d}{dx}x^n=nx^{n-1}$ for every real $n$ where defined; write roots and reciprocals as powers first. - **Multiple, sum, difference:** $(cu)'=cu'$, $(u\pm v)'=u'\pm v'$; a polynomial is differentiated term by term; horizontal tangents are where $y'=0$. - **Exponential:** $\frac{d}{dx}a^x=a^x\cdot L$ with $L=f'(0)$; for the base $e$, $L=1$ and $\frac{d}{dx}e^x=e^x$. - **Product:** $(uv)'=u'v+uv'$, not $u'v'$. **Quotient:** $\left(\frac uv\right)'=\frac{u'v-uv'}{v^2}$; reciprocal $\left(\frac1v\right)'=-\frac{v'}{v^2}$. - **Strategy:** simplify with algebra first (expand, divide); use the product or quotient rule only when needed. - **Higher order:** $f''=(f')'$, $y^{(n)}=\frac{d^ny}{dx^n}$; $f''$ is the rate of change of the slope; the $n$-th derivative of $x^n$ is $n!$. - **Code:** SymPy `diff` applies the rules (`diff(f, x, 3)` for the third derivative); check with a central difference. ## Glossary: key terms - **Power rule**: The rule that the derivative of x to the power n is n times x to the power n minus 1, valid for every real n where the powers are defined. - **Constant multiple rule**: The rule that the derivative of a constant times a function is the constant times the derivative of the function. - **Sum rule**: The rule that the derivative of a sum of differentiable functions is the sum of their derivatives; the difference rule is the same for subtraction. - **Product rule**: The rule that the derivative of a product uv is u times the derivative of v plus the derivative of u times v. - **Quotient rule**: The rule that the derivative of u over v is the bottom times the derivative of the top minus the top times the derivative of the bottom, all over the bottom squared. - **Natural exponential function**: The function e to the power x, whose base e is about 2.71828 and whose graph crosses the y-axis with slope 1, so that it equals its own derivative. - **Higher-order derivative**: A derivative of a derivative, found by differentiating repeatedly: the second derivative is the derivative of the first, the third of the second, and so on. - **Reciprocal rule**: The special case of the quotient rule for one over v, which says the derivative is minus the derivative of v over v squared. ## Frequently asked questions ### What are the basic differentiation rules? The constant rule gives zero, the power rule gives n times x to the power n minus 1, constants come out in front, and sums and differences are differentiated term by term. For products use u prime v plus u v prime, and for quotients u prime v minus u v prime over v squared. ### What is the power rule for derivatives? The derivative of x to the power n is n times x to the power n minus 1. Bring the exponent in front and lower it by one. It holds for every real exponent, so the derivative of x cubed is 3x squared and the derivative of 1 over x is minus 1 over x squared. ### What is the product rule? The derivative of a product u times v is u prime times v plus u times v prime. It is not the product of the two derivatives. For x times x the rule gives 1 times x plus x times 1, which is 2x, the derivative of x squared. ### What is the quotient rule? The derivative of u over v is u prime times v minus u times v prime, all divided by v squared, wherever v is not zero. The order in the numerator matters. If it helps, remember it as low d high minus high d low, over low low. ### What is the derivative of e to the x? The derivative of e to the x is e to the x. The natural exponential function is its own derivative, because e is the base for which the graph of the exponential crosses the y-axis with slope 1. Any constant multiple of e to the x has the same property. ### Is the derivative of a product the product of the derivatives? No. For a product of two functions the derivative has two terms, u prime v and u v prime. A quick test is x times x: the product is x squared with derivative 2x, but multiplying the two derivatives 1 and 1 gives only 1. ### How do you differentiate a polynomial? Differentiate term by term with the power rule. Each term a x to the n becomes n a x to the n minus 1, and a constant term disappears. For 2x cubed minus 5x squared plus 4x minus 7 the derivative is 6x squared minus 10x plus 4. ### What is the derivative of a constant? The derivative of a constant is zero. A constant function has the same value everywhere, so every difference quotient is zero and its graph is a horizontal line with slope zero. This holds for numbers such as pi squared too. ### What is the second derivative? The second derivative is the derivative of the derivative, written f double prime or d squared y over dx squared. It is the rate of change of the slope: where it is positive the graph bends upward, and where it is negative the graph bends downward. --- # Aturan Turunan Source: https://nunada.my.id/artikel/aturan-turunan/ Updated: 2026-10-13 ## Jawaban singkat **Aturan turunan memungkinkan kamu mencari turunan tanpa mengambil limit setiap kali: konstanta bernilai turunan $0$, $\frac{d}{dx}x^n=nx^{n-1}$, konstanta dapat dikeluarkan dan jumlah dapat dipisah, $\frac{d}{dx}e^x=e^x$, dan untuk hasil kali dan hasil bagi $(uv)'=u'v+uv'$ serta $\left(\frac uv\right)'=\frac{u'v-uv'}{v^2}$.** Bersama-sama aturan itu menurunkan setiap polinomial dan setiap fungsi rasional, dan memakainya dua kali atau lebih menghasilkan turunan kedua dan turunan tingkat tinggi. ### Poin penting - Aturan konstanta: $\frac{d}{dx}c=0$. Aturan pangkat: $\frac{d}{dx}x^n=nx^{n-1}$ untuk setiap bilangan real $n$ (di tempat pangkat itu terdefinisi): turunkan pangkatnya ke depan dan kurangi pangkatnya dengan $1$. - Kelipatan konstanta dan jumlah berperilaku sederhana: $(cu)'=cu'$ dan $(u\pm v)'=u'\pm v'$, sehingga polinomial diturunkan suku demi suku. - Fungsi eksponensial berbasis $e\approx2{,}718$ adalah turunannya sendiri, $\frac{d}{dx}e^x=e^x$, karena $e$ adalah basis yang grafiknya memotong sumbu $y$ dengan gradien $1$. - Turunan hasil kali bukan hasil kali turunan: $(uv)'=u'v+uv'$. Turunan hasil bagi adalah $\left(\frac uv\right)'=\frac{u'v-uv'}{v^2}$. - Sederhanakan dengan aljabar sebelum menurunkan: menjabarkan hasil kali atau memotong hasil bagi menjadi pangkat sering menggantikan aturan hasil bagi yang panjang dengan aturan pangkat yang singkat. - Turunan kedua $f''$ adalah turunan dari $f'$, laju perubahan gradien; polinomial berderajat $n$ memiliki turunan di setiap tingkat, dan yang ke-$n$ adalah konstanta $n!$ kali koefisien utamanya. ## Bagaimana menurunkan konstanta dan pangkat dari x? **Turunan konstanta adalah $0$, dan turunan pangkat dari $x$ diperoleh dengan menurunkan pangkatnya ke depan dan mengurangi pangkatnya satu: $\frac{d}{dx}x^n=nx^{n-1}$.** [Fungsi turunan](https://nunada.my.id/artikel/turunan-sebagai-fungsi/#from-the-definition) yang dicari dari definisi memperlihatkan polanya, $x^2\to2x$ dan $x^3\to3x^2$; bagian ini membuktikannya. **Aturan konstanta.** Jika $f(x)=c$ maka setiap hasil bagi selisih adalah $\frac{c-c}{h}=0$, sehingga $\frac{d}{dx}c=0$. Garis mendatar bergradien $0$ di mana-mana. **Aturan pangkat untuk bilangan bulat positif.** Kesamaan $$z^n-x^n=(z-x)\,S,$$ dengan $$S=z^{n-1}+z^{n-2}x+\cdots+zx^{n-2}+x^{n-1}$$ yang memuat $n$ suku, dapat diperiksa dengan menjabarkan ruas kanan: semuanya habis kecuali $z^n-x^n$. Dengan bentuk kedua definisi, membagi dengan $z-x$ menyisakan $S$, dan saat $z\to x$ masing-masing dari $n$ sukunya menuju $x^{n-1}$: $$\frac{d}{dx}x^n=\lim_{z\to x}S=nx^{n-1}.$$ **Aturan yang sama untuk setiap pangkat real.** Rumusnya berlaku untuk semua $n$ real, bukan hanya bilangan bulat positif, di tempat $x^n$ dan $x^{n-1}$ terdefinisi; pembuktian untuk jenis pangkat lainnya datang bersama turunan logaritma, dan di sini rumusnya dipakai sebagai alat. Kurangi pangkat dengan $1$ dan kalikan dengan pangkat lama: - $\frac{d}{dx}x^3=3x^2$. - $\frac{d}{dx}x^{2/3}=\frac23x^{-1/3}$, terdefinisi untuk $x\ne0$. Di $0$ fungsi $x^{2/3}$ memiliki [cusp](https://nunada.my.id/artikel/garis-singgung-dan-turunan-di-suatu-titik/#no-derivative), dan rumusnya membesar di sana sebagaimana mestinya. - $\frac{d}{dx}x^{\sqrt2}=\sqrt2\,x^{\sqrt2-1}$. - $\frac{d}{dx}\frac{1}{x^4}=\frac{d}{dx}x^{-4}=-4x^{-5}=-\frac{4}{x^5}$. - $\frac{d}{dx}x^{-4/3}=-\frac43x^{-7/3}$. - $\frac{d}{dx}x^{\pi+1}=(\pi+1)x^{\pi}$. [Hukum eksponen](https://nunada.my.id/artikel/eksponen-dan-akar/#zero-negative-fractional) memungkinkan kamu menulis akar dan kebalikan sebagai pangkat: $\sqrt x=x^{1/2}$ dan $\frac1{x^4}=x^{-4}$. Itu langkah pertama pada kebanyakan soal, dan ia mengubah $\sqrt x$ menjadi $\frac12x^{-1/2}=\frac{1}{2\sqrt x}$, rumus yang memerlukan sekawan untuk diperoleh dari definisi. Coba alat di bawah pada salah satunya. Ia memakai aturan satu per satu, menyebut tiap aturan, dan mencocokkan jawabannya dengan hasil bagi selisih. ## Bagaimana aturan kelipatan konstanta, jumlah, dan selisih bekerja? **Faktor konstanta keluar dari turunan, dan turunan jumlah atau selisih adalah jumlah atau selisih turunannya: $(cu)'=cu'$ dan $(u\pm v)'=u'\pm v'$.** Pembuktiannya satu baris masing-masing, karena limit kelipatan konstanta dan jumlah berperilaku sama. **Kelipatan konstanta.** $$(cu)'=\lim_{h\to0}\frac{cu(x+h)-cu(x)}{h}$$ $$(cu)'=c\lim_{h\to0}\frac{u(x+h)-u(x)}{h},$$ yaitu $c\,u'$. Dalam gambar: mengalikan setiap tinggi grafik dengan $3$ mengalikan setiap gradien dengan $3$, sehingga $\frac{d}{dx}(3x^2)=3\cdot2x=6x$. Dengan $c=-1$ aturan ini menyatakan bahwa turunan $-u$ adalah $-u'$. **Jumlah.** Hasil bagi selisih $u+v$ adalah jumlah hasil bagi selisih $u$ dan $v$, dan limit suatu jumlah adalah jumlah limitnya, sehingga $$(u+v)'=u'+v'.$$ Menulis $u-v$ sebagai $u+(-1)v$ memberi aturan selisih, dan aturan jumlah meluas ke sebanyak apa pun suku yang hingga. **Polinomial.** Bersama aturan pangkat, aturan-aturan itu menurunkan polinomial mana pun suku demi suku. Untuk $y=x^3+\frac43x^2-5x+1$, $$y'=3x^2+\frac43\cdot2x-5\cdot1+0,$$ $$y'=3x^2+\frac83x-5.$$ Setiap polinomial terdiferensialkan di setiap $x$. **Di mana garis singgungnya mendatar?** Garis singgung mendatar bergradien $0$, jadi selesaikan $y'=0$. Untuk $y=x^4-2x^2+2$ turunannya $y'=4x^3-4x=4x(x-1)(x+1)$, yang bernilai nol di $x=0$, $1$, dan $-1$. Garis singgung mendatar menyentuh kurva di $(0,2)$, $(1,1)$, dan $(-1,1)$: [pemfaktoran](https://nunada.my.id/artikel/bentuk-aljabar/#factor) turunannya yang mengerjakan. **Garis singgung yang dihasilkan.** Dengan rumus turunan, [garis singgung](https://nunada.my.id/artikel/garis-singgung-dan-turunan-di-suatu-titik/#tangent-line-equation) di titik mana pun hanya dua substitusi jauhnya: untuk $y=x^3+\frac43x^2-5x+1$ di $x=1$ titiknya $\left(1,-\frac53\right)$ dan gradiennya $3+\frac83-5=\frac23$. ## Berapa turunan e pangkat x? **Turunan $e^x$ adalah $e^x$: fungsi eksponensial natural adalah turunannya sendiri, dan $e\approx2{,}71828$ adalah satu-satunya basis yang memenuhi hal itu.** Inilah alasannya. Terapkan definisi pada $f(x)=a^x$ dengan $a>0$: $$\frac{a^{x+h}-a^x}{h}=a^x\cdot\frac{a^h-1}{h}.$$ Membiarkan $h\to0$ memberi $$\frac{d}{dx}a^x=a^x\cdot L,$$ dengan $$L=\lim_{h\to0}\frac{a^h-1}{h},$$ dan $a^x$ dikeluarkan karena tidak bergantung pada $h$. Jadi turunan $a^x$ adalah kelipatan konstan $L$ dari $a^x$ sendiri, dan $L$ adalah bilangan yang hanya bergantung pada $a$. Memasukkan $x=0$ memperlihatkan apa itu: $L=f'(0)$, gradien grafik $a^x$ di tempat ia memotong sumbu $y$. Gradien itu dapat ditaksir dari hasil bagi selisih. Dengan $h=0{,}0001$, $L\approx0{,}69$ untuk $a=2$, sekitar $0{,}92$ untuk $a=2{,}5$, dan sekitar $1{,}10$ untuk $a=3$. Ia membesar bersama basisnya, sehingga untuk suatu basis di antara $2{,}5$ dan $3$ nilainya tepat $1$. Basis itu adalah $e$, [bilangan e](https://nunada.my.id/artikel/bilangan-irasional/#pi-e-transcendental), dan dengannya $L=1$ dan $$\frac{d}{dx}e^x=e^x\cdot1=e^x.$$ (Untuk basis umum nilainya ternyata $L=\ln a$; itu ditunjukkan dalam pembahasan logaritma, dan tidak diperlukan di sini.) Menurut aturan kelipatan konstanta, $\frac{d}{dx}\big(c\,e^x\big)=c\,e^x$, dan satu-satunya fungsi yang sama dengan turunannya sendiri adalah kelipatan konstan ini. Geser basis pada alat di bawah dan perhatikan $L$ melewati $1$. **Garis singgung melalui titik asal.** Garis mana yang melalui $(0,0)$ dan menyinggung $y=e^x$? Garis $y=mx$ yang menyentuh grafik di $(a,e^a)$ bergradien $m=\frac{e^a-0}{a-0}$, dan gradien kurva di sana adalah $e^a$, sehingga $e^a=\frac{e^a}{a}$, yang memberi $a=1$ dan $m=e$. Garisnya $y=ex$, menyentuh kurva di $(1,e)$. *Garis y = ex melalui titik asal menyinggung y = eˣ di titik (1, e): gradien eˣ di x = 1 adalah e.* ## Bagaimana aturan hasil kali bekerja? **Turunan hasil kali adalah fungsi pertama kali turunan fungsi kedua, ditambah turunan fungsi pertama kali fungsi kedua: $(uv)'=u\,v'+u'\,v$.** Ia bukan hasil kali turunan. Uji cepat: dengan $u=v=x$ hasil kalinya $x^2$ dengan turunan $2x$, sedangkan $u'v'=1\cdot1=1$. Aturannya memberi $x\cdot1+1\cdot x=2x$, sebagaimana mestinya. **Mengapa benar.** Misalkan $\Delta u$, $\Delta v$, dan $\Delta(uv)$ adalah perubahan $u$, $v$, dan $uv$ saat $x$ bertambah $h$. Menambah dan mengurangi $u(x+h)v(x)$ pada pembilang hasil bagi selisih memperlihatkan bahwa $\Delta(uv)=u(x+h)\,\Delta v+v(x)\,\Delta u$, sehingga $$\frac{\Delta(uv)}{h}=u(x+h)\,\frac{\Delta v}{h}+v(x)\,\frac{\Delta u}{h}.$$ Saat $h\to0$ kedua pecahan menuju $v'(x)$ dan $u'(x)$, dan $u(x+h)\to u(x)$ karena fungsi yang terdiferensialkan [kontinu](https://nunada.my.id/artikel/garis-singgung-dan-turunan-di-suatu-titik/#no-derivative). Jadi limitnya $u(x)v'(x)+v(x)u'(x)$. **Gambar.** Misalkan $u$ dan $v$ adalah sisi-sisi persegi panjang berluas $uv$. Saat $x$ bertambah $h$ sisi-sisinya bertambah $\Delta u$ dan $\Delta v$, dan luas baru melebihi yang lama oleh dua pita dan satu pojok kecil: $$\Delta(uv)=v\,\Delta u+u\,\Delta v+\Delta u\,\Delta v.$$ Bagi dengan $h$: pita-pita itu memberi $v\frac{\Delta u}{h}$ dan $u\frac{\Delta v}{h}$, yang menuju $vu'$ dan $uv'$, dan pojoknya memberi $\frac{\Delta u\,\Delta v}{h}=\Delta u\cdot\frac{\Delta v}{h}\to0\cdot v'=0$, karena pojok adalah hasil kali dua besaran kecil. Itulah aturan hasil kali, dan alat di bawah memungkinkan kamu mengecilkan langkah dan melihat pojok menjadi dapat diabaikan. **Contoh.** - Untuk $y=(x^2+1)(x^3-3x)$, dengan $u=x^2+1$ dan $v=x^3-3x$: $y'=2x(x^3-3x)+(x^2+1)(3x^2-3)=5x^4-6x^2-3$. Sebagai pemeriksaan, [menjabarkan kurung](https://nunada.my.id/artikel/bentuk-aljabar/#expand) lebih dulu memberi $y=x^5-2x^3-3x$ dan aturan pangkat memberi $y'=5x^4-6x^2-3$ yang sama. - Untuk $y=x^2e^x$: $y'=2x\,e^x+x^2e^x=(x^2+2x)e^x$. Bila satu faktor adalah konstanta, aturan hasil kali menjadi aturan kelipatan konstanta, karena konstanta bernilai turunan $0$. Untuk tiga faktor, turunkan satu per satu dan jumlahkan: $(uvw)'=u'vw+uv'w+uvw'$. ## Bagaimana aturan hasil bagi bekerja? **Turunan hasil bagi adalah penyebut kali turunan pembilang, dikurangi pembilang kali turunan penyebut, seluruhnya dibagi kuadrat penyebut: $\left(\frac uv\right)'=\frac{u'v-uv'}{v^2}$, di mana pun $v\ne0$.** Urutan kedua suku di pembilang penting, karena ia selisih. Cara mengingatnya: "bawah d-atas dikurang atas d-bawah, dibagi bawah-bawah". **Mengapa benar.** Samakan penyebut $\frac{u(x+h)}{v(x+h)}-\frac{u(x)}{v(x)}$, lalu kurangkan dan tambahkan $u(x)v(x)$ pada pembilang. Dengan $\Delta u$ dan $\Delta v$ seperti tadi dan $\Delta(u/v)$ perubahan hasil bagi, membagi dengan $h$ memberi $$\frac{\Delta(u/v)}{h}=\frac{v(x)\frac{\Delta u}{h}-u(x)\frac{\Delta v}{h}}{v(x)\,v(x+h)}.$$ Membiarkan $h\to0$ mengubah kedua pecahan menjadi $u'$ dan $v'$ dan $v(x+h)$ menjadi $v(x)$, yaitu aturannya. **Contoh.** - Untuk $y=\frac{t^2-1}{t^3+1}$: $y'=\frac{2t(t^3+1)-(t^2-1)(3t^2)}{(t^3+1)^2}=\frac{-t^4+3t^2+2t}{(t^3+1)^2}$. - Untuk $y=e^{-x}=\frac{1}{e^x}$: $y'=\frac{0\cdot e^x-1\cdot e^x}{(e^x)^2}=-\frac{1}{e^x}=-e^{-x}$. **Aturan kebalikan dan pangkat negatif.** Dengan $u=1$ aturan ini memberi $\left(\frac1v\right)'=-\frac{v'}{v^2}$. Dikenakan pada $v=x^m$ ia memulihkan aturan pangkat untuk pangkat negatif: $\frac{d}{dx}x^{-m}=-\frac{mx^{m-1}}{x^{2m}}=-m\,x^{-m-1}$. **Sederhanakan dulu bila bisa.** Aturan hasil bagi adalah alat yang paling berat, dan aljabar sering lebih ringan. Untuk $y=\frac{(x-1)(x^2-2x)}{x^4}$ aturan hasil bagi akan memberi ekspresi panjang dengan banyak suku. Sebagai gantinya jabarkan pembilang dan bagi dengan $x^4$: $$y=\frac{x^3-3x^2+2x}{x^4}=x^{-1}-3x^{-2}+2x^{-3},$$ lalu aturan pangkat, kelipatan, dan jumlah memberi $$y'=-x^{-2}+6x^{-3}-6x^{-4}.$$ Dengan cara yang sama $\frac{x^3+2x}{x}=x^2+2$ memiliki turunan $2x$ tanpa aturan hasil bagi sama sekali. Alat di atas menerima hasil bagi, sehingga kamu dapat membandingkan apa yang dikerjakannya dengan langkahmu sendiri. Ia menolak hal yang memerlukan aturan rantai, seperti $(x^2+1)^3$, yang dibahas kemudian. ## Apa itu turunan kedua dan turunan tingkat tinggi? **Turunan kedua $f$ adalah turunan dari turunannya, $f''=(f')'$, dan prosesnya dapat diulang untuk memberi turunan ketiga, keempat, dan setiap turunan tingkat tinggi.** Jika $f'$ adalah fungsi, ia dapat diturunkan lagi, sehingga dengan fungsi seperti $y=x^6$: $$y'=6x^5,\qquad y''=30x^4,\qquad y'''=120x^3.$$ **Notasi.** Untuk $y=f(x)$ turunan kedua ditulis $f''(x)$, $y''$, $\frac{d^2y}{dx^2}$, atau $D^2f(x)$. Bacalah $\frac{d^2y}{dx^2}$ sebagai "$d$ kuadrat $y$ per $dx$ kuadrat", dan $y'''$ sebagai "$y$ aksen tiga". Turunan ke-$n$ adalah $y^{(n)}=\frac{d^ny}{dx^n}=D^ny$ untuk bilangan bulat positif $n$ mana pun: lambang $D^2$ berarti menurunkan dua kali. **Artinya.** Turunan pertama adalah gradien grafik, sehingga turunan kedua adalah laju perubahan gradien: di tempat $f''>0$ gradiennya bertambah dan grafik melengkung ke atas, dan di tempat $f''<0$ ia melengkung ke bawah. ([Grafik turunan](https://nunada.my.id/artikel/turunan-sebagai-fungsi/#graphing-the-derivative) sudah memperlihatkannya.) **Polinomial.** Setiap turunan menurunkan derajat satu, sehingga turunan-turunan $y=x^3-3x^2+2$ adalah $$y'=3x^2-6x,\quad y''=6x-6,$$ $$y'''=6,\quad y^{(4)}=0,$$ dan setiap turunan sesudahnya $0$. Polinomial memiliki turunan di semua tingkat. Untuk polinomial berderajat $n$ dengan koefisien utama $a_n$ turunan ke-$n$ adalah konstanta $n!\,a_n$ (untuk $x^n$ ia $n!=n(n-1)\cdots2\cdot1$) dan turunan berikutnya $0$. Alat di atas memperlihatkan turunan sampai yang keempat untuk fungsi apa pun yang diterimanya. Coba $x^5$ dan perhatikan pangkat-pangkat turun sampai sebuah konstanta. ## Bagaimana menerapkan aturan turunan dalam kode? **Sistem aljabar komputer mengenal aturan-aturannya: berikan rumus kepada SymPy dan `diff` memakai aturan pangkat, hasil kali, dan hasil bagi untukmu, termasuk tingkat yang lebih tinggi.** Tanyakan dua fungsi tak terdefinisi $u$ dan $v$ dan ia mengembalikan aturan-aturan itu sendiri, cara yang baik untuk melihat bahwa aturan hasil kali dan hasil bagi adalah rumus, bukan akal-akalan. Ia membiarkan jawabannya dalam bentuk yang dihasilkan aturan, sehingga `expand`, `factor`, atau `simplify` mengubahnya menjadi bentuk yang kamu tulis: untuk $(x^2+1)(x^3-3x)$ aturannya memberi $2x(x^3-3x)+(x^2+1)(3x^2-3)$, dan `expand` mengubahnya menjadi $5x^4-6x^2-3$, jawaban yang ditemukan di atas. ```python import sympy as sp x = sp.symbols('x') u, v = sp.Function('u'), sp.Function('v') print(sp.diff(u(x) * v(x), x)) # u(x)*Derivative(v(x), x) + v(x)*Derivative(u(x), x) print(sp.diff(u(x) / v(x), x)) # -u(x)*Derivative(v(x), x)/v(x)**2 + Derivative(u(x), x)/v(x) f = (x**2 + 1) * (x**3 - 3*x) print(sp.diff(f, x)) # 2*x*(x**3 - 3*x) + (x**2 + 1)*(3*x**2 - 3) print(sp.expand(sp.diff(f, x))) # 5*x**4 - 6*x**2 - 3 print(sp.factor(sp.diff(x**2 * sp.exp(x), x))) # x*(x + 2)*exp(x) print(sp.simplify(sp.diff((x**2 - 1) / (x**3 + 1), x))) # x*(2*x**3 - 3*x*(x**2 - 1) + 2)/(x**3 + 1)**2 print(sp.diff(x**sp.pi, x)) # pi*x**pi/x print(sp.diff(x**3 - 3*x**2 + 2, x, 3), sp.diff(x**3 - 3*x**2 + 2, x, 4)) # 6 0 ``` ```cpp #include using namespace std; // A polynomial is its list of coefficients: c[0] + c[1] x + c[2] x^2 + ... int multiply(const int a[], int na, const int b[], int nb, int out[]) { for (int i = 0; i < na + nb - 1; i++) out[i] = 0; for (int i = 0; i < na; i++) for (int j = 0; j < nb; j++) out[i + j] += a[i] * b[j]; return na + nb - 1; } void derivative(int c[], int n) { // c becomes c', the last coefficient 0 for (int i = 1; i < n; i++) c[i - 1] = i * c[i]; c[n - 1] = 0; } int value(const int c[], int n, int x) { // Horner's rule int s = 0; for (int i = n - 1; i >= 0; i--) s = s * x + c[i]; return s; } int main() { int u[3] = {1, 0, 1}; // x^2 + 1 int v[4] = {0, -3, 0, 1}; // x^3 - 3x int f[6]; int n = multiply(u, 3, v, 4, f); // f = u v derivative(f, n); for (int i = 0; i < n; i++) cout << f[i] << " "; // -3 0 -6 0 5 0: that is 5x^4 - 6x^2 - 3 cout << endl; int du[3] = {0, 2, 0}; // u' = 2x int dv[4] = {-3, 0, 3, 0}; // v' = 3x^2 - 3 int bad = 0; for (int x = -5; x <= 5; x++) // the product rule against the derivative of the product if (value(f, n, x) != value(du, 3, x) * value(v, 4, x) + value(u, 3, x) * value(dv, 4, x)) bad++; cout << "product rule fails at " << bad << " points" << endl; int g[4] = {2, 0, -3, 1}; // x^3 - 3x^2 + 2 for (int k = 1; k <= 4; k++) { derivative(g, 4); cout << value(g, 4, 5) << " "; // the k-th derivative at 5 } cout << endl; return 0; } /* output: -3 0 -6 0 5 0 product rule fails at 0 points 45 24 6 0 */ ``` **Aturan hanya sebaik pemakaiannya, jadi periksa jawaban secara numerik.** Bandingkan rumus yang kamu temukan dengan hasil bagi selisih di suatu titik: jika $f'(x)$ benar, selisih terpusat $\frac{f(x+h)-f(x-h)}{2h}$ dengan $h$ dekat $10^{-5}$ cocok dengannya sampai banyak angka, seperti pada [turunan numerik](https://nunada.my.id/artikel/turunan-sebagai-fungsi/#derivative-functions-in-code) di artikel sebelumnya. Alat di atas melakukan pemeriksaan itu untukmu. ## Dari mana asal aturan turunan? **Aturan-aturan itu ditemukan pada abad ketujuh belas oleh orang-orang yang menemukan kalkulus, dan bilangan $e$ berasal dari pertanyaan tentang uang.** - **Newton.** Dalam karyanya tentang fluksi pada 1660-an dan 1670-an, Isaac Newton memberi aturan untuk laju perubahan jumlah, hasil kali, hasil bagi, dan pangkat, termasuk pangkat pecahan melalui deret binomialnya. - **Leibniz.** Gottfried Leibniz menurunkan $d(xy)=x\,dy+y\,dx$ dalam naskah tahun 1675 (ia mula-mula menduga bahwa hasil kali diferensial adalah diferensial hasil kali, lalu mengoreksi dirinya) dan menyatakan aturan jumlah, hasil kali, hasil bagi, dan pangkat dalam makalahnya tahun 1684 yang memperkenalkan kalkulus diferensial. Notasinya $d^2y$ memberi turunan kedua namanya. - **Bilangan $e$.** Jacob Bernoulli menjumpainya pada 1683 saat mempelajari bunga majemuk, sebagai limit $\left(1+\frac1n\right)^n$. Leonhard Euler mulai menuliskannya sebagai $e$ sekitar 1727 dan, dalam Introductio in analysin infinitorum (1748), menjadikan $e^x$ fungsi eksponensial utama; fakta bahwa ia sama dengan turunannya sendiri adalah alasan ia disebut natural. - **Notasi.** Lagrange menulis $f'$, $f''$, dan $f'''$ untuk turunan berurutan, dan Louis Arbogast memperkenalkan operator $D$ dan pangkatnya $D^n$ pada 1800. ## Kesalahan apa yang sering terjadi pada aturan turunan? **Kesalahan paling umum pada aturan turunan adalah sembilan hal berikut, masing-masing dengan pernyataan yang benar.** | Kesalahan | Yang benar | |---|---| | ❌ $(uv)'=u'v'$ | $(uv)'=u'v+uv'$. Uji dengan $u=v=x$: hasil kali $x^2$ memiliki turunan $2x$, bukan $1$. | | ❌ $\left(\frac uv\right)'=\frac{u'}{v'}$ | $\left(\frac uv\right)'=\frac{u'v-uv'}{v^2}$, dengan pembilang dalam urutan itu dan kuadrat di bawah. | | ❌ $\frac{d}{dx}x^n=nx^n$ | Pangkatnya turun satu: $\frac{d}{dx}x^n=nx^{n-1}$. Jadi $\frac{d}{dx}x^5=5x^4$. | | ❌ $\frac{d}{dx}x^{-2}=-2x^{-1}$ | Kurangkan $1$ dari $-2$ menjadi $-3$: $\frac{d}{dx}x^{-2}=-2x^{-3}$. | | ❌ $\frac{d}{dx}e^x=x\,e^{x-1}$ | Itu aturan pangkat yang dikenakan pada hal yang salah. $e^x$ memiliki basis konstan dan pangkat peubah, dan $\frac{d}{dx}e^x=e^x$. | | ❌ $\frac{d}{dx}\pi^2=2\pi$ | $\pi^2$ adalah konstanta, sehingga turunannya $0$; aturan pangkat untuk pangkat dari peubah. | | ❌ $\frac{d}{dx}\left(3x^2+5\right)=6x+5$ | Konstanta $5$ bernilai turunan $0$, sehingga $\frac{d}{dx}\left(3x^2+5\right)=6x$. | | ❌ Untuk $y=x^2$, turunan ketiganya $2$ | $y'=2x$, $y''=2$, $y'''=0$: turunan konstanta adalah $0$. | | ❌ $y''$ berarti $(y')^2$ | $y''$ adalah turunan $y'$, bukan kuadratnya. Untuk $y=x^3$, $y''=6x$ tetapi $(y')^2=9x^4$. | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: aturan turunan sekilas - **Konstanta:** $\frac{d}{dx}c=0$. **Pangkat:** $\frac{d}{dx}x^n=nx^{n-1}$ untuk setiap $n$ real di tempat terdefinisi; tulis akar dan kebalikan sebagai pangkat dahulu. - **Kelipatan, jumlah, selisih:** $(cu)'=cu'$, $(u\pm v)'=u'\pm v'$; polinomial diturunkan suku demi suku; garis singgung mendatar ada di tempat $y'=0$. - **Eksponensial:** $\frac{d}{dx}a^x=a^x\cdot L$ dengan $L=f'(0)$; untuk basis $e$, $L=1$ dan $\frac{d}{dx}e^x=e^x$. - **Hasil kali:** $(uv)'=u'v+uv'$, bukan $u'v'$. **Hasil bagi:** $\left(\frac uv\right)'=\frac{u'v-uv'}{v^2}$; kebalikan $\left(\frac1v\right)'=-\frac{v'}{v^2}$. - **Strategi:** sederhanakan dengan aljabar dahulu (jabarkan, bagi); pakai aturan hasil kali atau hasil bagi hanya bila perlu. - **Tingkat tinggi:** $f''=(f')'$, $y^{(n)}=\frac{d^ny}{dx^n}$; $f''$ adalah laju perubahan gradien; turunan ke-$n$ dari $x^n$ adalah $n!$. - **Kode:** `diff` SymPy menerapkan aturan (`diff(f, x, 3)` untuk turunan ketiga); periksa dengan selisih terpusat. ## Glosarium: istilah penting - **Aturan pangkat**: Aturan bahwa turunan x pangkat n adalah n kali x pangkat n dikurangi 1, berlaku untuk setiap n real di tempat pangkatnya terdefinisi. - **Aturan kelipatan konstanta**: Aturan bahwa turunan konstanta kali sebuah fungsi adalah konstanta itu kali turunan fungsinya. - **Aturan jumlah**: Aturan bahwa turunan jumlah fungsi-fungsi terdiferensialkan adalah jumlah turunannya; aturan selisih sama untuk pengurangan. - **Aturan hasil kali**: Aturan bahwa turunan hasil kali uv adalah u kali turunan v ditambah turunan u kali v. - **Aturan hasil bagi**: Aturan bahwa turunan u per v adalah penyebut kali turunan pembilang dikurangi pembilang kali turunan penyebut, seluruhnya dibagi kuadrat penyebut. - **Fungsi eksponensial natural**: Fungsi e pangkat x, yang basisnya e sekitar 2,71828 dan grafiknya memotong sumbu y dengan gradien 1, sehingga ia sama dengan turunannya sendiri. - **Turunan tingkat tinggi**: Turunan dari turunan, diperoleh dengan menurunkan berulang: turunan kedua adalah turunan dari yang pertama, ketiga dari yang kedua, dan seterusnya. - **Aturan kebalikan**: Kasus khusus aturan hasil bagi untuk satu per v, yang menyatakan turunannya adalah min turunan v per v kuadrat. ## Pertanyaan yang sering diajukan ### Apa saja aturan turunan dasar? Aturan konstanta memberi nol, aturan pangkat memberi n kali x pangkat n dikurangi 1, konstanta keluar ke depan, dan jumlah serta selisih diturunkan suku demi suku. Untuk hasil kali pakai u aksen v ditambah u v aksen, dan untuk hasil bagi u aksen v dikurangi u v aksen per v kuadrat. ### Apa aturan pangkat untuk turunan? Turunan x pangkat n adalah n kali x pangkat n dikurangi 1. Bawa pangkat ke depan dan kurangi satu. Ia berlaku untuk setiap pangkat real, sehingga turunan x pangkat tiga adalah 3x kuadrat dan turunan 1 per x adalah min 1 per x kuadrat. ### Apa aturan hasil kali? Turunan hasil kali u kali v adalah u aksen kali v ditambah u kali v aksen. Ia bukan hasil kali kedua turunan. Untuk x kali x aturan itu memberi 1 kali x ditambah x kali 1, yaitu 2x, turunan x kuadrat. ### Apa aturan hasil bagi? Turunan u per v adalah u aksen kali v dikurangi u kali v aksen, seluruhnya dibagi v kuadrat, di mana pun v bukan nol. Urutan di pembilang penting. Jika membantu, ingatlah sebagai bawah d atas dikurang atas d bawah, per bawah bawah. ### Berapa turunan e pangkat x? Turunan e pangkat x adalah e pangkat x. Fungsi eksponensial natural adalah turunannya sendiri, karena e adalah basis yang grafik eksponensialnya memotong sumbu y dengan gradien 1. Kelipatan konstan mana pun dari e pangkat x memiliki sifat yang sama. ### Apakah turunan hasil kali sama dengan hasil kali turunan? Tidak. Untuk hasil kali dua fungsi turunannya memiliki dua suku, u aksen v dan u v aksen. Uji cepatnya x kali x: hasil kalinya x kuadrat dengan turunan 2x, tetapi mengalikan kedua turunan 1 dan 1 hanya memberi 1. ### Bagaimana menurunkan polinomial? Turunkan suku demi suku dengan aturan pangkat. Tiap suku a x pangkat n menjadi n a x pangkat n dikurangi 1, dan suku konstanta hilang. Untuk 2x pangkat tiga dikurangi 5x kuadrat ditambah 4x dikurangi 7 turunannya 6x kuadrat dikurangi 10x ditambah 4. ### Berapa turunan konstanta? Turunan konstanta adalah nol. Fungsi konstan bernilai sama di mana-mana, sehingga setiap hasil bagi selisih nol dan grafiknya garis mendatar bergradien nol. Ini berlaku juga untuk bilangan seperti pi kuadrat. ### Apa itu turunan kedua? Turunan kedua adalah turunan dari turunan, ditulis f aksen ganda atau d kuadrat y per dx kuadrat. Ia adalah laju perubahan gradien: di tempat ia positif grafik melengkung ke atas, dan di tempat ia negatif grafik melengkung ke bawah. --- # The Derivative as a Function Source: https://nunada.my.id/articles/the-derivative-as-a-function/ Updated: 2026-10-13 ## Quick answer **The derivative of a function $f$ is itself a function, $f'$, whose value at each $x$ is the slope of the graph of $f$ there: $f'(x)=\lim_{h\to0}\frac{f(x+h)-f(x)}{h}$, defined at every $x$ where the limit exists.** Finding it is called differentiation. It can be written $f'(x)$, $\frac{dy}{dx}$ or $Df(x)$, its graph is made by plotting the slopes of the graph of $f$, and its domain can be smaller than that of $f$, as for $\sqrt x$ at $0$ or $|x|$ at $0$. ### Key takeaways - The derivative function $f'$ takes each $x$ to the slope of the graph of $f$ at $x$; its domain is the set of points where $f$ is differentiable, which may be smaller than the domain of $f$. - To differentiate from the definition, write the difference quotient with $x$ left as a letter, simplify until $h$ cancels, and let $h\to0$: $x^2\to2x$, $x^3\to3x^2$, $\frac1x\to-\frac1{x^2}$, $\sqrt x\to\frac1{2\sqrt x}$. - The same derivative has many names: $f'(x)$, $y'$, $\frac{dy}{dx}$, $\frac{df}{dx}$, $\frac{d}{dx}f(x)$ and $Df(x)$; $\frac{dy}{dx}$ is one symbol, not a fraction to cancel. - You can draw the graph of $f'$ from the graph of $f$ by plotting slopes: $f'>0$ where $f$ rises, $f'<0$ where it falls and $f'=0$ at a horizontal tangent. - The derivative of a graph made of line segments is a step function with no value at a corner; at the ends of a closed interval only a one-sided derivative exists. - A function can be differentiable everywhere while $f'$ is not continuous ($x^2\sin\frac1x$); in code, SymPy gives $f'$ exactly and a central difference on a grid gives it numerically. ## What does it mean for the derivative to be a function? **The derivative of $f$ is the new function $f'$ that gives, for each $x$, the derivative of $f$ at that $x$: $f'(x)=\lim_{h\to0}\frac{f(x+h)-f(x)}{h}$, for every $x$ where the limit exists.** The [derivative at a point](https://nunada.my.id/articles/tangent-lines-and-derivative-at-a-point/#derivative-at-a-point) is one number at one place. Letting the point move gives a rule that hands out a slope for every input: feed it $x$ and out comes the slope of the graph of $f$ at $x$. The number $f'(a)$ is simply the value of this function at $a$. Four consequences are worth stating at once. - **The domain of $f'$ can be smaller than that of $f$.** It is the set of $x$ in the domain of $f$ at which the limit exists. $f(x)=\sqrt x$ is defined at $0$, but $f'$ is not (the graph has a vertical tangent there). - **Differentiable has two meanings.** $f$ is differentiable at $x$ when $f'(x)$ exists, and differentiable when $f'$ exists at every point of its domain. - **There is a second form of the limit.** Writing $z=x+h$, so that $h=z-x$ and $h\to0$ exactly when $z\to x$, gives $$f'(x)=\lim_{z\to x}\frac{f(z)-f(x)}{z-x},$$ which is often easier when $f$ has a root in it, as the examples below show. - **Differentiation is an operation on functions.** Put a function $f$ in, get a function $f'$ out. That is why the next sections are about finding the formula for $f'$, not a single number. The slope of the graph of $f$ at $x$ and the instantaneous rate of change of $f$ at $x$ are two readings of the same number $f'(x)$, as in the section on [rates of change](https://nunada.my.id/articles/tangent-lines-and-derivative-at-a-point/#rates-of-change). ## How do you find a derivative function from the definition? **To differentiate from the definition, write the difference quotient with $x$ left as a letter, simplify until $h$ cancels, and then let $h\to0$; what is left is a formula in $x$.** Here are five functions, each with its own trick. **1. $f(x)=x^2$: expand and cancel.** After [expanding the bracket](https://nunada.my.id/articles/algebraic-expressions/#expand), $$\frac{(x+h)^2-x^2}{h}=\frac{2xh+h^2}{h}=2x+h,$$ which tends to $2x$. **2. $f(x)=x^3$.** Since $(x+h)^3=x^3+3x^2h+3xh^2+h^3$, $$\frac{(x+h)^3-x^3}{h}=3x^2+3xh+h^2,$$ which tends to $3x^2$. **3. $f(x)=\frac1x$: a common denominator.** For $x\ne0$, using [adding fractions](https://nunada.my.id/articles/rational-numbers/#add-subtract-fractions), $$\frac{\frac1{x+h}-\frac1x}{h}=\frac{x-(x+h)}{x(x+h)\,h}=\frac{-1}{x(x+h)},$$ which tends to $-\frac1{x^2}$. **4. $f(x)=\frac{x}{x-1}$.** Over a common denominator the numerator is $(x+h)(x-1)-x(x+h-1)=-h$, so the factor $h$ cancels: $$\frac{f(x+h)-f(x)}{h}=\frac{-1}{(x+h-1)(x-1)},$$ which tends to $-\frac{1}{(x-1)^2}$ for $x\ne1$. **5. $f(x)=\sqrt x$: the second form and a conjugate.** For $x>0$, write $z-x=(\sqrt z-\sqrt x)(\sqrt z+\sqrt x)$ and cancel: $$\frac{\sqrt z-\sqrt x}{z-x}=\frac{1}{\sqrt z+\sqrt x},$$ which tends to $\frac{1}{2\sqrt x}$ as $z\to x$. This is the same trick as [rationalizing](https://nunada.my.id/articles/exponents-and-radicals/#rationalise). The formula blows up at $0$: $\sqrt x$ is defined for $x\ge0$ and its derivative only for $x>0$. Two more cases are worth keeping in mind. For a constant $f(x)=c$ every difference quotient is $0$, so $f'(x)=0$. For a line $f(x)=mx+b$ it is $\frac{m(x+h)+b-mx-b}{h}=m$, so $f'(x)=m$: the slope of a line is its derivative. Compare $x^2\to2x$ with $x^3\to3x^2$. In both the exponent comes down in front and the power of $x$ goes down by one. That pattern is correct, and the [differentiation rules](https://nunada.my.id/articles/differentiation-rules/#constants-and-powers) prove it for every positive whole number; here it is only an observation from the examples. To check any of these at a point, put a value of $x$ in: for $\frac{x}{x-1}$ at $x=3$ the formula gives $-\frac14$, and the secant slopes in the tool below close in on exactly that. Try your own function: it expands the difference quotient in powers of $h$, or reduces the derivative of a quotient, and shows both graphs. ## What are the different notations for the derivative? **The derivative of $y=f(x)$ can be written $f'(x)$, $y'$, $\frac{dy}{dx}$, $\frac{df}{dx}$, $\frac{d}{dx}f(x)$ or $Df(x)$; they all name the same function and differ only in how they are written.** The prime notation $f'$ and $y'$ goes back to Lagrange and is short. The $\frac{d}{dx}$ notation is Leibniz's, and it has a use that the prime lacks: it names the variable. If $y$ depends on time $t$, $\frac{dy}{dt}$ says what is changing with respect to what, and it carries the units, $y$-units per $t$-unit. The letters $\frac{d}{dx}$ and $D$ stand for the operation of differentiating, which is applied to a function. Read $\frac{dy}{dx}$ as "the derivative of $y$ with respect to $x$". At this stage $\frac{dy}{dx}$ is a single symbol for a derivative, not a fraction: you cannot cancel the $d$'s, and it is not "$dy$ divided by $dx$". (Later in calculus $dx$ and $dy$ do get meanings of their own, which is what makes the notation so convenient, but that is a separate idea.) To give the value of a derivative at a particular number, name the point with a bar and a subscript: $$f'(a)=\frac{dy}{dx}\bigg|_{x=a}=\frac{df}{dx}\bigg|_{x=a}.$$ For example, since $\frac{d}{dx}\sqrt x=\frac{1}{2\sqrt x}$, $\ \frac{d}{dx}\sqrt x\bigg|_{x=4}=\frac{1}{2\cdot2}=\frac14$, which is the slope of the tangent line at $(4,2)$. Pick whichever form is clearest: $f'(x)$ when you have a named function, $\frac{dy}{dx}$ when the variables matter, $D$ when you are treating differentiation as an operator. ## How do you graph the derivative from the graph of a function? **Read the slope of the graph of $f$ at many points and plot those slopes as heights: where $f$ rises the graph of $f'$ is above the axis, where $f$ falls it is below, and where $f$ has a horizontal tangent it touches the axis.** The method is to sketch tangent lines at frequent steps along the graph, estimate each slope, plot the pairs $(x,f'(x))$ and join them with a curve. Reading the graph of $f'$ tells you three things at a glance: 1. **Where the rate of change is positive, negative or zero.** $f'>0$ means $f$ is rising, $f'<0$ means falling, $f'=0$ means a flat spot, which is often the top of a hill or the bottom of a valley. 2. **How big the rate is.** The farther $f'$ is from the axis, the steeper the graph of $f$. 3. **Where the rate itself is increasing or decreasing.** Where the graph of $f'$ climbs, the slope of $f$ is growing; the graph of $f$ bends upward. Where it falls, the graph of $f$ bends downward. The rate of change of $f'$ is the [second derivative](https://nunada.my.id/articles/differentiation-rules/#higher-order), written $f''$, which is just the derivative function applied twice. Two examples to compare with the tool below. For $f(x)=x^2$ the slope is negative to the left of the vertex, zero at the vertex and positive to the right, growing steadily: $f'(x)=2x$, a straight line. For $f(x)=x^3-3x$ the graph rises to a peak at $x=-1$, falls through $x=0$ with slope $-3$ (its steepest fall) and rises again after a valley at $x=1$, so $f'(x)=3x^2-3$ is a parabola that crosses the axis at $-1$ and $1$ and has its lowest point at $x=0$. The same slope-reading explains why the derivative of $\sin x$ is $\cos x$: the slope of the sine wave is zero at every peak and valley, largest where the wave crosses the axis going up, and the result is the same wave moved a quarter of a period to the left. Slide the point below along nine graphs. The top graph shows $f$ and its tangent; the bottom one draws $f'$ up to the point, the height of the dot being the slope of the tangent above it. *The cubic f(x) = x³ − 3x (green) has a peak at A and a valley at B, where its tangent is horizontal; its derivative f′(x) = 3x² − 3 (orange) is zero exactly there, at A′ and B′, positive where f rises and negative between them.* ## What is the derivative of a graph made of line segments? **The derivative of a graph made of line segments is a step function: on each segment it equals the slope of that segment, and at a corner, where two segments with different slopes meet, it has no value.** Each segment is a piece of a line $y=mx+b$, whose derivative is the constant $m$. Take the graph through $(0,0)$, $(2,4)$, $(5,4)$, $(7,0)$ and $(9,2)$. Its segments have slopes $\frac{4-0}{2-0}=2$, $0$, $\frac{0-4}{7-5}=-2$ and $\frac{2-0}{9-7}=1$, so $f'$ is $2$ on $(0,2)$, $0$ on $(2,5)$, $-2$ on $(5,7)$ and $1$ on $(7,9)$. At $x=2$, $5$ and $7$ the one-sided slopes differ (on the left and right of $x=2$ they are $2$ and $0$), so the right-hand and left-hand derivatives disagree and $f'$ does not exist: the graph of $f'$ has an open circle on each side of every corner. At the two ends of the graph only one side exists, a one-sided derivative. A vertex is only a corner if the slopes really differ. If the pieces on either side lie on the same line, as in $(0,0)$, $(1,1)$, $(3,3)$, $(4,1)$ at $x=1$, the vertex is not a corner and $f'$ has the value $1$ there. Going backwards works too, with one thing missing. Given the steps of $f'$ you can rebuild the graph by walking along: start at a point, follow slope $m_1$ to the first break, then $m_2$, and so on. Starting at $(0,0)$ with slope $3$ until $x=2$, then $0$ until $4$, then $-1$ until $6$, then $2$ until $8$ gives the vertices $(0,0)$, $(2,6)$, $(4,6)$, $(6,4)$ and $(8,8)$. The starting point has to be given: moving a graph up or down changes no slope, so a derivative alone determines the graph only up to a constant. Try both directions below. Type the corners of a graph, or the steps of a derivative, and read off the other one. ## Where is a derivative function defined? **A derivative function is defined at the points where the limit exists, which can be fewer than the points where $f$ is defined: it is missing at corners, cusps, vertical tangents and jumps, and at the end of a closed interval only a one-sided derivative can exist.** The five ways a derivative can fail are in the section on [functions with no derivative](https://nunada.my.id/articles/tangent-lines-and-derivative-at-a-point/#no-derivative); here the question is what that does to the function $f'$. **Open and closed intervals.** $f$ is differentiable on an open interval (finite or infinite) if it has a derivative at every point of it. It is differentiable on a closed interval $[a,b]$ if it is differentiable on $(a,b)$ and the one-sided limits exist at the ends: the right-hand derivative at $a$ and the left-hand derivative at $b$, $$\lim_{h\to0^+}\frac{f(a+h)-f(a)}{h},$$ $$\lim_{h\to0^-}\frac{f(b+h)-f(b)}{h}.$$ At an interior point the derivative exists exactly when the left-hand and right-hand derivatives both exist and are equal. **The absolute value.** For $x>0$, $|x|=x$ has derivative $1$, and for $x<0$, $|x|=-x$ has derivative $-1$. At $0$ the right-hand derivative is $1$ and the left-hand one is $-1$, so there is none. The derivative function is $-1$ for $x<0$ and $1$ for $x>0$ (for $x\ne0$ it can be written $\frac{x}{|x|}$), with no value at $0$. So $f=|x|$ is differentiable on $(-\infty,0)$ and on $(0,\infty)$ but not at $0$, and the domain of $f'$ leaves out the corner. **The square root.** At $0$ the secant slopes of $\sqrt x$ are $\frac{\sqrt h}{h}=\frac1{\sqrt h}$, which grows without bound, so there is no derivative at $0$ and the graph has a vertical tangent there. The domain of $f'$ is $(0,\infty)$, one point smaller than that of $f$. **A derivative need not be continuous.** If $f$ is differentiable at a point it is [continuous there](https://nunada.my.id/articles/tangent-lines-and-derivative-at-a-point/#no-derivative), but the derivative function can still behave badly. Let $f(x)=x^2\sin\frac1x$ for $x\ne0$ and $f(0)=0$. At $0$ the difference quotient is $h\sin\frac1h$, which tends to $0$, so $f'(0)=0$. For $x\ne0$ the formulas give $f'(x)=2x\sin\frac1x-\cos\frac1x$, and as $x\to0$ the term $2x\sin\frac1x$ vanishes but $\cos\frac1x$ keeps swinging between $-1$ and $1$. So $f$ is differentiable everywhere and $f'$ is not continuous at $0$. The last graph in the tool above shows it. *The graph of |x| (green) and its derivative (orange): −1 to the left of 0, +1 to the right, and an open circle on each side at 0, where there is no value.* ## How do you compute and plot a derivative function in code? **Differentiate symbolically with SymPy to get an exact formula, or numerically with a central difference on a grid when all you have is numbers; either way the derivative is an object you can evaluate and plot.** SymPy works on the formula and returns the formula for $f'$, so `diff` is differentiation as an operation on a function. It may need `simplify` to put the answer in the form you would write by hand: for $\frac{x}{x-1}$ it first returns $-\frac{x}{(x-1)^2}+\frac{1}{x-1}$, which equals $-\frac{1}{(x-1)^2}$, the result of the definition above. ```python import sympy as sp x = sp.symbols('x') f = x / (x - 1) print(sp.diff(f, x)) # -x/(x - 1)**2 + 1/(x - 1) print(sp.simplify(sp.diff(f, x))) # -1/(x - 1)**2 print(sp.diff(sp.sqrt(x), x)) # 1/(2*sqrt(x)) print(sp.diff(1 / x, x)) # -1/x**2 ``` **With numbers only, a derivative function is a function that returns a difference quotient.** The first block below builds one from any function: `derivative(f)` returns a new function, so the derivative really is a function in the program too. The second block differentiates samples on a grid with NumPy. On a grid of spacing $0.5$ for $x^3-3x$ the interior values are off by exactly $h^2=0.25$ (the error of a central difference), but at the two ends NumPy can only use one side, a one-sided derivative, and it is off by $2.75$: the same endpoint story as on a closed interval. ```python import numpy as np def derivative(f, h=1e-5): """The derivative of f, as a new function (central difference).""" return lambda x: (f(x + h) - f(x - h)) / (2 * h) g = derivative(lambda t: t**3 - 3*t) print([round(g(t), 6) for t in (-2, -1, 0, 1, 2)]) # [9.0, 0.0, -3.0, 0.0, 9.0] xs = np.linspace(-2, 2, 9) # spacing 0.5 ys = xs**3 - 3*xs dy = np.gradient(ys, xs) # central inside, one-sided at the ends print(dy) # [ 6.25 4. 0.25 -2. -2.75 -2. 0.25 4. 6.25] print(3*xs**2 - 3) # [ 9. 3.75 0. -2.25 -3. -2.25 0. 3.75 9. ] print(np.round(dy - (3*xs**2 - 3), 4)) # [-2.75 0.25 0.25 0.25 0.25 0.25 0.25 0.25 -2.75] ``` ```cpp #include #include using namespace std; double f(double t) { return t * t * t - 3 * t; } double derivative(double x, double h) { return (f(x + h) - f(x - h)) / (2 * h); } // central difference int main() { for (int t = -2; t <= 2; t++) printf("%.4f ", derivative(t, 1e-5)); // 9 0 -3 0 9 cout << endl; double xs[9], ys[9], dy[9]; // a grid with spacing 0.5 for (int i = 0; i < 9; i++) { xs[i] = -2 + 0.5 * i; ys[i] = f(xs[i]); } dy[0] = (ys[1] - ys[0]) / 0.5; // one-sided at the ends dy[8] = (ys[8] - ys[7]) / 0.5; for (int i = 1; i < 8; i++) dy[i] = (ys[i + 1] - ys[i - 1]) / 1.0; // central inside for (int i = 0; i < 9; i++) printf("%6.2f", dy[i]); cout << endl; for (int i = 0; i < 9; i++) printf("%6.2f", 3 * xs[i] * xs[i] - 3); // the exact derivative cout << endl; for (int i = 0; i < 9; i++) printf("%6.2f", dy[i] - (3 * xs[i] * xs[i] - 3)); // the ends are worst cout << endl; return 0; } /* output: 9.0000 0.0000 -3.0000 0.0000 9.0000 6.25 4.00 0.25 -2.00 -2.75 -2.00 0.25 4.00 6.25 9.00 3.75 0.00 -2.25 -3.00 -2.25 0.00 3.75 9.00 -2.75 0.25 0.25 0.25 0.25 0.25 0.25 0.25 -2.75 */ ``` ## Where do the names and symbols of the derivative come from? **The ideas are older than the symbols: the three notations in use today come from Leibniz, Newton and Lagrange, and the word "derivative" itself is French.** - **Leibniz.** Gottfried Leibniz introduced $dx$ and $dy$, together with the integral sign, in manuscripts of 1675 and published his differential calculus in 1684. His $\frac{dy}{dx}$ was meant as a ratio of tiny differences, which is why it is still so convenient when changing variables, and it names the variable. - **Newton.** Isaac Newton wrote the rate of change of a flowing quantity $y$ with a dot over the letter, ẏ, which he called its fluxion. The dot survives in physics for derivatives with respect to time. - **Lagrange.** Joseph-Louis Lagrange wanted to base calculus on algebra and called the function obtained from $f$ its fonction dérivée, the derived function, in his Théorie des fonctions analytiques (1797). The words "derivative" and the prime $f'(x)$ come from there. - **Arbogast.** Louis Arbogast introduced the operator letter $D$ for the operation of differentiating in 1800, which is the notation used for $Df(x)$ and $D^2f$. The limit definition that this article starts from is later and is described in the history in the article on [tangent lines](https://nunada.my.id/articles/tangent-lines-and-derivative-at-a-point/#history). ## What mistakes do people make with the derivative function? **The most common mistakes with the derivative as a function are the nine below, each with the correct statement.** | Mistake | Correct | |---|---| | ❌ $f'(x)=f(x+h)-f(x)$, with the division forgotten | The slope needs the division by $h$: $f'(x)=\lim_{h\to0}\frac{f(x+h)-f(x)}{h}$. The top alone tends to $0$. | | ❌ $f(x+h)=f(x)+h$ | Substitute $x+h$ for every $x$: $(x+h)^2=x^2+2xh+h^2$, not $x^2+h$. | | ❌ The derivative of $\frac1x$ is $\frac1{x^2}$ | $\frac{d}{dx}\frac1x=-\frac{1}{x^2}$: the sign matters, and $\frac1x$ is falling, so its slope is negative. | | ❌ $f'$ is defined wherever $f$ is | $\sqrt x$ is defined at $0$ but $\sqrt x$ has no derivative there; the domain of $f'$ can be smaller. | | ❌ The derivative of the absolute value of $x$ is $1$ | It is $-1$ for $x<0$, $1$ for $x>0$ and does not exist at $0$. | | ❌ $\frac{dy}{dx}$ is a fraction whose $d$'s you can cancel | It is one symbol for the derivative; $\frac{dy}{dx}$ is not "$d$ times $y$ over $d$ times $x$". | | ❌ The graph of $f'$ is the graph of $f$ moved or stretched | Its height is the slope of $f$: at a peak of $f$ the graph of $f'$ crosses zero; it is not high there. | | ❌ A corner of $f$ gives the value $0$ for $f'$ | At a corner $f'$ does not exist: the graph of $f'$ has a gap, with different one-sided values. | | ❌ If $f$ is differentiable everywhere, $f'$ must be continuous | $x^2\sin\frac1x$ is differentiable everywhere, yet its derivative oscillates near $0$ and is not continuous. | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: the derivative as a function at a glance - **Definition:** $f'(x)=\lim_{h\to0}\frac{f(x+h)-f(x)}{h}=\lim_{z\to x}\frac{f(z)-f(x)}{z-x}$, a function of $x$ whose domain is where the limit exists. - **From the definition:** $x^2\to2x$, $x^3\to3x^2$, $\frac1x\to-\frac1{x^2}$, $\frac{x}{x-1}\to-\frac1{(x-1)^2}$, $\sqrt x\to\frac1{2\sqrt x}$; constants $\to0$, lines $mx+b\to m$. - **Notation:** $f'(x)$, $y'$, $\frac{dy}{dx}$, $\frac{df}{dx}$, $\frac{d}{dx}f(x)$, $Df(x)$; $\frac{dy}{dx}\big|_{x=a}$ for a value; one symbol, not a fraction. - **Graph of $f'$:** plot slopes; $f'>0$ rising, $f'<0$ falling, $f'=0$ flat; where $f'$ climbs, $f$ bends upward ($f''>0$). - **Segments:** the derivative is a step function; a corner has no value; the derivative fixes a graph only up to a constant. - **Domain:** open interval = every point; closed interval = also one-sided derivatives at the ends; missing at corners, cusps, vertical tangents, jumps. - **Careful:** $f'$ need not be continuous ($x^2\sin\frac1x$); $f'(x)$ is not $f(x+h)-f(x)$ and not $\frac1{x^2}$ for $\frac1x$. - **Code:** SymPy `diff` for the exact formula; a function that returns a central difference, or NumPy `gradient`, for numbers. ## Glossary: key terms - **Derivative function**: The function f prime whose value at each x is the derivative of f at that x, defined wherever the limit of the difference quotient exists. - **Differentiation**: The process of finding the derivative of a function; it is an operation that takes a function as input and returns another function. - **Differentiable on an interval**: Having a derivative at every point of an open interval, or, for a closed interval, on the inside plus one-sided derivatives at the two ends. - **Right-hand and left-hand derivatives**: The limits of the difference quotient as h approaches zero from above and from below; a derivative exists at an inside point exactly when both exist and are equal. - **Prime notation**: The way of writing a derivative with a prime, f prime of x or y prime, which goes back to Lagrange. - **Leibniz notation**: The way of writing a derivative as dy over dx, which names the variable and is read as the derivative of y with respect to x; it is one symbol, not a fraction to cancel. - **Step function**: A function that is constant on each of several intervals, so its graph is a row of horizontal pieces; it is the derivative of a graph made of line segments. - **Second derivative**: The derivative of the derivative, written f double prime; it is the rate of change of the slope and tells whether the graph bends upward or downward. ## Frequently asked questions ### What is the derivative function? The derivative function f prime is the function that gives, for every x, the slope of the graph of f at x. Its value at x is the limit of f of x plus h minus f of x, divided by h, as h approaches zero, wherever that limit exists. ### How do you find the derivative of a function from the definition? Write f of x plus h minus f of x, divided by h, simplify until h cancels, and let h approach zero. For x squared the quotient is 2x plus h, which tends to 2x. For 1 over x it is minus 1 over x times x plus h, which tends to minus 1 over x squared. ### What is the difference between f prime of x and f prime of a? F prime of x is the whole derivative function, a formula that works for any x. F prime of a is one number, the value of that function at the point a, which is the slope of the tangent line there. Find the function first and then put in the number. ### What is the derivative of 1 over x? The derivative of 1 over x is minus 1 over x squared, for x not equal to zero. It follows from the definition, because the difference quotient simplifies to minus 1 over x times x plus h. The slope is negative everywhere, since 1 over x falls on both of its branches. ### What is the derivative of the square root of x? The derivative of the square root of x is 1 over 2 times the square root of x, for x greater than zero. The square root is defined at zero but its derivative is not, because the graph has a vertical tangent there. ### What is the derivative of the absolute value of x? It is minus 1 for x less than zero and 1 for x greater than zero. At zero there is no derivative, because the graph has a corner and the right-hand and left-hand derivatives, 1 and minus 1, are different. ### How do you graph the derivative of a function? Estimate the slope of the graph at many points and plot the slopes as heights. The new graph is above the axis where the original rises, below where it falls, and touches the axis at peaks and valleys. Leave a gap at a corner. ### Is dy over dx a fraction? Not at this stage. Dy over dx is a single symbol for the derivative of y with respect to x, so the d letters cannot be cancelled like numbers. Later in calculus dx and dy get meanings of their own, which makes the notation convenient, but that is a separate idea. ### What is the domain of the derivative of a function? It is the set of points in the domain of the function where the derivative exists. It can be smaller than the domain of the function: the square root of x is defined at zero but its derivative is not, and the absolute value of x has no derivative at its corner. --- # Turunan sebagai Fungsi Source: https://nunada.my.id/artikel/turunan-sebagai-fungsi/ Updated: 2026-10-13 ## Jawaban singkat **Turunan fungsi $f$ adalah sebuah fungsi, $f'$, yang nilainya di setiap $x$ adalah gradien grafik $f$ di sana: $f'(x)=\lim_{h\to0}\frac{f(x+h)-f(x)}{h}$, terdefinisi di setiap $x$ yang limitnya ada.** Mencarinya disebut diferensiasi. Ia dapat ditulis $f'(x)$, $\frac{dy}{dx}$, atau $Df(x)$, grafiknya dibuat dengan memplot gradien grafik $f$, dan daerah asalnya dapat lebih kecil daripada daerah asal $f$, seperti pada $\sqrt x$ di $0$ atau $|x|$ di $0$. ### Poin penting - Fungsi turunan $f'$ memetakan setiap $x$ ke gradien grafik $f$ di $x$; daerah asalnya adalah himpunan titik tempat $f$ terdiferensialkan, yang mungkin lebih kecil daripada daerah asal $f$. - Untuk menurunkan dari definisi, tulis hasil bagi selisih dengan $x$ tetap sebagai huruf, sederhanakan sampai $h$ tercoret, lalu biarkan $h\to0$: $x^2\to2x$, $x^3\to3x^2$, $\frac1x\to-\frac1{x^2}$, $\sqrt x\to\frac1{2\sqrt x}$. - Turunan yang sama memiliki banyak nama: $f'(x)$, $y'$, $\frac{dy}{dx}$, $\frac{df}{dx}$, $\frac{d}{dx}f(x)$, dan $Df(x)$; $\frac{dy}{dx}$ adalah satu lambang, bukan pecahan yang dapat dicoret. - Grafik $f'$ dapat digambar dari grafik $f$ dengan memplot gradien: $f'>0$ di tempat $f$ naik, $f'<0$ di tempat ia turun, dan $f'=0$ pada garis singgung mendatar. - Turunan grafik yang tersusun dari ruas garis adalah fungsi tangga tanpa nilai di sudut tajam; di ujung selang tertutup hanya ada turunan sepihak. - Fungsi dapat terdiferensialkan di mana-mana sementara $f'$ tidak kontinu ($x^2\sin\frac1x$); dalam kode, SymPy memberi $f'$ secara eksak dan selisih terpusat pada sebuah grid memberinya secara numerik. ## Apa artinya turunan sebagai sebuah fungsi? **Turunan $f$ adalah fungsi baru $f'$ yang memberikan, untuk setiap $x$, turunan $f$ di $x$ itu: $f'(x)=\lim_{h\to0}\frac{f(x+h)-f(x)}{h}$, untuk setiap $x$ yang limitnya ada.** [Turunan di suatu titik](https://nunada.my.id/artikel/garis-singgung-dan-turunan-di-suatu-titik/#derivative-at-a-point) adalah satu bilangan di satu tempat. Membiarkan titiknya bergerak menghasilkan aturan yang memberikan gradien untuk setiap masukan: masukkan $x$ dan keluarlah gradien grafik $f$ di $x$. Bilangan $f'(a)$ tidak lain nilai fungsi ini di $a$. Empat akibat perlu disebut sekaligus. - **Daerah asal $f'$ dapat lebih kecil daripada daerah asal $f$.** Ia adalah himpunan $x$ dalam daerah asal $f$ tempat limitnya ada. $f(x)=\sqrt x$ terdefinisi di $0$, tetapi $f'$ tidak (grafiknya memiliki garis singgung tegak di sana). - **Terdiferensialkan memiliki dua arti.** $f$ terdiferensialkan di $x$ bila $f'(x)$ ada, dan terdiferensialkan bila $f'$ ada di setiap titik pada daerah asalnya. - **Ada bentuk kedua dari limit itu.** Menulis $z=x+h$, sehingga $h=z-x$ dan $h\to0$ tepat bila $z\to x$, memberi $$f'(x)=\lim_{z\to x}\frac{f(z)-f(x)}{z-x},$$ yang sering lebih mudah bila $f$ memuat akar, seperti pada contoh di bawah. - **Diferensiasi adalah operasi pada fungsi.** Masukkan fungsi $f$, keluar fungsi $f'$. Itulah sebabnya bagian-bagian berikut membahas mencari rumus $f'$, bukan satu bilangan. Gradien grafik $f$ di $x$ dan laju perubahan sesaat $f$ di $x$ adalah dua cara membaca bilangan $f'(x)$ yang sama, seperti pada bagian tentang [laju perubahan](https://nunada.my.id/artikel/garis-singgung-dan-turunan-di-suatu-titik/#rates-of-change). ## Bagaimana mencari fungsi turunan dari definisi? **Untuk menurunkan dari definisi, tulis hasil bagi selisih dengan $x$ tetap sebagai huruf, sederhanakan sampai $h$ tercoret, lalu biarkan $h\to0$; yang tersisa adalah rumus dalam $x$.** Berikut lima fungsi, masing-masing dengan triknya sendiri. **1. $f(x)=x^2$: jabarkan dan coret.** Setelah [menjabarkan kurung](https://nunada.my.id/artikel/bentuk-aljabar/#expand), $$\frac{(x+h)^2-x^2}{h}=\frac{2xh+h^2}{h}=2x+h,$$ yang menuju $2x$. **2. $f(x)=x^3$.** Karena $(x+h)^3=x^3+3x^2h+3xh^2+h^3$, $$\frac{(x+h)^3-x^3}{h}=3x^2+3xh+h^2,$$ yang menuju $3x^2$. **3. $f(x)=\frac1x$: samakan penyebut.** Untuk $x\ne0$, dengan [penjumlahan pecahan](https://nunada.my.id/artikel/bilangan-rasional/#add-subtract-fractions), $$\frac{\frac1{x+h}-\frac1x}{h}=\frac{x-(x+h)}{x(x+h)\,h}=\frac{-1}{x(x+h)},$$ yang menuju $-\frac1{x^2}$. **4. $f(x)=\frac{x}{x-1}$.** Dengan penyebut bersama, pembilangnya adalah $(x+h)(x-1)-x(x+h-1)=-h$, sehingga faktor $h$ tercoret: $$\frac{f(x+h)-f(x)}{h}=\frac{-1}{(x+h-1)(x-1)},$$ yang menuju $-\frac{1}{(x-1)^2}$ untuk $x\ne1$. **5. $f(x)=\sqrt x$: bentuk kedua dan sekawan.** Untuk $x>0$, tulis $z-x=(\sqrt z-\sqrt x)(\sqrt z+\sqrt x)$ dan coret: $$\frac{\sqrt z-\sqrt x}{z-x}=\frac{1}{\sqrt z+\sqrt x},$$ yang menuju $\frac{1}{2\sqrt x}$ saat $z\to x$. Ini trik yang sama dengan [merasionalkan](https://nunada.my.id/artikel/eksponen-dan-akar/#rationalise). Rumusnya membesar tanpa batas di $0$: $\sqrt x$ terdefinisi untuk $x\ge0$ dan turunannya hanya untuk $x>0$. Dua kasus lagi perlu diingat. Untuk konstanta $f(x)=c$ setiap hasil bagi selisih adalah $0$, sehingga $f'(x)=0$. Untuk garis $f(x)=mx+b$ hasilnya $\frac{m(x+h)+b-mx-b}{h}=m$, sehingga $f'(x)=m$: gradien sebuah garis adalah turunannya. Bandingkan $x^2\to2x$ dengan $x^3\to3x^2$. Pada keduanya pangkat turun ke depan dan pangkat $x$ berkurang satu. Pola itu benar, dan [aturan turunan](https://nunada.my.id/artikel/aturan-turunan/#constants-and-powers) membuktikannya untuk setiap bilangan bulat positif; di sini ia hanya pengamatan dari contoh. Untuk memeriksa salah satunya di suatu titik, masukkan nilai $x$: untuk $\frac{x}{x-1}$ di $x=3$ rumusnya memberi $-\frac14$, dan gradien garis potong pada alat di bawah mendekati tepat nilai itu. Coba fungsimu sendiri: alat itu menjabarkan hasil bagi selisih dalam pangkat $h$, atau menyederhanakan turunan sebuah hasil bagi, dan memperlihatkan kedua grafik. ## Apa saja notasi untuk turunan? **Turunan $y=f(x)$ dapat ditulis $f'(x)$, $y'$, $\frac{dy}{dx}$, $\frac{df}{dx}$, $\frac{d}{dx}f(x)$, atau $Df(x)$; semuanya menamai fungsi yang sama dan hanya berbeda cara penulisannya.** Notasi aksen $f'$ dan $y'$ berasal dari Lagrange dan singkat. Notasi $\frac{d}{dx}$ adalah milik Leibniz, dan ia punya kelebihan yang tidak dimiliki aksen: ia menyebut peubahnya. Jika $y$ bergantung pada waktu $t$, $\frac{dy}{dt}$ menyatakan apa yang berubah terhadap apa, dan ia membawa satuannya, satuan $y$ per satuan $t$. Huruf $\frac{d}{dx}$ dan $D$ melambangkan operasi menurunkan, yang dikenakan pada sebuah fungsi. Bacalah $\frac{dy}{dx}$ sebagai "turunan $y$ terhadap $x$". Pada tahap ini $\frac{dy}{dx}$ adalah satu lambang untuk turunan, bukan pecahan: kamu tidak dapat mencoret $d$-nya, dan ia bukan "$dy$ dibagi $dx$". (Kemudian dalam kalkulus $dx$ dan $dy$ memang mendapat arti sendiri, yang membuat notasi ini begitu praktis, tetapi itu gagasan yang terpisah.) Untuk menyatakan nilai turunan di bilangan tertentu, sebut titiknya dengan garis tegak dan subskrip: $$f'(a)=\frac{dy}{dx}\bigg|_{x=a}=\frac{df}{dx}\bigg|_{x=a}.$$ Misalnya, karena $\frac{d}{dx}\sqrt x=\frac{1}{2\sqrt x}$, $\ \frac{d}{dx}\sqrt x\bigg|_{x=4}=\frac{1}{2\cdot2}=\frac14$, yaitu gradien garis singgung di $(4,2)$. Pilih bentuk yang paling jelas: $f'(x)$ bila fungsinya bernama, $\frac{dy}{dx}$ bila peubahnya penting, $D$ bila kamu memperlakukan diferensiasi sebagai operator. ## Bagaimana menggambar grafik turunan dari grafik sebuah fungsi? **Bacalah gradien grafik $f$ di banyak titik dan plot gradien itu sebagai tinggi: di tempat $f$ naik grafik $f'$ berada di atas sumbu, di tempat $f$ turun ia berada di bawah, dan di tempat $f$ memiliki garis singgung mendatar ia menyentuh sumbu.** Caranya adalah menggambar garis singgung pada langkah-langkah yang rapat sepanjang grafik, menaksir tiap gradien, memplot pasangan $(x,f'(x))$, dan menghubungkannya dengan kurva. Membaca grafik $f'$ memberi tiga hal sekilas: 1. **Di mana laju perubahan positif, negatif, atau nol.** $f'>0$ berarti $f$ naik, $f'<0$ berarti turun, $f'=0$ berarti titik datar, yang sering berupa puncak bukit atau dasar lembah. 2. **Seberapa besar lajunya.** Makin jauh $f'$ dari sumbu, makin curam grafik $f$. 3. **Di mana laju itu sendiri bertambah atau berkurang.** Di tempat grafik $f'$ naik, gradien $f$ membesar; grafik $f$ melengkung ke atas. Di tempat ia turun, grafik $f$ melengkung ke bawah. Laju perubahan $f'$ adalah [turunan kedua](https://nunada.my.id/artikel/aturan-turunan/#higher-order), ditulis $f''$, yaitu fungsi turunan yang dikenakan dua kali. Dua contoh untuk dibandingkan dengan alat di bawah. Untuk $f(x)=x^2$ gradiennya negatif di kiri puncak, nol di puncak, dan positif di kanan, bertambah secara tetap: $f'(x)=2x$, sebuah garis lurus. Untuk $f(x)=x^3-3x$ grafiknya naik ke puncak di $x=-1$, turun melewati $x=0$ dengan gradien $-3$ (penurunan paling curam) dan naik lagi setelah lembah di $x=1$, sehingga $f'(x)=3x^2-3$ adalah parabola yang memotong sumbu di $-1$ dan $1$ dan memiliki titik terendah di $x=0$. Pembacaan gradien yang sama menjelaskan mengapa turunan $\sin x$ adalah $\cos x$: gradien gelombang sinus nol di setiap puncak dan lembah, terbesar di tempat gelombang memotong sumbu sambil naik, dan hasilnya adalah gelombang yang sama yang digeser seperempat periode ke kiri. Geser titik di bawah sepanjang sembilan grafik. Grafik atas memperlihatkan $f$ dan garis singgungnya; yang bawah menggambar $f'$ sampai titik itu, dengan tinggi titiknya adalah gradien garis singgung di atasnya. *Fungsi kubik f(x) = x³ − 3x (hijau) memiliki puncak di A dan lembah di B, tempat garis singgungnya mendatar; turunannya f′(x) = 3x² − 3 (jingga) bernilai nol tepat di sana, di A′ dan B′, positif di tempat f naik dan negatif di antara keduanya.* ## Apa turunan grafik yang tersusun dari ruas garis? **Turunan grafik yang tersusun dari ruas garis adalah fungsi tangga: pada tiap ruas ia sama dengan gradien ruas itu, dan di sudut tajam, tempat dua ruas dengan gradien berbeda bertemu, ia tidak bernilai.** Setiap ruas adalah bagian dari garis $y=mx+b$, yang turunannya adalah konstanta $m$. Ambil grafik yang melalui $(0,0)$, $(2,4)$, $(5,4)$, $(7,0)$, dan $(9,2)$. Gradien ruas-ruasnya adalah $\frac{4-0}{2-0}=2$, $0$, $\frac{0-4}{7-5}=-2$, dan $\frac{2-0}{9-7}=1$, sehingga $f'$ bernilai $2$ pada $(0,2)$, $0$ pada $(2,5)$, $-2$ pada $(5,7)$, dan $1$ pada $(7,9)$. Di $x=2$, $5$, dan $7$ gradien sepihaknya berbeda (di kiri dan kanan $x=2$ berturut-turut $2$ dan $0$), sehingga turunan kanan dan turunan kiri tidak sama dan $f'$ tidak ada: grafik $f'$ memiliki lingkaran terbuka di kedua sisi setiap sudut tajam. Di kedua ujung grafik hanya ada satu sisi, turunan sepihak. Sebuah titik sudut hanya merupakan sudut tajam bila gradiennya benar-benar berbeda. Jika ruas di kedua sisinya terletak pada garis yang sama, seperti pada $(0,0)$, $(1,1)$, $(3,3)$, $(4,1)$ di $x=1$, titik itu bukan sudut tajam dan $f'$ bernilai $1$ di sana. Arah sebaliknya juga bisa, dengan satu hal yang hilang. Dari anak tangga $f'$ kamu dapat membangun kembali grafiknya dengan berjalan: mulai dari sebuah titik, ikuti gradien $m_1$ sampai patahan pertama, lalu $m_2$, dan seterusnya. Mulai dari $(0,0)$ dengan gradien $3$ sampai $x=2$, lalu $0$ sampai $4$, lalu $-1$ sampai $6$, lalu $2$ sampai $8$, memberi titik sudut $(0,0)$, $(2,6)$, $(4,6)$, $(6,4)$, dan $(8,8)$. Titik awalnya harus diberikan: menggeser grafik ke atas atau ke bawah tidak mengubah gradien mana pun, sehingga turunan saja menentukan grafik hanya sampai sebuah konstanta. Cobalah kedua arah di bawah. Ketik titik sudut sebuah grafik, atau anak tangga sebuah turunan, dan baca yang lainnya. ## Di mana fungsi turunan terdefinisi? **Fungsi turunan terdefinisi di titik-titik tempat limitnya ada, yang dapat lebih sedikit daripada titik tempat $f$ terdefinisi: ia hilang pada sudut tajam, cusp, garis singgung tegak, dan lompatan, dan di ujung selang tertutup hanya turunan sepihak yang dapat ada.** Lima cara turunan dapat gagal ada pada bagian tentang [fungsi tanpa turunan](https://nunada.my.id/artikel/garis-singgung-dan-turunan-di-suatu-titik/#no-derivative); di sini pertanyaannya adalah apa akibatnya bagi fungsi $f'$. **Selang terbuka dan tertutup.** $f$ terdiferensialkan pada selang terbuka (hingga atau tak hingga) bila ia memiliki turunan di setiap titiknya. Ia terdiferensialkan pada selang tertutup $[a,b]$ bila ia terdiferensialkan pada $(a,b)$ dan limit-limit sepihak ada di ujung-ujungnya: turunan kanan di $a$ dan turunan kiri di $b$, $$\lim_{h\to0^+}\frac{f(a+h)-f(a)}{h},$$ $$\lim_{h\to0^-}\frac{f(b+h)-f(b)}{h}.$$ Di titik dalam, turunan ada tepat bila turunan kiri dan turunan kanan keduanya ada dan sama. **Nilai mutlak.** Untuk $x>0$, $|x|=x$ memiliki turunan $1$, dan untuk $x<0$, $|x|=-x$ memiliki turunan $-1$. Di $0$ turunan kanannya $1$ dan turunan kirinya $-1$, sehingga tidak ada turunan. Fungsi turunannya adalah $-1$ untuk $x<0$ dan $1$ untuk $x>0$ (untuk $x\ne0$ dapat ditulis $\frac{x}{|x|}$), tanpa nilai di $0$. Jadi $f=|x|$ terdiferensialkan pada $(-\infty,0)$ dan pada $(0,\infty)$ tetapi tidak di $0$, dan daerah asal $f'$ meninggalkan sudut tajamnya. **Akar kuadrat.** Di $0$ gradien garis potong $\sqrt x$ adalah $\frac{\sqrt h}{h}=\frac1{\sqrt h}$, yang membesar tanpa batas, sehingga tidak ada turunan di $0$ dan grafiknya memiliki garis singgung tegak di sana. Daerah asal $f'$ adalah $(0,\infty)$, satu titik lebih kecil daripada daerah asal $f$. **Turunan tidak harus kontinu.** Jika $f$ terdiferensialkan di suatu titik, ia [kontinu di sana](https://nunada.my.id/artikel/garis-singgung-dan-turunan-di-suatu-titik/#no-derivative), tetapi fungsi turunannya masih dapat berperilaku buruk. Misalkan $f(x)=x^2\sin\frac1x$ untuk $x\ne0$ dan $f(0)=0$. Di $0$ hasil bagi selisihnya adalah $h\sin\frac1h$, yang menuju $0$, sehingga $f'(0)=0$. Untuk $x\ne0$ rumusnya memberi $f'(x)=2x\sin\frac1x-\cos\frac1x$, dan saat $x\to0$ suku $2x\sin\frac1x$ menghilang tetapi $\cos\frac1x$ terus berayun di antara $-1$ dan $1$. Jadi $f$ terdiferensialkan di mana-mana dan $f'$ tidak kontinu di $0$. Grafik terakhir pada alat di atas memperlihatkannya. *Grafik |x| (hijau) dan turunannya (jingga): −1 di kiri 0, +1 di kanan, dan lingkaran terbuka di tiap sisi di 0, yang tidak bernilai.* ## Bagaimana menghitung dan memplot fungsi turunan dalam kode? **Dalam kode, turunkan secara simbolik dengan SymPy untuk memperoleh rumus eksak, atau secara numerik dengan selisih terpusat pada sebuah grid bila yang kamu miliki hanya bilangan; keduanya menghasilkan turunan yang dapat dievaluasi dan diplot.** SymPy bekerja pada rumus dan mengembalikan rumus $f'$, sehingga `diff` adalah diferensiasi sebagai operasi pada fungsi. Ia mungkin memerlukan `simplify` untuk menuliskan jawaban dalam bentuk yang kamu tulis dengan tangan: untuk $\frac{x}{x-1}$ ia lebih dulu mengembalikan $-\frac{x}{(x-1)^2}+\frac{1}{x-1}$, yang sama dengan $-\frac{1}{(x-1)^2}$, hasil dari definisi di atas. ```python import sympy as sp x = sp.symbols('x') f = x / (x - 1) print(sp.diff(f, x)) # -x/(x - 1)**2 + 1/(x - 1) print(sp.simplify(sp.diff(f, x))) # -1/(x - 1)**2 print(sp.diff(sp.sqrt(x), x)) # 1/(2*sqrt(x)) print(sp.diff(1 / x, x)) # -1/x**2 ``` **Dengan bilangan saja, fungsi turunan adalah fungsi yang mengembalikan hasil bagi selisih.** Blok pertama di bawah membangunnya dari fungsi apa pun: `derivative(f)` mengembalikan fungsi baru, sehingga turunan benar-benar sebuah fungsi dalam program juga. Blok kedua menurunkan sampel pada sebuah grid dengan NumPy. Pada grid berjarak $0{,}5$ untuk $x^3-3x$ nilai-nilai di bagian dalam meleset tepat $h^2=0{,}25$ (galat selisih terpusat), tetapi di kedua ujung NumPy hanya dapat memakai satu sisi, turunan sepihak, dan melesetnya $2{,}75$: cerita ujung yang sama seperti pada selang tertutup. ```python import numpy as np def derivative(f, h=1e-5): """The derivative of f, as a new function (central difference).""" return lambda x: (f(x + h) - f(x - h)) / (2 * h) g = derivative(lambda t: t**3 - 3*t) print([round(g(t), 6) for t in (-2, -1, 0, 1, 2)]) # [9.0, 0.0, -3.0, 0.0, 9.0] xs = np.linspace(-2, 2, 9) # spacing 0.5 ys = xs**3 - 3*xs dy = np.gradient(ys, xs) # central inside, one-sided at the ends print(dy) # [ 6.25 4. 0.25 -2. -2.75 -2. 0.25 4. 6.25] print(3*xs**2 - 3) # [ 9. 3.75 0. -2.25 -3. -2.25 0. 3.75 9. ] print(np.round(dy - (3*xs**2 - 3), 4)) # [-2.75 0.25 0.25 0.25 0.25 0.25 0.25 0.25 -2.75] ``` ```cpp #include #include using namespace std; double f(double t) { return t * t * t - 3 * t; } double derivative(double x, double h) { return (f(x + h) - f(x - h)) / (2 * h); } // central difference int main() { for (int t = -2; t <= 2; t++) printf("%.4f ", derivative(t, 1e-5)); // 9 0 -3 0 9 cout << endl; double xs[9], ys[9], dy[9]; // a grid with spacing 0.5 for (int i = 0; i < 9; i++) { xs[i] = -2 + 0.5 * i; ys[i] = f(xs[i]); } dy[0] = (ys[1] - ys[0]) / 0.5; // one-sided at the ends dy[8] = (ys[8] - ys[7]) / 0.5; for (int i = 1; i < 8; i++) dy[i] = (ys[i + 1] - ys[i - 1]) / 1.0; // central inside for (int i = 0; i < 9; i++) printf("%6.2f", dy[i]); cout << endl; for (int i = 0; i < 9; i++) printf("%6.2f", 3 * xs[i] * xs[i] - 3); // the exact derivative cout << endl; for (int i = 0; i < 9; i++) printf("%6.2f", dy[i] - (3 * xs[i] * xs[i] - 3)); // the ends are worst cout << endl; return 0; } /* output: 9.0000 0.0000 -3.0000 0.0000 9.0000 6.25 4.00 0.25 -2.00 -2.75 -2.00 0.25 4.00 6.25 9.00 3.75 0.00 -2.25 -3.00 -2.25 0.00 3.75 9.00 -2.75 0.25 0.25 0.25 0.25 0.25 0.25 0.25 -2.75 */ ``` ## Dari mana asal nama dan lambang turunan? **Gagasannya lebih tua daripada lambangnya: tiga notasi yang dipakai sekarang berasal dari Leibniz, Newton, dan Lagrange, dan kata "turunan" sendiri berasal dari bahasa Prancis.** - **Leibniz.** Gottfried Leibniz memperkenalkan $dx$ dan $dy$, bersama tanda integral, dalam naskah tahun 1675 dan menerbitkan kalkulus diferensialnya pada 1684. $\frac{dy}{dx}$-nya dimaksudkan sebagai perbandingan selisih-selisih kecil, itulah sebabnya ia tetap praktis saat mengganti peubah, dan ia menyebut peubahnya. - **Newton.** Isaac Newton menulis laju perubahan besaran yang mengalir $y$ dengan sebuah titik di atas hurufnya, ẏ, yang ia sebut fluksinya. Titik itu bertahan dalam fisika untuk turunan terhadap waktu. - **Lagrange.** Joseph-Louis Lagrange ingin mendasarkan kalkulus pada aljabar dan menyebut fungsi yang diperoleh dari $f$ sebagai fonction dérivée, fungsi turunan, dalam Théorie des fonctions analytiques (1797). Kata "turunan" dan aksen $f'(x)$ berasal dari sana. - **Arbogast.** Louis Arbogast memperkenalkan huruf operator $D$ untuk operasi menurunkan pada 1800, yaitu notasi yang dipakai pada $Df(x)$ dan $D^2f$. Definisi limit yang menjadi titik tolak artikel ini lebih kemudian dan diuraikan dalam sejarah pada artikel tentang [garis singgung](https://nunada.my.id/artikel/garis-singgung-dan-turunan-di-suatu-titik/#history). ## Kesalahan apa yang sering terjadi pada fungsi turunan? **Kesalahan paling umum pada turunan sebagai fungsi adalah sembilan hal berikut, masing-masing dengan pernyataan yang benar.** | Kesalahan | Yang benar | |---|---| | ❌ $f'(x)=f(x+h)-f(x)$, pembagiannya terlupa | Gradien memerlukan pembagian dengan $h$: $f'(x)=\lim_{h\to0}\frac{f(x+h)-f(x)}{h}$. Pembilang saja menuju $0$. | | ❌ $f(x+h)=f(x)+h$ | Gantikan $x+h$ untuk setiap $x$: $(x+h)^2=x^2+2xh+h^2$, bukan $x^2+h$. | | ❌ Turunan $\frac1x$ adalah $\frac1{x^2}$ | $\frac{d}{dx}\frac1x=-\frac{1}{x^2}$: tandanya penting, dan $\frac1x$ menurun, sehingga gradiennya negatif. | | ❌ $f'$ terdefinisi di mana pun $f$ terdefinisi | $\sqrt x$ terdefinisi di $0$ tetapi tidak memiliki turunan di sana; daerah asal $f'$ dapat lebih kecil. | | ❌ Turunan nilai mutlak $x$ adalah $1$ | Ia $-1$ untuk $x<0$, $1$ untuk $x>0$, dan tidak ada di $0$. | | ❌ $\frac{dy}{dx}$ adalah pecahan yang $d$-nya dapat dicoret | Ia satu lambang untuk turunan; $\frac{dy}{dx}$ bukan "$d$ kali $y$ per $d$ kali $x$". | | ❌ Grafik $f'$ adalah grafik $f$ yang digeser atau diregangkan | Tingginya adalah gradien $f$: di puncak $f$ grafik $f'$ memotong nol; ia tidak tinggi di sana. | | ❌ Sudut tajam pada $f$ memberi nilai $0$ untuk $f'$ | Di sudut tajam $f'$ tidak ada: grafik $f'$ memiliki celah, dengan nilai sepihak yang berbeda. | | ❌ Jika $f$ terdiferensialkan di mana-mana, $f'$ pasti kontinu | $x^2\sin\frac1x$ terdiferensialkan di mana-mana, tetapi turunannya berosilasi di dekat $0$ dan tidak kontinu. | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: turunan sebagai fungsi sekilas - **Definisi:** $f'(x)=\lim_{h\to0}\frac{f(x+h)-f(x)}{h}=\lim_{z\to x}\frac{f(z)-f(x)}{z-x}$, fungsi dari $x$ yang daerah asalnya adalah tempat limit ada. - **Dari definisi:** $x^2\to2x$, $x^3\to3x^2$, $\frac1x\to-\frac1{x^2}$, $\frac{x}{x-1}\to-\frac1{(x-1)^2}$, $\sqrt x\to\frac1{2\sqrt x}$; konstanta $\to0$, garis $mx+b\to m$. - **Notasi:** $f'(x)$, $y'$, $\frac{dy}{dx}$, $\frac{df}{dx}$, $\frac{d}{dx}f(x)$, $Df(x)$; $\frac{dy}{dx}\big|_{x=a}$ untuk sebuah nilai; satu lambang, bukan pecahan. - **Grafik $f'$:** plot gradien; $f'>0$ naik, $f'<0$ turun, $f'=0$ datar; di tempat $f'$ naik, $f$ melengkung ke atas ($f''>0$). - **Ruas garis:** turunannya fungsi tangga; sudut tajam tidak bernilai; turunan menentukan grafik hanya sampai sebuah konstanta. - **Daerah asal:** selang terbuka = setiap titik; selang tertutup = juga turunan sepihak di ujung; hilang pada sudut tajam, cusp, garis singgung tegak, lompatan. - **Hati-hati:** $f'$ tidak harus kontinu ($x^2\sin\frac1x$); $f'(x)$ bukan $f(x+h)-f(x)$ dan bukan $\frac1{x^2}$ untuk $\frac1x$. - **Kode:** `diff` SymPy untuk rumus eksak; fungsi yang mengembalikan selisih terpusat, atau `gradient` NumPy, untuk bilangan. ## Glosarium: istilah penting - **Fungsi turunan**: Fungsi f aksen yang nilainya di setiap x adalah turunan f di x itu, terdefinisi di mana pun limit hasil bagi selisih ada. - **Diferensiasi**: Proses mencari turunan sebuah fungsi; ia adalah operasi yang menerima fungsi sebagai masukan dan mengembalikan fungsi lain. - **Terdiferensialkan pada selang**: Memiliki turunan di setiap titik pada selang terbuka, atau, untuk selang tertutup, di bagian dalam ditambah turunan sepihak di kedua ujungnya. - **Turunan kanan dan turunan kiri**: Limit hasil bagi selisih saat h mendekati nol dari atas dan dari bawah; turunan ada di titik dalam tepat bila keduanya ada dan sama. - **Notasi aksen**: Cara menulis turunan dengan aksen, f aksen dari x atau y aksen, yang berasal dari Lagrange. - **Notasi Leibniz**: Cara menulis turunan sebagai dy per dx, yang menyebut peubahnya dan dibaca turunan y terhadap x; ia satu lambang, bukan pecahan untuk dicoret. - **Fungsi tangga**: Fungsi yang konstan pada tiap beberapa selang, sehingga grafiknya berupa deretan potongan mendatar; ia adalah turunan grafik yang tersusun dari ruas garis. - **Turunan kedua**: Turunan dari turunan, ditulis f aksen ganda; ia adalah laju perubahan gradien dan menyatakan apakah grafik melengkung ke atas atau ke bawah. ## Pertanyaan yang sering diajukan ### Apa itu fungsi turunan? Fungsi turunan f aksen adalah fungsi yang memberikan, untuk setiap x, gradien grafik f di x. Nilainya di x adalah limit f dari x ditambah h dikurangi f dari x, dibagi h, saat h mendekati nol, di mana pun limit itu ada. ### Bagaimana mencari turunan sebuah fungsi dari definisi? Tulis f dari x ditambah h dikurangi f dari x, dibagi h, sederhanakan sampai h tercoret, lalu biarkan h mendekati nol. Untuk x kuadrat hasil baginya 2x ditambah h, yang menuju 2x. Untuk 1 per x hasilnya min 1 per x kali x ditambah h, yang menuju min 1 per x kuadrat. ### Apa beda f aksen dari x dan f aksen dari a? F aksen dari x adalah seluruh fungsi turunan, rumus yang berlaku untuk x mana pun. F aksen dari a adalah satu bilangan, nilai fungsi itu di titik a, yaitu gradien garis singgung di sana. Cari fungsinya lebih dulu lalu masukkan bilangannya. ### Berapa turunan 1 per x? Turunan 1 per x adalah min 1 per x kuadrat, untuk x tidak sama dengan nol. Hasil ini mengikuti definisi, karena hasil bagi selisih menyederhana menjadi min 1 per x kali x ditambah h. Gradiennya negatif di mana-mana, sebab 1 per x menurun pada kedua cabangnya. ### Berapa turunan akar x? Turunan akar x adalah 1 per 2 kali akar x, untuk x lebih besar dari nol. Akar terdefinisi di nol tetapi turunannya tidak, karena grafiknya memiliki garis singgung tegak di sana. ### Berapa turunan nilai mutlak x? Turunannya min 1 untuk x kurang dari nol dan 1 untuk x lebih besar dari nol. Di nol tidak ada turunan, karena grafiknya memiliki sudut tajam dan turunan kanan dan turunan kiri, 1 dan min 1, berbeda. ### Bagaimana menggambar grafik turunan sebuah fungsi? Taksir gradien grafik di banyak titik dan plot gradien itu sebagai tinggi. Grafik baru berada di atas sumbu di tempat grafik asal naik, di bawah di tempat ia turun, dan menyentuh sumbu di puncak dan lembah. Sisakan celah di sudut tajam. ### Apakah dy per dx sebuah pecahan? Belum pada tahap ini. Dy per dx adalah satu lambang untuk turunan y terhadap x, sehingga huruf d tidak dapat dicoret seperti bilangan. Kemudian dalam kalkulus dx dan dy mendapat arti sendiri, yang membuat notasi ini praktis, tetapi itu gagasan yang terpisah. ### Apa daerah asal turunan sebuah fungsi? Ia adalah himpunan titik pada daerah asal fungsi tempat turunan ada. Ia dapat lebih kecil daripada daerah asal fungsi: akar x terdefinisi di nol tetapi turunannya tidak, dan nilai mutlak x tidak memiliki turunan di sudut tajamnya. --- # Tangent Lines and the Derivative at a Point Source: https://nunada.my.id/articles/tangent-lines-and-derivative-at-a-point/ Updated: 2026-10-12 ## Quick answer **The tangent line to a graph at a point is the straight line that fits the graph there, and its slope is the derivative at that point: the limit of the slopes of secant lines as the second point slides toward the first, $f'(a)=\lim_{h\to0}\frac{f(a+h)-f(a)}{h}$.** The line is $y=f(a)+f'(a)(x-a)$. The derivative is the instantaneous rate of change, and it fails to exist at a corner, a cusp, a jump or a vertical tangent. ### Key takeaways - A secant line joins two points of a graph; its slope is the difference quotient $\frac{f(a+h)-f(a)}{h}$, the average rate of change over a step of size $h$. - The derivative $f'(a)$ is the limit of the difference quotient as $h\to0$; it is the slope of the tangent line and the instantaneous rate of change at $x=a$. - The tangent line at $x=a$ is $y=f(a)+f'(a)(x-a)$; the normal line is perpendicular to it, with slope $-1/f'(a)$. - A tangent line does not just touch once: it can meet the curve again, and at an inflection point it crosses the curve. It is a local idea, about direction. - Zooming in on a differentiable graph makes it look straight; at a corner, a cusp or a jump it never does, and there the derivative does not exist. - Differentiable at a point implies continuous there, but not the other way around; in code a central difference with $h\approx10^{-5}$ is a good numerical derivative. ## What is a tangent line to a curve? **A tangent line to a curve at a point is the straight line that fits the curve best at that point: it passes through the point and points in the same direction as the curve there.** Close to the point the curve and its tangent line are almost the same thing, which is what the zoom tool below shows: the closer you look, the straighter the curve becomes, until you cannot tell it from its tangent. The idea comes from circles, where a tangent touches the circle at one point and is perpendicular to the radius (see [chords and tangents](https://nunada.my.id/articles/circles/#chords-and-tangents)). For a general curve "touches at exactly one point" is not the right definition, for three reasons: - **A tangent can meet the curve again.** The line $y=-2$ is the tangent to $y=x^3-3x$ at $x=1$, and it meets the curve a second time at $x=-2$. - **A line that meets a curve once need not be a tangent.** The vertical line $x=1$ meets the parabola $y=x^2$ only once, yet the parabola at $(1,1)$ climbs with slope $2$; its tangent there is $y=2x-1$. - **A tangent can cross the curve.** At the inflection point $x=0$ of $y=x^3-3x$ the tangent $y=-3x$ passes from one side of the curve to the other. So the tangent is a local idea. It says which way the curve is heading at the point, not how the line meets the curve far away. To make it precise we need two steps: the slope of a secant line, which joins two points of the curve, and then what happens to that slope when the two points merge. That is the next section. Try it: pick a function and a point, then zoom in. ## How do you find the slope of a tangent line? **The slope of the tangent line at $x=a$ is the limit of the slopes of the secant lines through $(a,f(a))$ and a second point $(a+h,f(a+h))$, as $h$ shrinks toward $0$.** A secant line is a line through two points of a curve. Its slope is rise over run, the difference quotient: $$\frac{f(a+h)-f(a)}{h}.$$ Take $f(x)=x^2$ at $a=1$. [Expanding the bracket](https://nunada.my.id/articles/algebraic-expressions/#expand) gives $f(1+h)-f(1)=(1+h)^2-1=2h+h^2$, and [taking out the common factor](https://nunada.my.id/articles/algebraic-expressions/#factor) $h$ gives $$\frac{(1+h)^2-1}{h}=\frac{h(2+h)}{h}=2+h\qquad(h\ne0).$$ Now let the second point approach $(1,1)$: - From the right: $h=1$ gives slope $3$, $h=0.1$ gives $2.1$, $h=0.01$ gives $2.01$, $h=0.001$ gives $2.001$. - From the left: $h=-0.1$ gives $1.9$, $h=-0.01$ gives $1.99$, $h=-0.001$ gives $1.999$. The slopes close in on $2$ from both sides, and we write $\lim_{h\to0}(2+h)=2$. That limit is the slope of the tangent line. Why not simply put $h=0$ in the quotient? Because it gives $\frac00$, which has no value: the two points would be the same point and there is no line through "two" points. The limit does not ask for the value at $h=0$; it asks what the quotient approaches when $h$ is near $0$ but not $0$. After cancelling $h$ the answer is plain. Two details matter. The limit has to exist from both sides, because the second point may lie to the left ($h<0$) or to the right ($h>0$). And when it exists it gives the definition: **The tangent line to the graph of $f$ at $P=(a,f(a))$ is the line through $P$ with slope $m=\lim_{h\to0}\frac{f(a+h)-f(a)}{h}$, provided this limit exists.** If the quotient grows without bound the line is vertical, which is covered below. *On y = x², the secants through P = (1, 1) and Q1 = (2, 4) or Q2 = (1.5, 2.25) have slopes 3 and 2.5 (dashed); as the second point slides toward P the slope falls to 2, the slope of the tangent y = 2x − 1 (solid).* ## What is the derivative of a function at a point? **The derivative of $f$ at $a$, written $f'(a)$, is the limit of the difference quotient, $f'(a)=\lim_{h\to0}\frac{f(a+h)-f(a)}{h}$, when that limit exists; it is the slope of the tangent line at $x=a$ and the instantaneous rate of change of $f$ there.** Writing $x=a+h$ gives the same limit in a second form, $$f'(a)=\lim_{x\to a}\frac{f(x)-f(a)}{x-a},$$ which is often handier when the function has a root in it. The derivative at a point is a number. Other notations for it are $\frac{df}{dx}\bigg|_{x=a}$ and $\frac{dy}{dx}\bigg|_{x=a}$ (Leibniz). A function is differentiable at $a$ when the limit exists. Three examples show the three usual algebra tricks. **1. A polynomial: expand and cancel $h$.** For $f(x)=x^3-3x$ at $a=2$ we have $f(2)=2$, and $(2+h)^3=8+12h+6h^2+h^3$, so subtracting $f(2)$ leaves $$\frac{f(2+h)-f(2)}{h}=\frac{9h+6h^2+h^3}{h}.$$ Cancelling $h$ gives $9+6h+h^2$, which tends to $9$ as $h\to0$. So $f'(2)=9$, and the tangent line there is steep. **2. A fraction: combine over a common denominator.** For $f(x)=\frac1x$ at $a=2$, using [adding fractions](https://nunada.my.id/articles/rational-numbers/#add-subtract-fractions), $$\frac{\frac1{2+h}-\frac12}{h}=\frac{2-(2+h)}{2(2+h)\,h}=\frac{-1}{2(2+h)}\to-\frac14.$$ The same steps at any $a\ne0$ give $f'(a)=-\frac{1}{a^2}$: the slope is negative everywhere, steep near $x=0$ and flattening out far away, and it is $-\frac14$ at both $a=2$ and $a=-2$, so there are two tangents of that slope. **3. A root: multiply by the conjugate.** For $f(x)=\sqrt x$ at $a=4$, by [rationalizing](https://nunada.my.id/articles/exponents-and-radicals/#rationalise) the numerator: multiplying top and bottom by $\sqrt{4+h}+2$ turns the numerator into $(4+h)-4=h$, so $$\frac{\sqrt{4+h}-2}{h}=\frac{h}{h\left(\sqrt{4+h}+2\right)}.$$ Cancelling $h$ leaves $\frac{1}{\sqrt{4+h}+2}$, which tends to $\frac14$ as $h\to0$. The quotient can be handled from one side at a time. The right-hand derivative uses $h\to0^+$ and the left-hand derivative uses $h\to0^-$; $f$ is differentiable at $a$ exactly when both exist and are equal. Doing the same limit at every $a$ at once gives a new function, the derivative function $f'$, and its rules are shortcuts for this limit; the definition above is what they are shortcuts for. ## How do you write the equation of a tangent line? **The tangent line to $y=f(x)$ at $x=a$ is $y=f(a)+f'(a)(x-a)$, the point-slope form of the line through $(a,f(a))$ with slope $f'(a)$.** Three steps: find the height $f(a)$, find the slope $f'(a)$ from the limit, and put both into the formula. Three examples: - $f(x)=x^2$ at $a=1$: $f(1)=1$ and $f'(1)=2$, so $y=1+2(x-1)=2x-1$. - $f(x)=\frac1x$ at $a=2$: $f(2)=\frac12$ and $f'(2)=-\frac14$, so $y=\frac12-\frac14(x-2)=-\frac x4+1$. - $f(x)=x^3-3x$ at $a=1$: $f(1)=-2$ and $f'(1)=0$, so $y=-2$, a horizontal tangent (slope $0$). The normal line at the point is the line through it at right angles to the tangent. Its slope is $-\frac{1}{f'(a)}$ when $f'(a)\ne0$, since the slopes of perpendicular lines multiply to $-1$; when the tangent is horizontal the normal is the vertical line $x=a$. For $y=x^2$ at $(1,1)$ the normal is $y=1-\frac12(x-1)=-\frac x2+\frac32$. The tangent line also has an algebraic signature that does not mention limits. Subtract the tangent line from the function: the difference $f(x)-\big(f(a)+f'(a)(x-a)\big)$ is zero at $x=a$, and for a polynomial it has a double root there. For $x^3-3x$ at $a=1$ the difference is $x^3-3x+2=(x-1)^2(x+2)$: the double root at $1$ is the tangency, and the simple root at $x=-2$ is the second place where the tangent meets the curve. At the inflection point $a=0$ the difference is $x^3$, a triple root, which is why the tangent crosses the curve there. The same idea finds tangents through an outside point. To draw tangents to $y=x^2$ from $(1,-3)$, ask for which $a$ the tangent at $a$ passes through that point: $a^2+2a(1-a)=-3$, which simplifies to $a^2-2a-3=0$, so $(a-3)(a+1)=0$. The tangent lines touch the parabola at $a=3$ and $a=-1$: $y=6x-9$ and $y=-2x-1$. (Both pass through $(1,-3)$: $6-9=-3$ and $-2-1=-3$.) A tangent line is also an approximation. Near $a$, $f(x)\approx f(a)+f'(a)(x-a)$. With $f(x)=\sqrt x$, $a=4$ and slope $\frac14$, we get $\sqrt{4.1}\approx2+\frac14\cdot0.1=2.025$; the true value is $2.02485\ldots$, so the error is under $0.0002$. This is one of the ways of [approximating an irrational number](https://nunada.my.id/articles/irrational-numbers/#rational-approximations). Try it: type a polynomial and a point, or a point outside the curve. Every number is an exact fraction. *The horizontal line y = −2 is the tangent to y = x³ − 3x at A = (1, −2): a double root of the difference. It also meets the curve at the simple root B = (−2, −2).* ## What does the derivative at a point mean in real life? **The derivative at a point is the instantaneous rate of change: how fast the output is changing per unit of input at that exact moment, in units of $y$ per unit of $x$.** The difference quotient is the average rate of change over a step of size $h$, and the derivative is what the average settles on as the step shrinks to nothing. **Speed.** Let a ball dropped from a tower fall $s(t)=4.9t^2$ meters in $t$ seconds. Its average speed from $t=1$ to $t=1+h$ is $$\frac{4.9(1+h)^2-4.9}{h}=9.8+4.9h.$$ Over a whole second ($h=1$) that is $14.7$ m/s, over half a second $12.25$ m/s, over $0.1$ s it is $10.29$ m/s, over $0.01$ s it is $9.849$ m/s, and as $h\to0$ it tends to $9.8$ m/s. That number, $s'(1)=9.8$ m/s, is the reading on the speedometer at $t=1$: an average needs a time interval, a speed at an instant needs the limit. **Cost.** If making $q$ items costs $C(q)=2q^2+30q+400$ dollars, then $C(11)-C(10)=972-900=72$ dollars is the extra cost of the 11th item, which is a difference quotient with $h=1$. The derivative $C'(10)=4\cdot10+30=70$ is the marginal cost at $10$ items: $70$ dollars per additional item, close to the exact extra of $72$ dollars. Economists use the derivative as a quick estimate of the cost of one more. **Reading the sign.** If $f'(a)>0$ the graph is rising at $a$, if $f'(a)<0$ it is falling, and if $f'(a)=0$ the tangent is horizontal. A horizontal tangent can be a top, a bottom, or neither: $y=x^3$ has $f'(0)=0$ but keeps rising through $0$. **Constant rate.** For a straight line the rate is the same everywhere, and the tangent line is the line itself. The equal steps of an [arithmetic sequence](https://nunada.my.id/articles/arithmetic-sequences-and-series/#what-is-an-arithmetic-sequence) are the same thing in discrete form: a constant difference is a constant slope. A curve has a different slope at each point, and the derivative is what lets you ask for it one point at a time. **Units.** The derivative has the units of $y$ divided by the units of $x$: meters per second for distance against time, dollars per item for cost against quantity. A road that climbs $8$ meters for each $100$ meters along the ground has slope $0.08$, an 8% grade. Motion along a line (velocity, speed, acceleration, jerk, free fall) and marginal cost and revenue are worked out in full in [the derivative as a rate of change](https://nunada.my.id/articles/the-derivative-as-a-rate-of-change/#motion-along-a-line). ## When does a function have no derivative at a point? **A function has no derivative at a point when the limit of the difference quotient does not exist, which happens at a corner, a cusp, a jump, a vertical tangent, or where the graph wiggles without settling down.** The widget below shows each case at $x=0$ with the slopes of secants from the left and from the right. Here is what to look for: - **A corner.** For $f(x)=|x|$ the secant slopes are $-1$ from the left and $+1$ from the right. They disagree, so there is no tangent line, and no amount of zoom straightens a corner. - **A cusp.** For $f(x)=x^{2/3}$ the slopes from the right grow to $+\infty$ and from the left to $-\infty$: two vertical directions that point opposite ways. - **A jump.** A function that jumps is not even continuous there, and the difference quotient blows up on at least one side. - **A vertical tangent.** For $f(x)=x^{1/3}$ the slopes grow to $+\infty$ from both sides: the tangent line is the vertical line $x=0$. The graph has a tangent line, but its slope is not a number, so $f'(0)$ does not exist. - **Endless wiggling.** For $f(x)=x\sin\frac1x$ the secant slope is $\sin\frac1h$, which keeps swinging between $-1$ and $1$ and never settles. Not every graph that bends at a point has a corner, either. $f(x)=x|x|$ looks as if it might kink at $0$, but its slopes tend to $0$ from both sides, so $f'(0)=0$ and the tangent is horizontal. **Differentiable implies continuous.** If $f'(a)$ exists then $f(a+h)-f(a)=\frac{f(a+h)-f(a)}{h}\cdot h$, which tends to $f'(a)\cdot0=0$, so $f(a+h)\to f(a)$. That rules out every jump. The converse is false: $|x|$ is continuous everywhere and not differentiable at $0$. So continuity is necessary for a derivative but not sufficient. A practical test follows from the zoom: a graph that is differentiable at a point looks like a straight line when you zoom in on that point, and one that is not does not. ## How do you compute a derivative at a point in code? **In code, estimate the derivative with a difference quotient and a small step, preferably the central difference $\frac{f(a+h)-f(a-h)}{2h}$ with $h$ near $10^{-5}$; for a polynomial with exact fractions you can get the exact slope with no limit and no rounding.** The forward quotient $\frac{f(a+h)-f(a)}{h}$ has an error that shrinks in proportion to $h$; the central one has an error proportional to $h^2$, because the two first-order errors cancel. Do not shrink $h$ as far as possible, though. A computer stores each value with a relative rounding error of about $10^{-16}$, and subtracting two nearly equal numbers keeps that absolute error while dividing by a tiny $h$ magnifies it. The run below estimates the derivative of $\sin$ at $1$, whose true value is $\cos 1=0.5403023058681398$: the error falls as $h$ falls, bottoms out (near $10^{-8}$ for the forward quotient and near $10^{-5}$ for the central one) and then climbs again. At $h=10^{-14}$ both are wrong in the third digit. ```python import math def forward(f, a, h): return (f(a + h) - f(a)) / h # error shrinks like h def central(f, a, h): return (f(a + h) - f(a - h)) / (2 * h) # error shrinks like h squared a, true = 1.0, math.cos(1.0) # the derivative of sin at 1 is cos(1) for k in (1, 3, 5, 8, 11, 14): h = 10.0 ** -k print(f"h=1e-{k:<2} forward {abs(forward(math.sin, a, h) - true):.1e} central {abs(central(math.sin, a, h) - true):.1e}") # h=1e-1 forward 4.3e-02 central 9.0e-04 # h=1e-3 forward 4.2e-04 central 9.0e-08 # h=1e-5 forward 4.2e-06 central 1.1e-11 # h=1e-8 forward 3.0e-09 central 2.6e-09 # h=1e-11 forward 1.2e-06 central 1.2e-06 # h=1e-14 forward 3.7e-03 central 3.7e-03 ``` **For a polynomial there is no need to estimate at all.** Writing $f(a+h)$ as a polynomial in $h$ (a shift of the variable, done by repeated synthetic division) gives $f(a)+f'(a)\,h+\cdots$, so the coefficient of $h$ is exactly the slope, as a fraction, with the limit already taken. The code below does that with `Fraction` and reproduces the hand computation of $f'(2)=9$ for $x^3-3x$; the list is the polynomial $f(2+h)=2+9h+6h^2+h^3$, so the difference quotient is $9+6h+h^2$, as before. The same idea is what a computer algebra system such as SymPy does when it differentiates symbolically. ```python from fractions import Fraction def shift(coeffs, a): """Coefficients of f(a + h) for f = c0 + c1 x + c2 x^2 + ..., by repeated synthetic division.""" out, cur = [], list(coeffs) while cur: carry, rest = Fraction(0), [] for c in reversed(cur): carry = c + carry * a rest.append(carry) out.append(rest.pop()) # the remainder is the next coefficient cur = rest[::-1] return out f = [0, -3, 0, 1] # x^3 - 3x print(shift(f, Fraction(2))) # [Fraction(2, 1), Fraction(9, 1), Fraction(6, 1), Fraction(1, 1)] print(shift(f, Fraction(2))[1]) # 9, the slope at 2 print(shift([Fraction(4), 0, Fraction(1, 2)], Fraction(6))[1]) # 6, the slope of x^2/2 + 4 at 6 ``` ```cpp #include #include #include using namespace std; // the slope at a of c[0] + c[1] x + c[2] x^2 + ..., exactly, by Horner's rule on the polynomial and its derivative double slope(const double c[], int n, double a) { double p = 0, dp = 0; for (int i = n - 1; i >= 0; i--) { dp = dp * a + p; p = p * a + c[i]; } return dp; } int main() { double a = 1.0, truth = cos(1.0); // the derivative of sin at 1 is cos(1) for (int k = 1; k <= 4; k++) { double h = pow(10, -k); double forward = (sin(a + h) - sin(a)) / h; // the error shrinks like h double central = (sin(a + h) - sin(a - h)) / (2 * h); // the error shrinks like h squared printf("h=1e-%d forward %.1e central %.1e\n", k, fabs(forward - truth), fabs(central - truth)); } // for much smaller h, rounding errors take over and both errors grow again double f[4] = {0, -3, 0, 1}; // x^3 - 3x printf("%.0f\n", slope(f, 4, 2)); // 9, the slope at 2 double g[3] = {4, 0, 0.5}; // x^2 / 2 + 4 printf("%.0f\n", slope(g, 3, 6)); // 6, the slope at 6 return 0; } /* output: h=1e-1 forward 4.3e-02 central 9.0e-04 h=1e-2 forward 4.2e-03 central 9.0e-06 h=1e-3 forward 4.2e-04 central 9.0e-08 h=1e-4 forward 4.2e-05 central 9.0e-10 9 6 */ ``` ## Who invented tangents and derivatives? **No single person did: tangents are ancient, finding them with algebra began in the 1630s, Newton and Leibniz built a calculus on it in the 1660s to 1680s, and the limit definition used today dates from the 1820s.** - **Antiquity.** Euclid (about 300 BCE) proved the properties of a tangent to a circle in Book III of the Elements, and Apollonius (about 200 BCE) and Archimedes found tangents to conics and to a spiral by special geometric arguments, one curve at a time. - **The 1630s.** Pierre de Fermat (about 1636) had a method that compares $f(x+e)$ with $f(x)$, divides by $e$ and then sets $e$ to zero; it found tangents and maximums and is the first form of the difference quotient. René Descartes (La Géométrie, 1637) found the normal to a curve by asking when a circle centered on the axis meets it in a double point, the same double-root idea as in the tangent signature above. - **1670s and 1680s.** Isaac Barrow drew a tiny "differential triangle" on the curve to find tangents. Isaac Newton (notes of 1665 to 1666) treated a changing quantity as a flowing one with a rate, the fluxion, and Gottfried Leibniz (published 1684) wrote the rate as the ratio $\frac{dy}{dx}$ of tiny differences, a notation still used. They disagreed bitterly about priority. Joseph-Louis Lagrange introduced the prime notation $f'(x)$ in 1797. - **The 1820s.** Augustin-Louis Cauchy defined the derivative as the limit of the difference quotient in his lectures at the École Polytechnique (1823), turning a method into a definition. Even then it was believed that continuous functions must be differentiable almost everywhere, and André-Marie Ampère tried to prove it in 1806. - **Counterexamples.** Bernard Bolzano (about 1830) and Karl Weierstrass (shown in 1872) built continuous functions that have no derivative at any point, and so no tangent line anywhere, showing how far continuity is from differentiability. ## What mistakes do people make with tangent lines and derivatives? **The most common mistakes with tangents and the derivative at a point are the nine below, each with the correct statement.** | Mistake | Correct | |---|---| | ❌ A tangent line touches the curve at exactly one point | A tangent can meet the curve again ($y=-2$ meets $y=x^3-3x$ at $x=-2$) and can cross it at an inflection point. It describes the direction at the point. | | ❌ A line that meets a curve once is a tangent | The vertical line $x=1$ meets $y=x^2$ once and is not a tangent; the tangent at $(1,1)$ is $y=2x-1$. | | ❌ One secant with a small $h$, such as $h=0.1$, gives the slope | Each secant gives an average rate; the slope is the limit as $h\to0$. For $x^2$ at $1$ the secant with $h=0.1$ has slope $2.1$, not $2$. | | ❌ Put $h=0$ in the quotient, get $\frac00$, so there is no derivative | $\frac00$ is undetermined, not a verdict. Simplify first, then let $h\to0$: $\frac{2h+h^2}{h}=2+h\to2$. | | ❌ $f'(a)$ is the derivative of the number $f(a)$, so it is $0$ | $f'(a)$ means the derivative of the function $f$, evaluated at $a$. The limit is taken before the point is plugged in. | | ❌ The tangent line is $y=f'(a)(x-a)$ | Add the height: $y=f(a)+f'(a)(x-a)$, so that the line passes through $(a,f(a))$. | | ❌ The normal line has slope $-f'(a)$ | The slope is the negative reciprocal, $-\frac{1}{f'(a)}$: the slopes of perpendicular lines multiply to $-1$. | | ❌ A graph with no gaps has a derivative everywhere | Continuous is not enough: the graph of $y$ equal to the absolute value of $x$ has no gap and no derivative at $0$. | | ❌ $f'(a)=0$ means $a$ is a maximum or a minimum | It means only a horizontal tangent: $x^3$ has slope $0$ at $0$ and is rising there. | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: tangent lines and the derivative at a point at a glance - **Secant:** the line through $(a,f(a))$ and $(a+h,f(a+h))$; slope $\frac{f(a+h)-f(a)}{h}$, the average rate of change. - **Derivative at a point:** $f'(a)=\lim_{h\to0}\frac{f(a+h)-f(a)}{h}=\lim_{x\to a}\frac{f(x)-f(a)}{x-a}$, a number: the slope of the tangent and the instantaneous rate. - **Tangent line:** $y=f(a)+f'(a)(x-a)$; **normal line:** slope $-\frac{1}{f'(a)}$, or the vertical line $x=a$ when the tangent is horizontal. - **Tangent facts:** it can meet the curve again and can cross it at an inflection point; for a polynomial, $f(x)$ minus the tangent has a double root at $a$. - **Meaning:** units of $y$ per unit of $x$; $f'(a)>0$ rising, $<0$ falling, $=0$ horizontal. - **No derivative:** a corner, a cusp, a jump, a vertical tangent, or endless wiggling; differentiable implies continuous, and not conversely. - **Code:** central difference with $h\approx10^{-5}$; exact slope of a polynomial from the shift $f(a+h)$. ## Glossary: key terms - **Tangent line**: A straight line that passes through a point of a curve and has the same direction as the curve there; its slope is the derivative of the function at that point. - **Secant line**: A straight line through two points of a curve; its slope is the average rate of change of the function between the two points. - **Difference quotient**: The change in a function divided by the change in its input, f of a plus h minus f of a, all over h; it is the slope of a secant line. - **Derivative at a point**: The limit of the difference quotient as h approaches zero, when it exists; it is the slope of the tangent line and the instantaneous rate of change at that point. - **Instantaneous rate of change**: How fast a quantity is changing at one exact moment, found as the limit of the average rates of change over shorter and shorter intervals. - **Differentiable function**: A function that has a derivative at a given point, or at every point of an interval; such a function is continuous there and looks like a straight line when you zoom in. - **Normal line**: The line through a point of a curve that is perpendicular to the tangent line there; its slope is the negative reciprocal of the derivative when the derivative is not zero. - **One-sided derivative**: The limit of the difference quotient taken only from the right or only from the left; a function is differentiable at a point exactly when both exist and are equal. - **Corner**: A point where a continuous graph changes direction abruptly, so the secant slopes from the left and from the right tend to different numbers and there is no tangent line. - **Vertical tangent**: A tangent line that is the vertical line through the point, which happens when the difference quotient grows without bound; the function has no derivative there, since a vertical line has no slope. ## Frequently asked questions ### What is a tangent line to a curve? A tangent line to a curve at a point is the straight line through the point that has the same direction as the curve there. Its slope is the limit of the slopes of secant lines through the point. It can meet the curve elsewhere, so touching once is not the definition. ### What is the derivative at a point? The derivative of f at a is the limit of f of a plus h minus f of a, divided by h, as h approaches zero, when that limit exists. It is the slope of the tangent line at a and the instantaneous rate of change of f there. ### What is the difference between a secant line and a tangent line? A secant line passes through two points of a curve and has the slope of the average rate of change between them. A tangent line has the slope of the instantaneous rate of change at one point, and it is the limit of the secants as the second point approaches the first. ### How do you find the equation of a tangent line? Find the height f of a and the slope f prime of a from the limit definition, then write y equals f of a plus f prime of a times x minus a. For y equal to x squared at x equal to 1 the height is 1, the slope is 2 and the line is y equals 2x minus 1. ### What does the derivative at a point mean? It is the instantaneous rate of change of the function at that point, in units of the output per unit of the input. For distance against time it is the speed at that instant, and for cost against quantity it is the marginal cost. Geometrically it is the slope of the graph. ### Can a tangent line cross the curve? Yes. A tangent describes only the direction of the curve at the point. At an inflection point such as x equal to 0 on y equals x cubed the tangent crosses the curve, and a tangent can also meet the curve again elsewhere, as y equals minus 2 does on x cubed minus 3x. ### When is a function not differentiable at a point? A function is not differentiable where the limit of the difference quotient does not exist: at a corner such as the absolute value of x at 0, at a cusp, at a jump, at a vertical tangent, or where it oscillates without settling. It must also be continuous there. ### Is every continuous function differentiable? No. A differentiable function is always continuous, but a continuous function need not be differentiable. The absolute value of x is continuous everywhere and has a corner at 0, and Weierstrass constructed continuous functions that have no derivative at any point. ### What is the normal line to a curve? The normal line at a point of a curve is the line through that point perpendicular to the tangent line. When the tangent has a slope m other than zero the normal has slope minus 1 over m, and when the tangent is horizontal the normal is vertical. --- # Garis Singgung dan Turunan di Suatu Titik Source: https://nunada.my.id/artikel/garis-singgung-dan-turunan-di-suatu-titik/ Updated: 2026-10-12 ## Jawaban singkat **Garis singgung grafik di suatu titik adalah garis lurus yang paling cocok dengan grafik di titik itu, dan gradiennya adalah turunan di titik tersebut: limit gradien garis potong ketika titik kedua bergeser mendekati titik pertama, $f'(a)=\lim_{h\to0}\frac{f(a+h)-f(a)}{h}$.** Garisnya $y=f(a)+f'(a)(x-a)$. Turunan adalah laju perubahan sesaat, dan ia tidak ada pada sudut tajam, cusp, lompatan, atau garis singgung tegak. ### Poin penting - Garis potong menghubungkan dua titik pada grafik; gradiennya adalah hasil bagi selisih $\frac{f(a+h)-f(a)}{h}$, laju perubahan rata-rata pada langkah sebesar $h$. - Turunan $f'(a)$ adalah limit hasil bagi selisih saat $h\to0$; ia adalah gradien garis singgung dan laju perubahan sesaat di $x=a$. - Garis singgung di $x=a$ adalah $y=f(a)+f'(a)(x-a)$; garis normal tegak lurus terhadapnya, dengan gradien $-1/f'(a)$. - Garis singgung tidak sekadar menyentuh sekali: ia dapat bertemu kurva lagi, dan di titik belok ia memotong kurva. Gagasannya lokal, tentang arah. - Memperbesar grafik yang terdiferensialkan membuatnya tampak lurus; pada sudut tajam, cusp, atau lompatan ia tidak pernah lurus, dan di sana turunan tidak ada. - Terdiferensialkan di suatu titik berarti kontinu di sana, tetapi tidak sebaliknya; dalam kode selisih terpusat dengan $h\approx10^{-5}$ adalah turunan numerik yang baik. ## Apa itu garis singgung pada sebuah kurva? **Garis singgung pada sebuah kurva di suatu titik adalah garis lurus yang paling cocok dengan kurva di titik itu: ia melalui titik tersebut dan searah dengan kurva di sana.** Di dekat titik itu, kurva dan garis singgungnya hampir sama, yaitu yang diperlihatkan alat perbesaran di bawah: makin dekat kamu melihat, makin lurus kurva itu, sampai kamu tidak dapat membedakannya dari garis singgungnya. Gagasannya berasal dari lingkaran, tempat garis singgung menyentuh lingkaran di satu titik dan tegak lurus terhadap jari-jari (lihat [tali busur dan garis singgung](https://nunada.my.id/artikel/lingkaran/#chords-and-tangents)). Untuk kurva umum "menyentuh di tepat satu titik" bukan definisi yang tepat, karena tiga hal: - **Garis singgung dapat bertemu kurva lagi.** Garis $y=-2$ adalah garis singgung $y=x^3-3x$ di $x=1$, dan ia bertemu kurva untuk kedua kalinya di $x=-2$. - **Garis yang bertemu kurva satu kali belum tentu garis singgung.** Garis tegak $x=1$ bertemu parabola $y=x^2$ hanya sekali, tetapi parabola di $(1,1)$ naik dengan gradien $2$; garis singgungnya di sana adalah $y=2x-1$. - **Garis singgung dapat memotong kurva.** Di titik belok $x=0$ pada $y=x^3-3x$ garis singgung $y=-3x$ melintas dari satu sisi kurva ke sisi lainnya. Jadi garis singgung adalah gagasan lokal. Ia menyatakan ke mana kurva menuju di titik itu, bukan bagaimana garis bertemu kurva di tempat yang jauh. Untuk membuatnya tepat kita memerlukan dua langkah: gradien garis potong, yang menghubungkan dua titik pada kurva, lalu apa yang terjadi pada gradien itu ketika kedua titik berimpit. Itulah bagian berikutnya. Cobalah: pilih sebuah fungsi dan titik, lalu perbesar. ## Bagaimana mencari gradien garis singgung? **Gradien garis singgung di $x=a$ adalah limit gradien garis potong melalui $(a,f(a))$ dan titik kedua $(a+h,f(a+h))$, saat $h$ mengecil menuju $0$.** Garis potong adalah garis yang melalui dua titik pada kurva. Gradiennya adalah kenaikan per jarak mendatar, yaitu hasil bagi selisih: $$\frac{f(a+h)-f(a)}{h}.$$ Ambil $f(x)=x^2$ di $a=1$. [Menjabarkan kurung](https://nunada.my.id/artikel/bentuk-aljabar/#expand) memberi $f(1+h)-f(1)=(1+h)^2-1=2h+h^2$, dan [mengeluarkan faktor persekutuan](https://nunada.my.id/artikel/bentuk-aljabar/#factor) $h$ memberi $$\frac{(1+h)^2-1}{h}=\frac{h(2+h)}{h}=2+h\qquad(h\ne0).$$ Sekarang biarkan titik kedua mendekati $(1,1)$: - Dari kanan: $h=1$ memberi gradien $3$, $h=0{,}1$ memberi $2{,}1$, $h=0{,}01$ memberi $2{,}01$, $h=0{,}001$ memberi $2{,}001$. - Dari kiri: $h=-0{,}1$ memberi $1{,}9$, $h=-0{,}01$ memberi $1{,}99$, $h=-0{,}001$ memberi $1{,}999$. Gradien-gradien itu mendekati $2$ dari kedua sisi, dan kita tulis $\lim_{h\to0}(2+h)=2$. Limit itu adalah gradien garis singgung. Mengapa tidak langsung memasukkan $h=0$ ke hasil bagi? Karena hasilnya $\frac00$, yang tidak bernilai: kedua titik menjadi titik yang sama dan tidak ada garis yang melalui "dua" titik. Limit tidak menanyakan nilai di $h=0$; ia menanyakan apa yang didekati hasil bagi ketika $h$ dekat $0$ tetapi bukan $0$. Setelah $h$ dicoret jawabannya jelas. Dua hal penting. Limit itu harus ada dari kedua sisi, karena titik kedua dapat berada di kiri ($h<0$) atau di kanan ($h>0$). Dan bila ada, ia memberi definisinya: **Garis singgung grafik $f$ di $P=(a,f(a))$ adalah garis melalui $P$ dengan gradien $m=\lim_{h\to0}\frac{f(a+h)-f(a)}{h}$, asalkan limit ini ada.** Bila hasil bagi membesar tanpa batas, garisnya tegak, yang dibahas di bawah. *Pada y = x², garis potong melalui P = (1, 1) dan Q1 = (2, 4) atau Q2 = (1,5; 2,25) bergradien 3 dan 2,5 (putus-putus); saat titik kedua bergeser ke P gradiennya turun menjadi 2, gradien garis singgung y = 2x − 1 (utuh).* ## Apa itu turunan fungsi di suatu titik? **Turunan $f$ di $a$, ditulis $f'(a)$, adalah limit hasil bagi selisih, $f'(a)=\lim_{h\to0}\frac{f(a+h)-f(a)}{h}$, bila limit itu ada; ia adalah gradien garis singgung di $x=a$ dan laju perubahan sesaat $f$ di sana.** Menulis $x=a+h$ memberi limit yang sama dalam bentuk kedua, $$f'(a)=\lim_{x\to a}\frac{f(x)-f(a)}{x-a},$$ yang sering lebih praktis bila fungsinya memuat akar. Turunan di suatu titik adalah sebuah bilangan. Notasi lainnya adalah $\frac{df}{dx}\bigg|_{x=a}$ dan $\frac{dy}{dx}\bigg|_{x=a}$ (Leibniz). Fungsi terdiferensialkan di $a$ bila limitnya ada. Tiga contoh memperlihatkan tiga trik aljabar yang biasa dipakai. **1. Polinomial: jabarkan dan coret $h$.** Untuk $f(x)=x^3-3x$ di $a=2$ kita punya $f(2)=2$, dan $(2+h)^3=8+12h+6h^2+h^3$, sehingga setelah dikurangi $f(2)$ tersisa $$\frac{f(2+h)-f(2)}{h}=\frac{9h+6h^2+h^3}{h}.$$ Mencoret $h$ memberi $9+6h+h^2$, yang menuju $9$ saat $h\to0$. Jadi $f'(2)=9$, dan garis singgung di sana curam. **2. Pecahan: samakan penyebut.** Untuk $f(x)=\frac1x$ di $a=2$, dengan [penjumlahan pecahan](https://nunada.my.id/artikel/bilangan-rasional/#add-subtract-fractions), $$\frac{\frac1{2+h}-\frac12}{h}=\frac{2-(2+h)}{2(2+h)\,h}=\frac{-1}{2(2+h)}\to-\frac14.$$ Langkah yang sama di sembarang $a\ne0$ memberi $f'(a)=-\frac{1}{a^2}$: gradiennya negatif di mana-mana, curam di dekat $x=0$ dan melandai di tempat yang jauh, dan bernilai $-\frac14$ di $a=2$ maupun $a=-2$, sehingga ada dua garis singgung dengan gradien itu. **3. Akar: kalikan dengan sekawan.** Untuk $f(x)=\sqrt x$ di $a=4$, dengan [merasionalkan](https://nunada.my.id/artikel/eksponen-dan-akar/#rationalise) pembilang: mengalikan pembilang dan penyebut dengan $\sqrt{4+h}+2$ mengubah pembilang menjadi $(4+h)-4=h$, sehingga $$\frac{\sqrt{4+h}-2}{h}=\frac{h}{h\left(\sqrt{4+h}+2\right)}.$$ Mencoret $h$ menyisakan $\frac{1}{\sqrt{4+h}+2}$, yang menuju $\frac14$ saat $h\to0$. Hasil bagi dapat ditangani satu sisi demi satu sisi. Turunan kanan memakai $h\to0^+$ dan turunan kiri memakai $h\to0^-$; $f$ terdiferensialkan di $a$ tepat bila keduanya ada dan sama. Melakukan limit yang sama di setiap $a$ sekaligus menghasilkan fungsi baru, fungsi turunan $f'$, dan aturan-aturannya adalah jalan pintas untuk limit ini; definisi di atas adalah apa yang dipersingkat oleh aturan-aturan itu. ## Bagaimana menulis persamaan garis singgung? **Garis singgung $y=f(x)$ di $x=a$ adalah $y=f(a)+f'(a)(x-a)$, bentuk titik-gradien dari garis yang melalui $(a,f(a))$ dengan gradien $f'(a)$.** Tiga langkah: cari tinggi $f(a)$, cari gradien $f'(a)$ dari limit, lalu masukkan keduanya ke rumus. Tiga contoh: - $f(x)=x^2$ di $a=1$: $f(1)=1$ dan $f'(1)=2$, sehingga $y=1+2(x-1)=2x-1$. - $f(x)=\frac1x$ di $a=2$: $f(2)=\frac12$ dan $f'(2)=-\frac14$, sehingga $y=\frac12-\frac14(x-2)=-\frac x4+1$. - $f(x)=x^3-3x$ di $a=1$: $f(1)=-2$ dan $f'(1)=0$, sehingga $y=-2$, garis singgung mendatar (gradien $0$). Garis normal di titik itu adalah garis yang melaluinya dan tegak lurus terhadap garis singgung. Gradiennya $-\frac{1}{f'(a)}$ bila $f'(a)\ne0$, karena hasil kali gradien dua garis yang saling tegak lurus adalah $-1$; bila garis singgungnya mendatar, garis normalnya adalah garis tegak $x=a$. Untuk $y=x^2$ di $(1,1)$ garis normalnya $y=1-\frac12(x-1)=-\frac x2+\frac32$. Garis singgung juga memiliki ciri aljabar yang tidak menyebut limit. Kurangkan garis singgung dari fungsinya: selisih $f(x)-\big(f(a)+f'(a)(x-a)\big)$ bernilai nol di $x=a$, dan untuk polinomial ia memiliki akar ganda di sana. Untuk $x^3-3x$ di $a=1$ selisihnya $x^3-3x+2=(x-1)^2(x+2)$: akar ganda di $1$ adalah titik singgungnya, dan akar tunggal di $x=-2$ adalah tempat kedua garis singgung bertemu kurva. Di titik belok $a=0$ selisihnya $x^3$, akar rangkap tiga, itulah sebabnya garis singgung memotong kurva di sana. Gagasan yang sama mencari garis singgung melalui titik di luar kurva. Untuk menggambar garis singgung pada $y=x^2$ dari $(1,-3)$, tanyakan untuk $a$ berapa garis singgung di $a$ melalui titik itu: $a^2+2a(1-a)=-3$, yang menyederhana menjadi $a^2-2a-3=0$, jadi $(a-3)(a+1)=0$. Garis singgungnya menyentuh parabola di $a=3$ dan $a=-1$: $y=6x-9$ dan $y=-2x-1$. (Keduanya melalui $(1,-3)$: $6-9=-3$ dan $-2-1=-3$.) Garis singgung juga berguna sebagai hampiran. Di dekat $a$, $f(x)\approx f(a)+f'(a)(x-a)$. Dengan $f(x)=\sqrt x$, $a=4$, dan gradien $\frac14$, kita peroleh $\sqrt{4{,}1}\approx2+\frac14\cdot0{,}1=2{,}025$; nilai sebenarnya $2{,}02485\ldots$, sehingga galatnya di bawah $0{,}0002$. Ini salah satu cara [menghampiri bilangan irasional](https://nunada.my.id/artikel/bilangan-irasional/#rational-approximations). Cobalah: ketik sebuah polinomial dan titik, atau titik di luar kurva. Setiap bilangan adalah pecahan eksak. *Garis mendatar y = −2 adalah garis singgung y = x³ − 3x di A = (1, −2): akar ganda dari selisih. Ia juga bertemu kurva di akar tunggal B = (−2, −2).* ## Apa arti turunan di suatu titik dalam kehidupan nyata? **Turunan di suatu titik adalah laju perubahan sesaat: seberapa cepat keluaran berubah per satuan masukan pada saat yang tepat itu, dalam satuan $y$ per satuan $x$.** Hasil bagi selisih adalah laju perubahan rata-rata pada langkah sebesar $h$, dan turunan adalah nilai yang didekati rata-rata itu saat langkahnya mengecil menjadi nol. **Kecepatan.** Misalkan bola yang dijatuhkan dari menara jatuh sejauh $s(t)=4{,}9t^2$ meter dalam $t$ detik. Kecepatan rata-ratanya dari $t=1$ sampai $t=1+h$ adalah $$\frac{4{,}9(1+h)^2-4{,}9}{h}=9{,}8+4{,}9h.$$ Dalam satu detik penuh ($h=1$) itu $14{,}7$ m/s, dalam setengah detik $12{,}25$ m/s, dalam $0{,}1$ detik $10{,}29$ m/s, dalam $0{,}01$ detik $9{,}849$ m/s, dan saat $h\to0$ ia menuju $9{,}8$ m/s. Bilangan itu, $s'(1)=9{,}8$ m/s, adalah angka pada spidometer di $t=1$: rata-rata memerlukan selang waktu, kecepatan pada satu saat memerlukan limit. **Biaya.** Jika membuat $q$ barang berbiaya $C(q)=2q^2+30q+400$ ribu rupiah, maka $C(11)-C(10)=972-900=72$ ribu rupiah, yaitu Rp72.000, adalah tambahan biaya barang ke-11, yang merupakan hasil bagi selisih dengan $h=1$. Turunan $C'(10)=4\cdot10+30=70$ adalah biaya marjinal pada $10$ barang: Rp70.000 per tambahan satu barang, dekat dengan tambahan eksak Rp72.000. Para ekonom memakai turunan sebagai perkiraan cepat biaya satu barang lagi. **Membaca tandanya.** Jika $f'(a)>0$ grafik naik di $a$, jika $f'(a)<0$ grafik turun, dan jika $f'(a)=0$ garis singgungnya mendatar. Garis singgung mendatar dapat berupa puncak, dasar, atau bukan keduanya: $y=x^3$ memiliki $f'(0)=0$ tetapi tetap naik melewati $0$. **Laju tetap.** Untuk garis lurus laju perubahannya sama di mana-mana, dan garis singgungnya adalah garis itu sendiri. Langkah-langkah sama pada [barisan aritmetika](https://nunada.my.id/artikel/barisan-dan-deret-aritmetika/#what-is-an-arithmetic-sequence) adalah hal yang sama dalam bentuk diskret: beda tetap adalah gradien tetap. Kurva memiliki gradien yang berbeda di tiap titik, dan turunan memungkinkan kamu menanyakannya satu titik demi satu titik. **Satuan.** Turunan bersatuan $y$ dibagi satuan $x$: meter per detik untuk jarak terhadap waktu, rupiah per barang untuk biaya terhadap jumlah. Jalan yang naik $8$ meter untuk setiap $100$ meter sepanjang tanah memiliki gradien $0{,}08$, tanjakan 8%. Gerak sepanjang garis lurus (kecepatan, laju, percepatan, sentakan, jatuh bebas) serta biaya dan pendapatan marjinal diuraikan lengkap dalam [turunan sebagai laju perubahan](https://nunada.my.id/artikel/turunan-sebagai-laju-perubahan/#motion-along-a-line). ## Kapan sebuah fungsi tidak memiliki turunan di suatu titik? **Sebuah fungsi tidak memiliki turunan di suatu titik bila limit hasil bagi selisih tidak ada, yang terjadi pada sudut tajam, cusp, lompatan, garis singgung tegak, atau tempat grafik berosilasi tanpa menetap.** Widget di bawah memperlihatkan tiap kasus di $x=0$ dengan gradien garis potong dari kiri dan dari kanan. Inilah yang perlu diperhatikan: - **Sudut tajam.** Untuk $f(x)=|x|$ gradien garis potong adalah $-1$ dari kiri dan $+1$ dari kanan. Keduanya berbeda, sehingga tidak ada garis singgung, dan sebesar apa pun perbesaran tidak meluruskan sudut tajam. - **Cusp.** Untuk $f(x)=x^{2/3}$ gradien dari kanan membesar ke $+\infty$ dan dari kiri ke $-\infty$: dua arah tegak yang berlawanan. - **Lompatan.** Fungsi yang melompat bahkan tidak kontinu di sana, dan hasil bagi selisihnya membesar tanpa batas pada setidaknya satu sisi. - **Garis singgung tegak.** Untuk $f(x)=x^{1/3}$ gradien membesar ke $+\infty$ dari kedua sisi: garis singgungnya adalah garis tegak $x=0$. Grafiknya memiliki garis singgung, tetapi gradiennya bukan bilangan, sehingga $f'(0)$ tidak ada. - **Osilasi tanpa henti.** Untuk $f(x)=x\sin\frac1x$ gradien garis potong adalah $\sin\frac1h$, yang terus berayun di antara $-1$ dan $1$ dan tidak pernah menetap. Tidak setiap grafik yang melengkung di suatu titik memiliki sudut tajam. $f(x)=x|x|$ tampak seperti bisa patah di $0$, tetapi gradiennya menuju $0$ dari kedua sisi, sehingga $f'(0)=0$ dan garis singgungnya mendatar. **Terdiferensialkan berarti kontinu.** Jika $f'(a)$ ada maka $f(a+h)-f(a)=\frac{f(a+h)-f(a)}{h}\cdot h$, yang menuju $f'(a)\cdot0=0$, sehingga $f(a+h)\to f(a)$. Itu menyingkirkan setiap lompatan. Kebalikannya salah: $|x|$ kontinu di mana-mana dan tidak terdiferensialkan di $0$. Jadi kekontinuan itu perlu untuk adanya turunan tetapi tidak cukup. Uji praktis mengikuti dari perbesaran: grafik yang terdiferensialkan di suatu titik tampak seperti garis lurus saat titik itu diperbesar, dan yang tidak, tidak demikian. ## Bagaimana menghitung turunan di suatu titik dalam kode? **Dalam kode, taksir turunan dengan hasil bagi selisih dan langkah kecil, sebaiknya selisih terpusat $\frac{f(a+h)-f(a-h)}{2h}$ dengan $h$ sekitar $10^{-5}$; untuk polinomial dengan pecahan eksak kamu dapat memperoleh gradien eksak tanpa limit dan tanpa pembulatan.** Hasil bagi maju $\frac{f(a+h)-f(a)}{h}$ memiliki galat yang mengecil sebanding dengan $h$; yang terpusat memiliki galat sebanding dengan $h^2$, karena kedua galat orde pertama saling meniadakan. Namun jangan mengecilkan $h$ sejauh mungkin. Komputer menyimpan tiap nilai dengan galat pembulatan relatif sekitar $10^{-16}$, dan mengurangkan dua bilangan yang hampir sama mempertahankan galat mutlak itu sementara pembagian dengan $h$ yang sangat kecil memperbesarnya. Percobaan di bawah menaksir turunan $\sin$ di $1$, yang nilai sebenarnya $\cos 1=0{,}5403023058681398$: galat turun saat $h$ turun, mencapai dasar (dekat $10^{-8}$ untuk hasil bagi maju dan dekat $10^{-5}$ untuk yang terpusat), lalu naik lagi. Pada $h=10^{-14}$ keduanya salah di angka ketiga. ```python import math def forward(f, a, h): return (f(a + h) - f(a)) / h # error shrinks like h def central(f, a, h): return (f(a + h) - f(a - h)) / (2 * h) # error shrinks like h squared a, true = 1.0, math.cos(1.0) # the derivative of sin at 1 is cos(1) for k in (1, 3, 5, 8, 11, 14): h = 10.0 ** -k print(f"h=1e-{k:<2} forward {abs(forward(math.sin, a, h) - true):.1e} central {abs(central(math.sin, a, h) - true):.1e}") # h=1e-1 forward 4.3e-02 central 9.0e-04 # h=1e-3 forward 4.2e-04 central 9.0e-08 # h=1e-5 forward 4.2e-06 central 1.1e-11 # h=1e-8 forward 3.0e-09 central 2.6e-09 # h=1e-11 forward 1.2e-06 central 1.2e-06 # h=1e-14 forward 3.7e-03 central 3.7e-03 ``` **Untuk polinomial tidak perlu menaksir sama sekali.** Menulis $f(a+h)$ sebagai polinomial dalam $h$ (sebuah pergeseran peubah, dikerjakan dengan pembagian sintetis berulang) memberi $f(a)+f'(a)\,h+\cdots$, sehingga koefisien $h$ tepat sama dengan gradien, sebagai pecahan, dengan limit yang sudah diambil. Kode di bawah melakukannya dengan `Fraction` dan mengulang hitungan tangan $f'(2)=9$ untuk $x^3-3x$; daftarnya adalah polinomial $f(2+h)=2+9h+6h^2+h^3$, sehingga hasil bagi selisihnya $9+6h+h^2$, seperti tadi. Gagasan yang sama dipakai sistem aljabar komputer seperti SymPy ketika menurunkan secara simbolik. ```python from fractions import Fraction def shift(coeffs, a): """Coefficients of f(a + h) for f = c0 + c1 x + c2 x^2 + ..., by repeated synthetic division.""" out, cur = [], list(coeffs) while cur: carry, rest = Fraction(0), [] for c in reversed(cur): carry = c + carry * a rest.append(carry) out.append(rest.pop()) # the remainder is the next coefficient cur = rest[::-1] return out f = [0, -3, 0, 1] # x^3 - 3x print(shift(f, Fraction(2))) # [Fraction(2, 1), Fraction(9, 1), Fraction(6, 1), Fraction(1, 1)] print(shift(f, Fraction(2))[1]) # 9, the slope at 2 print(shift([Fraction(4), 0, Fraction(1, 2)], Fraction(6))[1]) # 6, the slope of x^2/2 + 4 at 6 ``` ```cpp #include #include #include using namespace std; // the slope at a of c[0] + c[1] x + c[2] x^2 + ..., exactly, by Horner's rule on the polynomial and its derivative double slope(const double c[], int n, double a) { double p = 0, dp = 0; for (int i = n - 1; i >= 0; i--) { dp = dp * a + p; p = p * a + c[i]; } return dp; } int main() { double a = 1.0, truth = cos(1.0); // the derivative of sin at 1 is cos(1) for (int k = 1; k <= 4; k++) { double h = pow(10, -k); double forward = (sin(a + h) - sin(a)) / h; // the error shrinks like h double central = (sin(a + h) - sin(a - h)) / (2 * h); // the error shrinks like h squared printf("h=1e-%d forward %.1e central %.1e\n", k, fabs(forward - truth), fabs(central - truth)); } // for much smaller h, rounding errors take over and both errors grow again double f[4] = {0, -3, 0, 1}; // x^3 - 3x printf("%.0f\n", slope(f, 4, 2)); // 9, the slope at 2 double g[3] = {4, 0, 0.5}; // x^2 / 2 + 4 printf("%.0f\n", slope(g, 3, 6)); // 6, the slope at 6 return 0; } /* output: h=1e-1 forward 4.3e-02 central 9.0e-04 h=1e-2 forward 4.2e-03 central 9.0e-06 h=1e-3 forward 4.2e-04 central 9.0e-08 h=1e-4 forward 4.2e-05 central 9.0e-10 9 6 */ ``` ## Siapa yang menemukan garis singgung dan turunan? **Tidak ada satu orang pun: garis singgung sudah kuno, mencarinya dengan aljabar dimulai pada 1630-an, Newton dan Leibniz membangun kalkulus di atasnya pada 1660-an sampai 1680-an, dan definisi limit yang dipakai sekarang berasal dari 1820-an.** - **Zaman kuno.** Euclid (sekitar 300 SM) membuktikan sifat-sifat garis singgung lingkaran dalam Buku III Elements, dan Apollonius (sekitar 200 SM) serta Archimedes menemukan garis singgung kerucut dan spiral dengan argumen geometris khusus, satu kurva demi satu kurva. - **1630-an.** Pierre de Fermat (sekitar 1636) memiliki metode yang membandingkan $f(x+e)$ dengan $f(x)$, membaginya dengan $e$, lalu menjadikan $e$ nol; metode itu menemukan garis singgung dan nilai maksimum dan merupakan bentuk pertama hasil bagi selisih. René Descartes (La Géométrie, 1637) menemukan garis normal pada kurva dengan menanyakan kapan lingkaran berpusat di sumbu memotong kurva di titik ganda, gagasan akar ganda yang sama dengan ciri garis singgung di atas. - **1670-an dan 1680-an.** Isaac Barrow menggambar "segitiga diferensial" kecil pada kurva untuk mencari garis singgung. Isaac Newton (catatan 1665 sampai 1666) memandang besaran yang berubah sebagai besaran yang mengalir dengan laju, yaitu fluksi, dan Gottfried Leibniz (terbit 1684) menulis laju itu sebagai perbandingan $\frac{dy}{dx}$ dari selisih-selisih kecil, notasi yang masih dipakai. Keduanya berselisih sengit soal siapa yang lebih dulu. Joseph-Louis Lagrange memperkenalkan notasi aksen $f'(x)$ pada 1797. - **1820-an.** Augustin-Louis Cauchy mendefinisikan turunan sebagai limit hasil bagi selisih dalam kuliahnya di École Polytechnique (1823), mengubah sebuah metode menjadi definisi. Saat itu pun orang masih percaya bahwa fungsi kontinu pasti terdiferensialkan hampir di mana-mana, dan André-Marie Ampère mencoba membuktikannya pada 1806. - **Contoh tandingan.** Bernard Bolzano (sekitar 1830) dan Karl Weierstrass (diperlihatkan pada 1872) membuat fungsi kontinu yang tidak memiliki turunan di titik mana pun, sehingga tanpa garis singgung di mana pun, yang menunjukkan betapa jauhnya kekontinuan dari keterdiferensialan. ## Kesalahan apa yang sering terjadi pada garis singgung dan turunan? **Kesalahan paling umum pada garis singgung dan turunan di suatu titik adalah sembilan hal berikut, masing-masing dengan pernyataan yang benar.** | Kesalahan | Yang benar | |---|---| | ❌ Garis singgung menyentuh kurva di tepat satu titik | Garis singgung dapat bertemu kurva lagi ($y=-2$ bertemu $y=x^3-3x$ di $x=-2$) dan dapat memotongnya di titik belok. Ia menyatakan arah di titik itu. | | ❌ Garis yang bertemu kurva satu kali adalah garis singgung | Garis tegak $x=1$ bertemu $y=x^2$ sekali dan bukan garis singgung; garis singgung di $(1,1)$ adalah $y=2x-1$. | | ❌ Satu garis potong dengan $h$ kecil, seperti $h=0{,}1$, memberi gradiennya | Setiap garis potong memberi laju rata-rata; gradien adalah limit saat $h\to0$. Untuk $x^2$ di $1$ garis potong dengan $h=0{,}1$ bergradien $2{,}1$, bukan $2$. | | ❌ Masukkan $h=0$ ke hasil bagi, dapat $\frac00$, jadi tidak ada turunan | $\frac00$ tak tentu, bukan vonis. Sederhanakan dulu, baru biarkan $h\to0$: $\frac{2h+h^2}{h}=2+h\to2$. | | ❌ $f'(a)$ adalah turunan bilangan $f(a)$, sehingga nilainya $0$ | $f'(a)$ berarti turunan fungsi $f$, dihitung di $a$. Limit diambil sebelum titiknya dimasukkan. | | ❌ Garis singgungnya $y=f'(a)(x-a)$ | Tambahkan tingginya: $y=f(a)+f'(a)(x-a)$, supaya garisnya melalui $(a,f(a))$. | | ❌ Garis normal bergradien $-f'(a)$ | Gradiennya kebalikan negatif, $-\frac{1}{f'(a)}$: hasil kali gradien dua garis yang saling tegak lurus adalah $-1$. | | ❌ Grafik tanpa celah memiliki turunan di mana-mana | Kontinu belum cukup: grafik $y$ sama dengan nilai mutlak $x$ tidak punya celah dan tidak punya turunan di $0$. | | ❌ $f'(a)=0$ berarti $a$ adalah maksimum atau minimum | Itu hanya berarti garis singgung mendatar: $x^3$ bergradien $0$ di $0$ dan sedang naik di sana. | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: garis singgung dan turunan di suatu titik sekilas - **Garis potong:** garis melalui $(a,f(a))$ dan $(a+h,f(a+h))$; gradien $\frac{f(a+h)-f(a)}{h}$, laju perubahan rata-rata. - **Turunan di suatu titik:** $f'(a)=\lim_{h\to0}\frac{f(a+h)-f(a)}{h}=\lim_{x\to a}\frac{f(x)-f(a)}{x-a}$, sebuah bilangan: gradien garis singgung dan laju sesaat. - **Garis singgung:** $y=f(a)+f'(a)(x-a)$; **garis normal:** gradien $-\frac{1}{f'(a)}$, atau garis tegak $x=a$ bila garis singgungnya mendatar. - **Fakta garis singgung:** ia dapat bertemu kurva lagi dan dapat memotongnya di titik belok; untuk polinomial, $f(x)$ dikurangi garis singgung memiliki akar ganda di $a$. - **Arti:** satuan $y$ per satuan $x$; $f'(a)>0$ naik, $<0$ turun, $=0$ mendatar. - **Tanpa turunan:** sudut tajam, cusp, lompatan, garis singgung tegak, atau osilasi tanpa henti; terdiferensialkan berarti kontinu, dan tidak sebaliknya. - **Kode:** selisih terpusat dengan $h\approx10^{-5}$; gradien eksak polinomial dari pergeseran $f(a+h)$. ## Glosarium: istilah penting - **Garis singgung**: Garis lurus yang melalui suatu titik pada kurva dan searah dengan kurva di sana; gradiennya adalah turunan fungsi di titik itu. - **Garis potong**: Garis lurus yang melalui dua titik pada kurva; gradiennya adalah laju perubahan rata-rata fungsi di antara kedua titik itu. - **Hasil bagi selisih**: Perubahan fungsi dibagi perubahan masukannya, f dari a ditambah h dikurangi f dari a, seluruhnya dibagi h; ia adalah gradien garis potong. - **Turunan di suatu titik**: Limit hasil bagi selisih saat h mendekati nol, bila ada; ia adalah gradien garis singgung dan laju perubahan sesaat di titik itu. - **Laju perubahan sesaat**: Seberapa cepat suatu besaran berubah pada satu saat yang tepat, ditemukan sebagai limit laju perubahan rata-rata pada selang yang makin pendek. - **Fungsi terdiferensialkan**: Fungsi yang memiliki turunan di titik tertentu, atau di setiap titik pada suatu selang; fungsi seperti itu kontinu di sana dan tampak seperti garis lurus saat diperbesar. - **Garis normal**: Garis yang melalui suatu titik pada kurva dan tegak lurus terhadap garis singgung di sana; gradiennya kebalikan negatif dari turunan bila turunannya bukan nol. - **Turunan sepihak**: Limit hasil bagi selisih yang diambil hanya dari kanan atau hanya dari kiri; fungsi terdiferensialkan di suatu titik tepat bila keduanya ada dan sama. - **Sudut tajam**: Titik tempat grafik kontinu berubah arah secara tiba-tiba, sehingga gradien garis potong dari kiri dan dari kanan menuju bilangan yang berbeda dan tidak ada garis singgung. - **Garis singgung tegak**: Garis singgung yang berupa garis tegak melalui titik itu, yang terjadi bila hasil bagi selisih membesar tanpa batas; fungsi tidak memiliki turunan di sana, karena garis tegak tidak punya gradien. ## Pertanyaan yang sering diajukan ### Apa itu garis singgung pada kurva? Garis singgung pada kurva di suatu titik adalah garis lurus melalui titik itu yang searah dengan kurva di sana. Gradiennya adalah limit gradien garis potong melalui titik tersebut. Ia dapat bertemu kurva di tempat lain, sehingga menyentuh sekali bukan definisinya. ### Apa itu turunan di suatu titik? Turunan f di a adalah limit f dari a ditambah h dikurangi f dari a, dibagi h, saat h mendekati nol, bila limit itu ada. Ia adalah gradien garis singgung di a dan laju perubahan sesaat f di sana. ### Apa beda garis potong dan garis singgung? Garis potong melalui dua titik pada kurva dan bergradien laju perubahan rata-rata di antara keduanya. Garis singgung bergradien laju perubahan sesaat di satu titik, dan ia adalah limit garis potong saat titik kedua mendekati titik pertama. ### Bagaimana mencari persamaan garis singgung? Cari tinggi f dari a dan gradien f aksen dari a dari definisi limit, lalu tulis y sama dengan f dari a ditambah f aksen dari a kali x dikurangi a. Untuk y sama dengan x kuadrat di x sama dengan 1 tingginya 1, gradiennya 2, dan garisnya y sama dengan 2x dikurangi 1. ### Apa arti turunan di suatu titik? Ia adalah laju perubahan sesaat fungsi di titik itu, dalam satuan keluaran per satuan masukan. Untuk jarak terhadap waktu ia adalah kecepatan pada saat itu, dan untuk biaya terhadap jumlah ia adalah biaya marjinal. Secara geometris ia adalah gradien grafik. ### Dapatkah garis singgung memotong kurva? Ya. Garis singgung hanya menyatakan arah kurva di titik itu. Di titik belok seperti x sama dengan 0 pada y sama dengan x pangkat tiga garis singgung memotong kurva, dan garis singgung juga dapat bertemu kurva lagi di tempat lain, seperti y sama dengan min 2 pada x pangkat tiga dikurangi 3x. ### Kapan fungsi tidak terdiferensialkan di suatu titik? Fungsi tidak terdiferensialkan di tempat limit hasil bagi selisih tidak ada: pada sudut tajam seperti nilai mutlak x di 0, pada cusp, pada lompatan, pada garis singgung tegak, atau tempat ia berosilasi tanpa menetap. Ia juga harus kontinu di sana. ### Apakah setiap fungsi kontinu terdiferensialkan? Tidak. Fungsi yang terdiferensialkan selalu kontinu, tetapi fungsi kontinu belum tentu terdiferensialkan. Nilai mutlak x kontinu di mana-mana dan memiliki sudut tajam di 0, dan Weierstrass membuat fungsi kontinu yang tidak memiliki turunan di titik mana pun. ### Apa itu garis normal pada kurva? Garis normal di suatu titik pada kurva adalah garis melalui titik itu yang tegak lurus terhadap garis singgung. Bila garis singgung bergradien m yang bukan nol, garis normal bergradien min 1 per m, dan bila garis singgung mendatar, garis normal tegak. --- # The Pythagorean Theorem: Proofs, Triples and Applications Source: https://nunada.my.id/articles/pythagorean-theorem/ Updated: 2026-11-01 ## Quick answer **The Pythagorean theorem says that in a right triangle the square of the hypotenuse equals the sum of the squares of the two legs: $a^2+b^2=c^2$.** In pictures, the square built on the longest side has the same area as the two squares on the other sides together. It gives a missing side as $c=\sqrt{a^2+b^2}$, shows that three sides form a right angle exactly when $a^2+b^2=c^2$, and, with whole numbers such as $3,4,5$, produces the Pythagorean triples. ### Key takeaways - In a right triangle with legs $a,b$ and hypotenuse $c$: $a^2+b^2=c^2$; the missing hypotenuse is $\sqrt{a^2+b^2}$ and a missing leg is $\sqrt{c^2-a^2}$, with a subtraction under the root. - The theorem can be proved by rearranging areas, by similar triangles, by shearing squares (Euclid) or by the area of a trapezoid (Garfield); each takes only a few lines. - The converse is true: if $a^2+b^2=c^2$ the angle opposite $c$ is a right angle, which is the idea behind squaring a corner with a $3$–$4$–$5$ rope. - Euclid's formula $(m^2-n^2,\;2mn,\;m^2+n^2)$ builds every primitive triple; they grow in a tree from $(3,4,5)$, and one leg is always a multiple of 3, one of 4 and one number of 5. - The distance between two points is $\sqrt{\Delta x^2+\Delta y^2}$, and the diagonal of a box is $\sqrt{l^2+w^2+h^2}$: the theorem used once in the plane and twice in space. - Generalizations: the law of cosines for any triangle, areas of similar shapes on the sides, the distance formula in any dimension, and Fermat's Last Theorem for higher powers. ## What is the Pythagorean theorem? **In a right triangle with legs $a$ and $b$ and hypotenuse $c$, the Pythagorean theorem states that $a^2+b^2=c^2$.** The legs are the two sides that meet at the right angle; the hypotenuse is the side opposite it, which is always the longest (see [right triangles](https://nunada.my.id/articles/triangles/#right-triangles)). The equation is about area. The square built on the hypotenuse has exactly the same area as the two squares built on the legs added together, which is the picture in the tool below. The name honors Pythagoras of Samos (about 570–495 BCE), but the relation was known in Babylonia, India and China long before him; the history is at the end. Two things follow at once: - **A missing hypotenuse:** $c=\sqrt{a^2+b^2}$. For legs $3$ and $4$ it is $\sqrt{9+16}=5$. For two legs of $1$ it is $\sqrt2$, which is [irrational](https://nunada.my.id/articles/irrational-numbers/#why-sqrt2-is-irrational), and for legs $6$ and $4$ it is $\sqrt{52}=2\sqrt{13}$ once you [simplify the radical](https://nunada.my.id/articles/exponents-and-radicals/#simplify-radicals). - **A missing leg:** $b=\sqrt{c^2-a^2}$, with a subtraction under the root, because the hypotenuse is the big one. For $c=13$ and $a=5$ it is $\sqrt{169-25}=12$. Keep every length in the same unit, and keep the square root as a root, or in simplified form, until the final step. The theorem needs a right angle: for other triangles see the law of cosines in the section on generalizations below. Try it: give two sides and get the third, exactly, with a square drawn on every side. ## How do you prove the Pythagorean theorem? **There are hundreds of proofs, and four of the clearest rearrange areas, use similar triangles, shear squares into rectangles, or add up a trapezoid; each takes only a few lines.** Here they are, starting with the one in the tool below. **1. Rearranging four triangles.** Take four copies of the right triangle, each of area $\frac12ab$, and fit them inside a square of side $a+b$. Two arrangements are possible. In the first, the triangles leave a tilted square of side $c$ in the middle. In the second, the same triangles leave two squares, one of side $a$ and one of side $b$. The big square has the same area both times, and so do the four triangles, so what is left over must be equal: $$c^2=(a+b)^2-4\cdot\tfrac12ab=a^2+b^2.$$ This is the diagram of the Chinese Zhoubi Suanjing. Slide $a$ and $b$ and switch the arrangement below. *The altitude from the right angle C to the hypotenuse AB splits the triangle into two smaller triangles that are similar to the whole one, and splits the hypotenuse into two parts p and q.* **2. Similar triangles.** Draw the altitude from the right angle to the hypotenuse. It cuts the hypotenuse $c$ into two pieces $p$ and $q$ with $p+q=c$, and cuts the triangle into two smaller ones, each similar to the whole by AA, as in [similar triangles](https://nunada.my.id/articles/triangles/#congruence-similarity). Comparing the ratios of corresponding sides gives $\frac{a}{c}=\frac{p}{a}$ and $\frac{b}{c}=\frac{q}{b}$, that is, $a^2=cp$ and $b^2=cq$. Add them: $$a^2+b^2=c(p+q)=c\cdot c=c^2.$$ **3. Euclid's proof (Elements I.47).** The same two equations say that if the altitude is extended through the square on the hypotenuse, it splits that square into two rectangles, one of area $cp=a^2$ and one of area $cq=b^2$. Euclid showed this without ratios, by shearing: a square and a rectangle on the same base and between the same parallels, cut in half by a diagonal, give triangles of equal area, so each square on a leg equals one rectangle of the big square. **4. Garfield's trapezoid (1876).** Put two copies of the right triangle side by side so that the hypotenuses form a right angle; with a third right triangle of legs $c$ and $c$ in between, the figure is a trapezoid with parallel sides $a$ and $b$ and height $a+b$. Its area is $\frac12(a+b)(a+b)$, and also the sum of the three triangles, $\frac12ab+\frac12ab+\frac12c^2$. So $\frac12(a+b)^2=ab+\frac12c^2$, which becomes $a^2+2ab+b^2=2ab+c^2$ and again $a^2+b^2=c^2$. James Garfield found it while he was a member of the US House of Representatives, and he became the 20th president five years later. A collection by Elisha Loomis, in its 1940 edition, gathers about 370 proofs of the theorem. ## How do you use the converse to check for a right angle? **If the three sides of a triangle satisfy $a^2+b^2=c^2$, the angle opposite $c$ is a right angle; this converse is how builders square a corner with a $3$–$4$–$5$ rope.** **Why the converse is true.** Suppose a triangle has sides $a$, $b$, $c$ with $a^2+b^2=c^2$. Build a right triangle with legs $a$ and $b$. By the theorem its hypotenuse is $\sqrt{a^2+b^2}=c$, so it has the same three sides as the given triangle. Two triangles with three equal sides are congruent (SSS), so the given triangle has a right angle too. Euclid proves it as proposition I.48, the last of Book I. **The 3–4–5 rope.** Tie a loop of rope with $12$ equal spaces marked by knots. Hold the knots $3$ apart and $4$ apart and pull the loop tight into a triangle: the sides are $3$, $4$ and $5$, and $9+16=25$, so the corner between the sides $3$ and $4$ is exactly square. Surveyors and builders have done this for thousands of years. Any multiple works equally well, such as $6$–$8$–$10$ for a large room. **The diagonal check.** A frame $2.4$ m by $1.8$ m is a rectangle only if its diagonals are $3.0$ m, because $1.8^2+2.4^2=3.24+5.76=9.00=3.0^2$. If a diagonal is longer or shorter, the frame is leaning. **What if the test fails?** Then the angle is not a right angle, and the size of $c^2$ against $a^2+b^2$ tells which way it goes: a larger $c^2$ means an obtuse angle, a smaller one an acute angle, as set out under the [types of triangles](https://nunada.my.id/articles/triangles/#types). The sides $5$, $7$, $9$ give $25+49=74<81$, so the biggest angle is obtuse. ## What are Pythagorean triples and how do you find them? **A Pythagorean triple is a set of three positive whole numbers $a,b,c$ with $a^2+b^2=c^2$, and Euclid's formula $(m^2-n^2,\;2mn,\;m^2+n^2)$ produces every primitive one.** The triple $(3,4,5)$ is the smallest; $(5,12,13)$ and $(8,15,17)$ follow. A multiple of a triple is a triple ($(6,8,10)$ is twice $(3,4,5)$), so the interesting ones are the primitive triples, with no common factor, as in the [greatest common divisor](https://nunada.my.id/articles/integers/#gcd-lcm). **Euclid's formula.** For whole numbers $m>n>0$ the triple $(m^2-n^2,\,2mn,\,m^2+n^2)$ works, because $(m^2-n^2)^2+(2mn)^2=m^4-2m^2n^2+n^4+4m^2n^2=(m^2+n^2)^2$. It is primitive exactly when $m$ and $n$ are coprime and one of them is even, and then it gives every primitive triple once. | $m$ | $n$ | Primitive triple | |---|---|---| | $2$ | $1$ | $3,4,5$ | | $3$ | $2$ | $5,12,13$ | | $4$ | $1$ | $8,15,17$ | | $4$ | $3$ | $7,24,25$ | | $5$ | $2$ | $20,21,29$ | | $5$ | $4$ | $9,40,41$ | | $6$ | $1$ | $12,35,37$ | | $7$ | $2$ | $28,45,53$ | There are $16$ primitive triples with hypotenuse at most $100$, and $52$ triples in all once the multiples are counted. **Patterns in every triple.** In a primitive triple exactly one leg is even and the hypotenuse is odd. Among $a,b,c$ one leg is a multiple of $3$, one leg is a multiple of $4$, and one of the three numbers is a multiple of $5$, so $abc$ is always divisible by $60$ (see [divisibility](https://nunada.my.id/articles/integers/#divisibility)). The area $\frac12ab$ is always a whole number. **All triangles with a given leg.** Write $a^2=c^2-b^2=(c-b)(c+b)$ and list the ways to factor $a^2$ into two numbers of the same parity. For $a=12$, $a^2=144=2\cdot72=4\cdot36=6\cdot24=8\cdot18$, giving $(c,b)=(37,35),(20,16),(15,9),(13,5)$: four right triangles with a leg of $12$. Explore the lists below, then walk the tree. **The tree of primitive triples.** In 1934 the Swedish mathematician Berggren found that all primitive triples fit in one tree. The root is $(3,4,5)$ and every triple has exactly three children, found with three fixed linear rules, so each primitive triple appears exactly once. With the odd leg first, $(3,4,5)$ has the children $(5,12,13)$, $(21,20,29)$ and $(15,8,17)$. The triples are not just curiosities: $\left(\frac35,\frac45\right)$ is a point of the unit circle because $3^2+4^2=5^2$, and every triple gives such a point, as in the [equation of a circle](https://nunada.my.id/articles/circles/#equation). ## How does the theorem give distances and diagonals? **The distance between two points is the hypotenuse of a right triangle whose legs are the horizontal and the vertical differences, so $d=\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}$; one more use of the theorem gives the diagonal of a box in space.** **In the plane.** From $(1,2)$ to $(7,10)$ the legs are $6$ and $8$, so the distance is $\sqrt{36+64}=10$. Comparing squared distances needs no square root at all, which is how the [quadrilateral tests](https://nunada.my.id/articles/quadrilaterals/#coordinates) check equal sides, and the equation $(x-h)^2+(y-k)^2=r^2$ of a [circle](https://nunada.my.id/articles/circles/#equation) is the distance formula saying "the distance to the center is $r$". **In space.** Use the theorem twice. The diagonal of the floor of a box $l\times w$ is $\sqrt{l^2+w^2}$, and this diagonal and the height $h$ are the legs of a second right triangle whose hypotenuse is the diagonal of the box: $$d=\sqrt{l^2+w^2+h^2}.$$ A box $2\times3\times6$ has diagonal $\sqrt{4+9+36}=7$, and the longest rod that fits in a box $3\times4\times12$ is $\sqrt{9+16+144}=13$. A unit cube has diagonal $\sqrt3$ (more in [the cube](https://nunada.my.id/articles/cube/#diagonals) and [the cuboid](https://nunada.my.id/articles/cuboid/#diagonals-and-angles)). The same pattern, a sum of squared differences under a root, gives the distance in any number of dimensions. **Everyday uses.** - **A ladder** $5$ m long with its foot $1.4$ m from the wall reaches $\sqrt{25-1.96}=4.8$ m up the wall. - **A shortcut** across a field $60$ m by $80$ m is $100$ m, against $140$ m along the edges. - **A screen size** is its diagonal. A 55-inch screen with the shape $16:9$ has width and height proportional to $16$ and $9$, and $\sqrt{16^2+9^2}=\sqrt{337}$, so it is about $47.9$ in wide and $27.0$ in high, since $\frac{55\cdot16}{\sqrt{337}}\approx47.9$ and $\frac{55\cdot9}{\sqrt{337}}\approx27.0$. - **A paved diagonal path** across a rectangular garden $30$ m by $40$ m is $50$ m long; at 20 dollars per meter it costs 1,000 dollars. ## Can the Pythagorean theorem be generalized? **Yes: the law of cosines extends it to every triangle, any similar shapes drawn on the three sides have areas that add up in the same way, the distance formula carries it into any dimension, and for powers above two the equation has no whole-number solutions at all.** - **The [law of cosines](https://nunada.my.id/articles/law-of-cosines/#what-it-says).** For any triangle, $c^2=a^2+b^2-2ab\cos C$. At a right angle $\cos C=0$ and the correction vanishes, which is the Pythagorean theorem; for an acute angle the correction subtracts, for an obtuse angle it adds. See [solving a triangle](https://nunada.my.id/articles/triangles/#solve-a-triangle). - **Other shapes on the sides.** Area grows with the square of length, so any similar figures built on the three sides satisfy $A_a+A_b=A_c$: semicircles, equilateral triangles, even copies of your favorite drawing. With semicircles, Hippocrates of Chios (5th century BCE) drew the two crescents (lunes) outside the hypotenuse's semicircle and showed that, for a right triangle, the two lunes together have exactly the area of the triangle. - **Vectors and higher dimensions.** If two vectors are perpendicular, $|u+v|^2=|u|^2+|v|^2$; this is the theorem for the triangle they span, and the distance in any number of dimensions is built from it. - **A curved surface.** On a sphere of radius $1$, a triangle with a right angle satisfies $\cos c=\cos a\cos b$ instead, with the sides measured along the surface. The plain theorem needs a flat plane. - **Higher powers.** The equation $x^2+y^2=z^2$ has infinitely many whole-number solutions, the triples above. For $x^n+y^n=z^n$ with $n\ge3$ there are none in positive whole numbers. Pierre de Fermat wrote this in a margin around 1637, saying that he had a proof too long for the margin; the first proof was found by Andrew Wiles, with a gap closed by Richard Taylor, in 1995. This is Fermat's Last Theorem. ## How do you use the Pythagorean theorem in code? **Use `math.hypot` for lengths, and integers with `math.isqrt` for exact tests.** The square root of a float is rounded, so a right angle is best tested with whole numbers, and a huge or tiny length is best computed with `hypot`, which cannot overflow. ```python from math import hypot, dist, isqrt, sqrt, gcd def is_triple(a, b, c): return a * a + b * b == c * c # exact for whole numbers def hyp_exact(a, b): # (isqrt, True) when the hypotenuse is whole s = a * a + b * b c = isqrt(s) return c, c * c == s def primitive_triples(limit): # Euclid's formula out = [] m = 2 while m * m + 1 <= limit: for n in range(1, m): if (m - n) % 2 and gcd(m, n) == 1 and m * m + n * n <= limit: a, b = sorted((m * m - n * n, 2 * m * n)) out.append((a, b, m * m + n * n)) m += 1 return sorted(out, key=lambda t: t[2]) >>> is_triple(5, 12, 13), is_triple(4, 5, 6) (True, False) >>> hyp_exact(8, 15), hyp_exact(1, 1) ((17, True), (1, False)) >>> primitive_triples(30) [(3, 4, 5), (5, 12, 13), (8, 15, 17), (7, 24, 25), (20, 21, 29)] >>> len(primitive_triples(100)) 16 >>> hypot(3, 4), dist((1, 2), (7, 10)), hypot(2, 3, 6) # 2D, between points, 3D (5.0, 10.0, 7.0) >>> sqrt(1.2 ** 2 + 3.5 ** 2) == 3.7 # should be True: 1.2, 3.5, 3.7 is a triple False >>> hypot(1.2, 3.5) == 3.7 True >>> sqrt(1e200 ** 2 + 1e200 ** 2) # squaring overflows OverflowError: (34, 'Result too large') >>> hypot(1e200, 1e200) 1.414213562373095e+200 ``` ```javascript Math.hypot(3, 4) // 5 Math.hypot(1, 2, 2) // 3: the diagonal of a 1 by 2 by 2 box const isTriple = (a, b, c) => a * a + b * b === c * c // exact for whole numbers isTriple(20, 21, 29) // true Math.sqrt(1.2 ** 2 + 3.5 ** 2) === 3.7 // false: the float sum rounds, as in Python ``` ```cpp #include #include #include using namespace std; bool isTriple(int a, int b, int c) { return a * a + b * b == c * c; } // exact for whole numbers int isqrt(int n) { int r = 0; while ((r + 1) * (r + 1) <= n) r++; return r; } int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); } int main() { cout << isTriple(5, 12, 13) << " " << isTriple(4, 5, 6) << endl; // 1 0 int s = 8 * 8 + 15 * 15, c = isqrt(s); cout << c << " " << (c * c == s) << endl; // 17 1: the hypotenuse is whole for (int h = 1; h <= 30; h++) // primitive triples up to 30 for (int a = 1; a < h; a++) for (int b = a + 1; b < h; b++) if (isTriple(a, b, h) && gcd(a, b) == 1) cout << "(" << a << "," << b << "," << h << ") "; cout << endl; int count = 0; // Euclid's formula up to 100 for (int m = 2; m * m + 1 <= 100; m++) for (int n = 1; n < m; n++) if ((m - n) % 2 == 1 && gcd(m, n) == 1 && m * m + n * n <= 100) count++; cout << count << endl; printf("%.1f %.1f\n", sqrt(3.0 * 3 + 4 * 4), sqrt(2.0 * 2 + 3 * 3 + 6 * 6)); // 2D and 3D lengths cout << (sqrt(1.2 * 1.2 + 3.5 * 3.5) == 3.7) << endl; // 0: the float sum rounds double big = 1e200; cout << (big * big > 1e308) << endl; // 1: squaring overflows to inf return 0; } /* output: 1 0 17 1 (3,4,5) (5,12,13) (8,15,17) (7,24,25) (20,21,29) 16 5.0 7.0 0 1 */ ``` The pitfalls, in order of how often they bite: | Pitfall | What happens | What to do | |---|---|---| | Testing a right angle with a float root | `sqrt(1.2**2 + 3.5**2) == 3.7` is false | compare whole numbers `aa + bb == c*c`, use `Fraction` as in [real numbers in code](https://nunada.my.id/articles/real-numbers/#real-numbers-in-code), or `math.isclose` | | Squaring a huge or tiny length | `1e200 ** 2` overflows, `1e-200 ** 2` becomes 0 | use `math.hypot` | | `int(sqrt(n))` for a big whole number | the float root loses digits and the integer is off by one | use `math.isqrt` | | `^` for a square | it is XOR, not a power | use `**` or multiply | | Squaring a sum | `(a + b) ** 2` is not `a**2 + b**2` | expand it: `aa + 2ab + bb` | | Mixed units | 3 ft and 40 in give nonsense | convert to one unit first | ## Who discovered the Pythagorean theorem? **No single person discovered it: the relation was used in Babylonia, India and China long before Pythagoras, and the first proofs we can read come from Euclid.** - **c. 1800 BCE.** The Babylonian clay tablet Plimpton 322 lists what appear to be Pythagorean triples, such as $(119,120,169)$, so the relation was in use a thousand years before Greek geometry. - **c. 800–500 BCE.** The Indian Sulba Sutras, rules for building altars, state that the rope along the diagonal of a rectangle produces the area of the squares on both sides together. - **c. 570–495 BCE.** Pythagoras of Samos, in southern Italy, founded the school that bears his name. Nothing he wrote survives, and the credit for the theorem comes from writers centuries later. - **Before the 1st century BCE.** The Chinese Zhoubi Suanjing explains the $3$–$4$–$5$ triangle and a diagram with a tilted square, the gougu (leg-and-leg) theorem. - **c. 300 BCE.** Euclid's Elements proves the theorem as I.47 and its converse as I.48. - **12th century.** Bhaskara II draws the rearrangement diagram with the single word "Behold!". - **1876.** Garfield's trapezoid proof appears in print. - **1995.** Wiles proves Fermat's Last Theorem, the answer to the question of whether the Pythagorean equation works with exponent three or more. A popular story says that the Greeks were shaken by the discovery that the diagonal of a square is not a ratio of whole numbers, the first irrational number, which the theorem makes unavoidable: see the [proof that the square root of 2 is irrational](https://nunada.my.id/articles/irrational-numbers/#why-sqrt2-is-irrational). ## What mistakes do people make with the Pythagorean theorem? **The most common mistakes with the theorem are the nine below, each with the correct statement.** | Mistake | Correct | |---|---| | ❌ $(a+b)^2=a^2+b^2$ | $(a+b)^2=a^2+2ab+b^2$; the missing $2ab$ is exactly what the proof by rearranging accounts for. | | ❌ $c=a+b$ | $c=\sqrt{a^2+b^2}$ is shorter than $a+b$: the hypotenuse is a shortcut. | | ❌ $c^2=25$, so $c=25$ | Take the square root: $c=5$. | | ❌ A missing leg is $\sqrt{c^2+a^2}$ | Subtract: $b=\sqrt{c^2-a^2}$. | | ❌ $\sqrt{a^2+b^2}=\sqrt{a^2}+\sqrt{b^2}$ | A root of a sum is not the sum of the roots: $\sqrt{9+16}=5$, but $\sqrt9+\sqrt{16}=7$. | | ❌ Rounding early: $c^2=2$ so $c=1.41$ | $\sqrt2$ is irrational; keep $\sqrt2$ until the last step. | | ❌ Every right triangle has whole-number sides | Legs $1$ and $1$ give $\sqrt2$; whole-number sides are the special case of triples. | | ❌ The theorem tells whether a triangle looks right-angled | It only decides when the numbers match exactly; test with $a^2+b^2=c^2$, not by eye. | | ❌ Mixing units | Convert first: legs of $3$ ft and $40$ in need one common unit. | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: the Pythagorean theorem at a glance - **Statement:** right triangle with legs $a,b$ and hypotenuse $c$: $a^2+b^2=c^2$; $c=\sqrt{a^2+b^2}$, a leg is $\sqrt{c^2-a^2}$. - **Proofs:** rearranging four triangles in an $(a+b)$ square; similar triangles ($a^2=cp$, $b^2=cq$); Euclid's shearing; Garfield's trapezoid. - **Converse:** $a^2+b^2=c^2\Rightarrow$ right angle; the $3$–$4$–$5$ rope, the diagonal check. - **Triples:** $(m^2-n^2,2mn,m^2+n^2)$; primitive when $\gcd(m,n)=1$ and opposite parity; $60\mid abc$; Berggren tree from $(3,4,5)$. - **Distance:** $\sqrt{\Delta x^2+\Delta y^2}$; box diagonal $\sqrt{l^2+w^2+h^2}$. - **Generalizations:** law of cosines, similar shapes on the sides, any dimension, spheres ($\cos c=\cos a\cos b$), Fermat's Last Theorem. - **Code:** `math.hypot`, whole-number tests with `isqrt`, never float equality. ## Glossary: key terms - **Pythagorean theorem**: The rule that in a right triangle the square of the hypotenuse equals the sum of the squares of the two legs. - **Legs of a right triangle**: The two sides of a right triangle that meet at the right angle, as opposed to the hypotenuse. - **Converse of the Pythagorean theorem**: The statement that a triangle whose sides satisfy a squared plus b squared equals c squared has a right angle opposite the side c. - **Pythagorean triple**: Three positive whole numbers a, b and c with a squared plus b squared equal to c squared, such as 3, 4 and 5. - **Primitive Pythagorean triple**: A Pythagorean triple whose three numbers have no common factor greater than 1, so it is not a multiple of a smaller triple. - **Euclid's formula**: The rule that for whole numbers m greater than n the numbers m squared minus n squared, 2mn and m squared plus n squared form a Pythagorean triple. - **Berggren tree**: The tree that starts at the triple 3, 4, 5 and gives every primitive Pythagorean triple exactly once through three rules that produce three children. - **Distance formula**: The formula that gives the distance between two points as the square root of the sum of the squared coordinate differences, found with the Pythagorean theorem. - **Fermat's Last Theorem**: The theorem that x to the power n plus y to the power n equals z to the power n has no solution in positive whole numbers when n is greater than 2. ## Frequently asked questions ### What is the Pythagorean theorem? In a right triangle the square of the hypotenuse equals the sum of the squares of the two legs, written a squared plus b squared equals c squared. For legs 3 and 4 the hypotenuse is 5. It only holds for triangles with a right angle. ### What is the formula for the Pythagorean theorem? The formula is a squared plus b squared equals c squared, where c is the hypotenuse. The hypotenuse is the square root of a squared plus b squared, and a missing leg is the square root of c squared minus a squared. ### Who discovered the Pythagorean theorem? No single person did. Babylonian tablets from about 1800 BCE list triples, Indian and Chinese texts state the rule, and Euclid gave the first proofs that survive. It is named after Pythagoras of Samos, but nothing he wrote has survived. ### How do you prove the Pythagorean theorem? One proof puts four copies of the triangle inside a square of side a plus b. They leave either a tilted square of side c or two squares of sides a and b, so c squared equals a squared plus b squared. There are hundreds of other proofs. ### What is the converse of the Pythagorean theorem? If the sides of a triangle satisfy a squared plus b squared equals c squared, the angle opposite c is a right angle. It follows because a right triangle with legs a and b has the same three sides, so the two triangles are congruent. ### What is the 3-4-5 rule? It is a builder's method to make a right angle. Mark 3 units on one line and 4 units on the other from the corner; if the distance between the marks is exactly 5 units, the corner is square, because 3 squared plus 4 squared is 5 squared. ### What are Pythagorean triples? They are sets of three positive whole numbers a, b and c with a squared plus b squared equal to c squared, such as 3, 4, 5 and 5, 12, 13. A primitive triple has no common factor, and every other triple is a multiple of one. ### How do you generate Pythagorean triples? Use Euclid's formula: for whole numbers m greater than n, the numbers m squared minus n squared, 2mn and m squared plus n squared form a triple. With m 2 and n 1 it gives 3, 4, 5; with m 3 and n 2 it gives 5, 12, 13. ### How does the Pythagorean theorem give the distance formula? The segment between two points is the hypotenuse of a right triangle whose legs are the differences of the x and y coordinates. So the distance is the square root of the squared x difference plus the squared y difference. ### How do you find the diagonal of a box? Apply the theorem twice: the diagonal is the square root of length squared plus width squared plus height squared. A box 2 by 3 by 6 has a diagonal of the square root of 49, which is 7. ### Does the Pythagorean theorem work for triangles that are not right triangles? Not as stated. For any triangle use the law of cosines, c squared equals a squared plus b squared minus 2ab times the cosine of the angle between a and b. For a right angle the cosine is zero and it becomes the Pythagorean theorem. ### Is there a Pythagorean theorem for cubes and higher powers? There is no such equation with whole-number solutions. Fermat's Last Theorem says that x to the n plus y to the n equals z to the n has no positive whole-number solution for n greater than 2, and Andrew Wiles proved it in 1995. ### How do you use the Pythagorean theorem in Python? Use math.hypot for lengths, because it avoids overflow, and math.dist for the distance between points. To test a right angle compare whole numbers, a times a plus b times b equal to c times c, not float square roots, which round. --- # Teorema Pythagoras: Bukti, Tripel, dan Penerapan Source: https://nunada.my.id/artikel/teorema-pythagoras/ Updated: 2026-11-01 ## Jawaban singkat **Teorema Pythagoras menyatakan bahwa pada segitiga siku-siku kuadrat hipotenusa sama dengan jumlah kuadrat kedua sisi tegak: $a^2+b^2=c^2$.** Dalam gambar, persegi pada sisi terpanjang berluas sama dengan kedua persegi pada sisi lainnya bersama-sama. Teorema ini memberi sisi yang hilang sebagai $c=\sqrt{a^2+b^2}$, menunjukkan bahwa tiga sisi membentuk sudut siku-siku tepat bila $a^2+b^2=c^2$, dan, dengan bilangan bulat seperti $3,4,5$, menghasilkan tripel Pythagoras. ### Poin penting - Pada segitiga siku-siku dengan sisi tegak $a,b$ dan hipotenusa $c$: $a^2+b^2=c^2$; hipotenusa yang hilang adalah $\sqrt{a^2+b^2}$ dan sisi tegak yang hilang adalah $\sqrt{c^2-a^2}$, dengan pengurangan di bawah akar. - Teorema ini dapat dibuktikan dengan menata ulang luas, dengan segitiga sebangun, dengan menggeser persegi (Euclid), atau dengan luas trapesium (Garfield); masing-masing hanya beberapa baris. - Kebalikannya benar: jika $a^2+b^2=c^2$ maka sudut di depan $c$ adalah sudut siku-siku, yang menjadi dasar menyiku sudut dengan tali $3$–$4$–$5$. - Rumus Euclid $(m^2-n^2,\;2mn,\;m^2+n^2)$ membentuk setiap tripel primitif; semuanya tumbuh dalam sebuah pohon dari $(3,4,5)$, dan selalu ada satu sisi kelipatan 3, satu kelipatan 4, dan satu bilangan kelipatan 5. - Jarak antara dua titik adalah $\sqrt{\Delta x^2+\Delta y^2}$, dan diagonal ruang balok adalah $\sqrt{l^2+w^2+h^2}$: teorema yang dipakai sekali di bidang dan dua kali di ruang. - Perluasannya: aturan kosinus untuk segitiga mana pun, luas bangun sebangun pada sisi-sisinya, rumus jarak di dimensi mana pun, dan Teorema Terakhir Fermat untuk pangkat yang lebih tinggi. ## Apa itu teorema Pythagoras? **Pada segitiga siku-siku dengan sisi tegak $a$ dan $b$ dan hipotenusa $c$, teorema Pythagoras menyatakan bahwa $a^2+b^2=c^2$.** Sisi tegak adalah dua sisi yang bertemu di sudut siku-siku; hipotenusa adalah sisi di depannya, yang selalu terpanjang (lihat [segitiga siku-siku](https://nunada.my.id/artikel/segitiga/#right-triangles)). Persamaan itu tentang luas. Persegi pada hipotenusa berluas tepat sama dengan jumlah luas kedua persegi pada sisi tegak, yaitu gambar pada alat di bawah. Namanya mengabadikan Pythagoras dari Samos (sekitar 570–495 SM), tetapi hubungan itu sudah dikenal di Babilonia, India, dan Tiongkok jauh sebelum dia; sejarahnya ada di bagian akhir. Dua hal langsung mengikutinya: - **Hipotenusa yang hilang:** $c=\sqrt{a^2+b^2}$. Untuk sisi tegak $3$ dan $4$ hasilnya $\sqrt{9+16}=5$. Untuk dua sisi tegak $1$ hasilnya $\sqrt2$, yang [irasional](https://nunada.my.id/artikel/bilangan-irasional/#why-sqrt2-is-irrational), dan untuk sisi tegak $6$ dan $4$ hasilnya $\sqrt{52}=2\sqrt{13}$ setelah kamu [menyederhanakan bentuk akar](https://nunada.my.id/artikel/eksponen-dan-akar/#simplify-radicals). - **Sisi tegak yang hilang:** $b=\sqrt{c^2-a^2}$, dengan pengurangan di bawah akar, karena hipotenusa adalah yang terbesar. Untuk $c=13$ dan $a=5$ hasilnya $\sqrt{169-25}=12$. Jaga semua panjang dalam satuan yang sama, dan biarkan akar kuadrat tetap sebagai akar, atau dalam bentuk sederhana, sampai langkah terakhir. Teorema ini membutuhkan sudut siku-siku: untuk segitiga lain lihat aturan kosinus pada bagian perluasan di bawah. Cobalah: berikan dua sisi dan dapatkan sisi ketiga secara eksak, dengan persegi digambar pada setiap sisi. ## Bagaimana membuktikan teorema Pythagoras? **Ada ratusan bukti, dan empat yang paling jelas menata ulang luas, memakai segitiga sebangun, menggeser persegi menjadi persegi panjang, atau menjumlahkan luas trapesium; masing-masing hanya beberapa baris.** Inilah keempatnya, dimulai dari yang ada pada alat di bawah. **1. Menata ulang empat segitiga.** Ambil empat salinan segitiga siku-siku, masing-masing berluas $\frac12ab$, dan susun di dalam persegi bersisi $a+b$. Ada dua penataan. Pada yang pertama, segitiga-segitiga itu menyisakan persegi miring bersisi $c$ di tengah. Pada yang kedua, segitiga yang sama menyisakan dua persegi, satu bersisi $a$ dan satu bersisi $b$. Persegi besar berluas sama pada kedua penataan, begitu pula keempat segitiga, sehingga sisanya pasti sama: $$c^2=(a+b)^2-4\cdot\tfrac12ab=a^2+b^2.$$ Inilah diagram Zhoubi Suanjing dari Tiongkok. Geser $a$ dan $b$ dan ganti penataannya di bawah. *Garis tinggi dari sudut siku-siku C ke hipotenusa AB membagi segitiga menjadi dua segitiga lebih kecil yang sebangun dengan segitiga utuh, dan membagi hipotenusa menjadi dua bagian p dan q.* **2. Segitiga sebangun.** Gambar garis tinggi dari sudut siku-siku ke hipotenusa. Garis itu membagi hipotenusa $c$ menjadi dua bagian $p$ dan $q$ dengan $p+q=c$, dan membagi segitiga menjadi dua segitiga lebih kecil, masing-masing sebangun dengan segitiga utuh menurut AA, seperti pada [segitiga sebangun](https://nunada.my.id/artikel/segitiga/#congruence-similarity). Membandingkan perbandingan sisi-sisi yang bersesuaian memberi $\frac{a}{c}=\frac{p}{a}$ dan $\frac{b}{c}=\frac{q}{b}$, yaitu $a^2=cp$ dan $b^2=cq$. Jumlahkan: $$a^2+b^2=c(p+q)=c\cdot c=c^2.$$ **3. Bukti Euclid (Elements I.47).** Kedua persamaan yang sama itu mengatakan bahwa bila garis tinggi diperpanjang menembus persegi pada hipotenusa, ia membagi persegi itu menjadi dua persegi panjang, satu berluas $cp=a^2$ dan satu berluas $cq=b^2$. Euclid menunjukkannya tanpa perbandingan, dengan menggeser: persegi dan persegi panjang pada alas yang sama dan di antara garis sejajar yang sama, dibelah dua oleh diagonal, memberi segitiga berluas sama, sehingga setiap persegi pada sisi tegak sama dengan satu persegi panjang dari persegi besar. **4. Trapesium Garfield (1876).** Letakkan dua salinan segitiga siku-siku berdampingan sehingga hipotenusanya membentuk sudut siku-siku; dengan segitiga siku-siku ketiga bersisi tegak $c$ dan $c$ di antaranya, bangunnya adalah trapesium dengan sisi sejajar $a$ dan $b$ dan tinggi $a+b$. Luasnya $\frac12(a+b)(a+b)$, dan juga jumlah ketiga segitiga, $\frac12ab+\frac12ab+\frac12c^2$. Jadi $\frac12(a+b)^2=ab+\frac12c^2$, yang menjadi $a^2+2ab+b^2=2ab+c^2$ dan lagi-lagi $a^2+b^2=c^2$. James Garfield menemukannya saat menjadi anggota DPR Amerika Serikat, dan ia menjadi presiden ke-20 lima tahun kemudian. Kumpulan karya Elisha Loomis, dalam edisi 1940, menghimpun sekitar 370 bukti teorema ini. ## Bagaimana memakai kebalikannya untuk memeriksa sudut siku-siku? **Jika ketiga sisi suatu segitiga memenuhi $a^2+b^2=c^2$, sudut di depan $c$ adalah sudut siku-siku; kebalikan ini adalah cara tukang bangunan menyiku sudut dengan tali $3$–$4$–$5$.** **Mengapa kebalikannya benar.** Misalkan segitiga memiliki sisi $a$, $b$, $c$ dengan $a^2+b^2=c^2$. Bangun segitiga siku-siku dengan sisi tegak $a$ dan $b$. Menurut teorema, hipotenusanya $\sqrt{a^2+b^2}=c$, sehingga ketiga sisinya sama dengan segitiga yang diberikan. Dua segitiga dengan tiga sisi sama adalah kongruen (SSS), sehingga segitiga yang diberikan juga memiliki sudut siku-siku. Euclid membuktikannya sebagai proposisi I.48, yang terakhir pada Buku I. **Tali 3–4–5.** Ikat tali melingkar dengan $12$ ruas sama yang ditandai simpul. Pegang simpul berjarak $3$ dan $4$ lalu tarik lingkaran itu kencang menjadi segitiga: sisinya $3$, $4$, dan $5$, dan $9+16=25$, sehingga sudut di antara sisi $3$ dan $4$ tepat siku-siku. Pengukur tanah dan tukang bangunan telah melakukannya selama ribuan tahun. Kelipatan mana pun sama baiknya, seperti $6$–$8$–$10$ untuk ruangan besar. **Pemeriksaan diagonal.** Bingkai $2{,}4$ m kali $1{,}8$ m adalah persegi panjang hanya bila diagonalnya $3{,}0$ m, karena $1{,}8^2+2{,}4^2=3{,}24+5{,}76=9{,}00=3{,}0^2$. Jika diagonalnya lebih panjang atau lebih pendek, bingkainya miring. **Bagaimana bila ujinya gagal?** Maka sudutnya bukan sudut siku-siku, dan besar $c^2$ terhadap $a^2+b^2$ menunjukkan arahnya: $c^2$ yang lebih besar berarti sudut tumpul, yang lebih kecil berarti sudut lancip, seperti diuraikan pada [jenis-jenis segitiga](https://nunada.my.id/artikel/segitiga/#types). Sisi $5$, $7$, $9$ memberi $25+49=74<81$, sehingga sudut terbesarnya tumpul. ## Apa itu tripel Pythagoras dan bagaimana menemukannya? **Tripel Pythagoras adalah tiga bilangan bulat positif $a,b,c$ dengan $a^2+b^2=c^2$, dan rumus Euclid $(m^2-n^2,\;2mn,\;m^2+n^2)$ menghasilkan setiap tripel primitif.** Tripel $(3,4,5)$ yang terkecil; $(5,12,13)$ dan $(8,15,17)$ menyusul. Kelipatan suatu tripel juga tripel ($(6,8,10)$ adalah dua kali $(3,4,5)$), sehingga yang menarik adalah tripel primitif, tanpa faktor persekutuan, seperti pada [faktor persekutuan terbesar](https://nunada.my.id/artikel/bilangan-bulat/#gcd-lcm). **Rumus Euclid.** Untuk bilangan bulat $m>n>0$ tripel $(m^2-n^2,\,2mn,\,m^2+n^2)$ berlaku, karena $(m^2-n^2)^2+(2mn)^2=m^4-2m^2n^2+n^4+4m^2n^2=(m^2+n^2)^2$. Ia primitif tepat bila $m$ dan $n$ saling prima dan salah satunya genap, dan lalu memberi setiap tripel primitif satu kali. | $m$ | $n$ | Tripel primitif | |---|---|---| | $2$ | $1$ | $3,4,5$ | | $3$ | $2$ | $5,12,13$ | | $4$ | $1$ | $8,15,17$ | | $4$ | $3$ | $7,24,25$ | | $5$ | $2$ | $20,21,29$ | | $5$ | $4$ | $9,40,41$ | | $6$ | $1$ | $12,35,37$ | | $7$ | $2$ | $28,45,53$ | Ada $16$ tripel primitif dengan hipotenusa paling besar $100$, dan $52$ tripel seluruhnya bila kelipatannya dihitung. **Pola pada setiap tripel.** Pada tripel primitif tepat satu sisi tegak genap dan hipotenusanya ganjil. Di antara $a,b,c$ satu sisi tegak adalah kelipatan $3$, satu sisi tegak kelipatan $4$, dan satu dari ketiga bilangan kelipatan $5$, sehingga $abc$ selalu habis dibagi $60$ (lihat [keterbagian](https://nunada.my.id/artikel/bilangan-bulat/#divisibility)). Luas $\frac12ab$ selalu bilangan bulat. **Semua segitiga dengan sisi tegak tertentu.** Tulis $a^2=c^2-b^2=(c-b)(c+b)$ dan daftar cara memfaktorkan $a^2$ menjadi dua bilangan yang sama paritasnya. Untuk $a=12$, $a^2=144=2\cdot72=4\cdot36=6\cdot24=8\cdot18$, memberi $(c,b)=(37,35),(20,16),(15,9),(13,5)$: empat segitiga siku-siku dengan sisi tegak $12$. Jelajahi daftarnya di bawah, lalu telusuri pohonnya. **Pohon tripel primitif.** Pada 1934 matematikawan Swedia Berggren menemukan bahwa semua tripel primitif muat dalam satu pohon. Akarnya $(3,4,5)$ dan setiap tripel memiliki tepat tiga anak, yang ditemukan dengan tiga aturan linear tetap, sehingga setiap tripel primitif muncul tepat satu kali. Dengan sisi tegak ganjil di depan, $(3,4,5)$ memiliki anak $(5,12,13)$, $(21,20,29)$, dan $(15,8,17)$. Tripel bukan sekadar keanehan: $\left(\frac35,\frac45\right)$ adalah titik pada lingkaran satuan karena $3^2+4^2=5^2$, dan setiap tripel memberi titik seperti itu, seperti pada [persamaan lingkaran](https://nunada.my.id/artikel/lingkaran/#equation). ## Bagaimana teorema ini memberi jarak dan diagonal? **Jarak antara dua titik adalah hipotenusa segitiga siku-siku yang sisi tegaknya selisih mendatar dan selisih tegak, sehingga $d=\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}$; satu pemakaian teorema lagi memberi diagonal ruang balok.** **Di bidang.** Dari $(1,2)$ ke $(7,10)$ sisi tegaknya $6$ dan $8$, sehingga jaraknya $\sqrt{36+64}=10$. Membandingkan kuadrat jarak tidak memerlukan akar sama sekali, begitulah [uji segiempat](https://nunada.my.id/artikel/segiempat/#coordinates) memeriksa sisi yang sama panjang, dan persamaan $(x-h)^2+(y-k)^2=r^2$ sebuah [lingkaran](https://nunada.my.id/artikel/lingkaran/#equation) adalah rumus jarak yang mengatakan "jarak ke pusat adalah $r$". **Di ruang.** Pakai teorema dua kali. Diagonal alas balok $l\times w$ adalah $\sqrt{l^2+w^2}$, dan diagonal ini bersama tinggi $h$ adalah sisi tegak segitiga siku-siku kedua yang hipotenusanya diagonal ruang balok: $$d=\sqrt{l^2+w^2+h^2}.$$ Balok $2\times3\times6$ memiliki diagonal ruang $\sqrt{4+9+36}=7$, dan batang terpanjang yang muat dalam balok $3\times4\times12$ adalah $\sqrt{9+16+144}=13$. Kubus satuan memiliki diagonal ruang $\sqrt3$ (lebih lanjut di [kubus](https://nunada.my.id/artikel/kubus/#diagonals) dan [balok](https://nunada.my.id/artikel/balok/#diagonals-and-angles)). Pola yang sama, jumlah kuadrat selisih di bawah akar, memberi jarak dalam dimensi sebanyak apa pun. **Pemakaian sehari-hari.** - **Tangga** sepanjang $5$ m dengan kaki $1{,}4$ m dari tembok mencapai ketinggian $\sqrt{25-1{,}96}=4{,}8$ m pada tembok. - **Jalan pintas** melintasi lapangan $60$ m kali $80$ m adalah $100$ m, dibandingkan $140$ m menyusuri tepinya. - **Ukuran layar** adalah diagonalnya. Layar 55 inci berbentuk $16:9$ memiliki lebar dan tinggi sebanding dengan $16$ dan $9$, dan $\sqrt{16^2+9^2}=\sqrt{337}$, sehingga lebarnya sekitar $47{,}9$ inci dan tingginya $27{,}0$ inci, karena $\frac{55\cdot16}{\sqrt{337}}\approx47{,}9$ dan $\frac{55\cdot9}{\sqrt{337}}\approx27{,}0$. - **Jalan setapak diagonal** berpaving melintasi taman persegi panjang $30$ m kali $40$ m panjangnya $50$ m; dengan harga Rp150.000 per meter biayanya 50 kali Rp150.000, yaitu Rp7.500.000. ## Dapatkah teorema Pythagoras diperluas? **Ya: aturan kosinus memperluasnya ke setiap segitiga, bangun sebangun mana pun yang dibuat pada ketiga sisi memiliki luas yang menjumlah dengan cara yang sama, rumus jarak membawanya ke dimensi mana pun, dan untuk pangkat di atas dua persamaannya sama sekali tidak punya penyelesaian bilangan bulat.** - **[Aturan kosinus](https://nunada.my.id/artikel/aturan-kosinus/#what-it-says).** Untuk segitiga mana pun, $c^2=a^2+b^2-2ab\cos C$. Pada sudut siku-siku $\cos C=0$ dan koreksinya lenyap, yaitu teorema Pythagoras; untuk sudut lancip koreksinya mengurangi, untuk sudut tumpul koreksinya menambah. Lihat [memecahkan segitiga](https://nunada.my.id/artikel/segitiga/#solve-a-triangle). - **Bangun lain pada sisi-sisinya.** Luas tumbuh sebagai kuadrat panjang, sehingga bangun sebangun mana pun yang dibuat pada ketiga sisi memenuhi $A_a+A_b=A_c$: setengah lingkaran, segitiga sama sisi, bahkan salinan gambar kesukaanmu. Dengan setengah lingkaran, Hippokrates dari Khios (abad ke-5 SM) menggambar dua bulan sabit (lunula) di luar setengah lingkaran pada hipotenusa dan menunjukkan bahwa, untuk segitiga siku-siku, kedua lunula bersama-sama berluas tepat sama dengan segitiganya. - **Vektor dan dimensi lebih tinggi.** Jika dua vektor tegak lurus, $|u+v|^2=|u|^2+|v|^2$; ini adalah teorema untuk segitiga yang dibentuknya, dan jarak dalam dimensi sebanyak apa pun dibangun darinya. - **Permukaan lengkung.** Pada bola berjari-jari $1$, segitiga bersudut siku-siku memenuhi $\cos c=\cos a\cos b$, dengan sisi diukur sepanjang permukaan. Teorema biasa membutuhkan bidang datar. - **Pangkat lebih tinggi.** Persamaan $x^2+y^2=z^2$ memiliki tak berhingga banyak penyelesaian bilangan bulat, yaitu tripel di atas. Untuk $x^n+y^n=z^n$ dengan $n\ge3$ tidak ada penyelesaian bilangan bulat positif. Pierre de Fermat menuliskannya di pinggir halaman sekitar 1637, dengan mengatakan bahwa ia memiliki bukti yang terlalu panjang untuk pinggir halaman; bukti pertama ditemukan oleh Andrew Wiles, dengan celah yang ditutup oleh Richard Taylor, pada 1995. Inilah Teorema Terakhir Fermat. ## Bagaimana memakai teorema Pythagoras dalam kode? **Pakai `math.hypot` untuk panjang, dan bilangan bulat dengan `math.isqrt` untuk uji yang eksak.** Akar kuadrat float dibulatkan, sehingga sudut siku-siku paling baik diuji dengan bilangan bulat, dan panjang yang sangat besar atau kecil paling baik dihitung dengan `hypot`, yang tidak dapat meluap. ```python from math import hypot, dist, isqrt, sqrt, gcd def is_triple(a, b, c): return a * a + b * b == c * c # exact for whole numbers def hyp_exact(a, b): # (isqrt, True) when the hypotenuse is whole s = a * a + b * b c = isqrt(s) return c, c * c == s def primitive_triples(limit): # Euclid's formula out = [] m = 2 while m * m + 1 <= limit: for n in range(1, m): if (m - n) % 2 and gcd(m, n) == 1 and m * m + n * n <= limit: a, b = sorted((m * m - n * n, 2 * m * n)) out.append((a, b, m * m + n * n)) m += 1 return sorted(out, key=lambda t: t[2]) >>> is_triple(5, 12, 13), is_triple(4, 5, 6) (True, False) >>> hyp_exact(8, 15), hyp_exact(1, 1) ((17, True), (1, False)) >>> primitive_triples(30) [(3, 4, 5), (5, 12, 13), (8, 15, 17), (7, 24, 25), (20, 21, 29)] >>> len(primitive_triples(100)) 16 >>> hypot(3, 4), dist((1, 2), (7, 10)), hypot(2, 3, 6) # 2D, between points, 3D (5.0, 10.0, 7.0) >>> sqrt(1.2 ** 2 + 3.5 ** 2) == 3.7 # should be True: 1.2, 3.5, 3.7 is a triple False >>> hypot(1.2, 3.5) == 3.7 True >>> sqrt(1e200 ** 2 + 1e200 ** 2) # squaring overflows OverflowError: (34, 'Result too large') >>> hypot(1e200, 1e200) 1.414213562373095e+200 ``` ```javascript Math.hypot(3, 4) // 5 Math.hypot(1, 2, 2) // 3: the diagonal of a 1 by 2 by 2 box const isTriple = (a, b, c) => a * a + b * b === c * c // exact for whole numbers isTriple(20, 21, 29) // true Math.sqrt(1.2 ** 2 + 3.5 ** 2) === 3.7 // false: the float sum rounds, as in Python ``` ```cpp #include #include #include using namespace std; bool isTriple(int a, int b, int c) { return a * a + b * b == c * c; } // exact for whole numbers int isqrt(int n) { int r = 0; while ((r + 1) * (r + 1) <= n) r++; return r; } int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); } int main() { cout << isTriple(5, 12, 13) << " " << isTriple(4, 5, 6) << endl; // 1 0 int s = 8 * 8 + 15 * 15, c = isqrt(s); cout << c << " " << (c * c == s) << endl; // 17 1: the hypotenuse is whole for (int h = 1; h <= 30; h++) // primitive triples up to 30 for (int a = 1; a < h; a++) for (int b = a + 1; b < h; b++) if (isTriple(a, b, h) && gcd(a, b) == 1) cout << "(" << a << "," << b << "," << h << ") "; cout << endl; int count = 0; // Euclid's formula up to 100 for (int m = 2; m * m + 1 <= 100; m++) for (int n = 1; n < m; n++) if ((m - n) % 2 == 1 && gcd(m, n) == 1 && m * m + n * n <= 100) count++; cout << count << endl; printf("%.1f %.1f\n", sqrt(3.0 * 3 + 4 * 4), sqrt(2.0 * 2 + 3 * 3 + 6 * 6)); // 2D and 3D lengths cout << (sqrt(1.2 * 1.2 + 3.5 * 3.5) == 3.7) << endl; // 0: the float sum rounds double big = 1e200; cout << (big * big > 1e308) << endl; // 1: squaring overflows to inf return 0; } /* output: 1 0 17 1 (3,4,5) (5,12,13) (8,15,17) (7,24,25) (20,21,29) 16 5.0 7.0 0 1 */ ``` Jebakannya, berdasarkan seberapa sering terjadi: | Jebakan | Yang terjadi | Yang sebaiknya dilakukan | |---|---|---| | Menguji sudut siku-siku dengan akar float | `sqrt(1.2**2 + 3.5**2) == 3.7` bernilai salah | bandingkan bilangan bulat `aa + bb == c*c`, pakai `Fraction` seperti pada [bilangan real dalam kode](https://nunada.my.id/artikel/bilangan-real/#real-numbers-in-code), atau `math.isclose` | | Mengkuadratkan panjang yang sangat besar atau kecil | `1e200 ** 2` meluap, `1e-200 ** 2` menjadi 0 | pakai `math.hypot` | | `int(sqrt(n))` untuk bilangan bulat besar | akar float kehilangan digit dan hasil bulatnya meleset satu | pakai `math.isqrt` | | `^` untuk kuadrat | itu XOR, bukan pangkat | pakai `**` atau kalikan | | Mengkuadratkan jumlah | `(a + b) ** 2` bukan `a**2 + b**2` | jabarkan: `aa + 2ab + bb` | | Satuan campur aduk | 3 kaki dan 40 inci memberi hasil tak masuk akal | ubah ke satu satuan lebih dulu | ## Siapa yang menemukan teorema Pythagoras? **Tidak ada satu orang yang menemukannya: hubungan ini dipakai di Babilonia, India, dan Tiongkok jauh sebelum Pythagoras, dan bukti pertama yang dapat kita baca berasal dari Euclid.** - **Sekitar 1800 SM.** Lempeng tanah liat Babilonia Plimpton 322 mendaftar apa yang tampaknya tripel Pythagoras, seperti $(119,120,169)$, sehingga hubungan itu sudah dipakai seribu tahun sebelum geometri Yunani. - **Sekitar 800–500 SM.** Sulba Sutra India, aturan membangun altar, menyatakan bahwa tali sepanjang diagonal persegi panjang menghasilkan luas persegi pada kedua sisinya bersama-sama. - **Sekitar 570–495 SM.** Pythagoras dari Samos, di Italia selatan, mendirikan perguruan yang memakai namanya. Tidak ada tulisannya yang bertahan, dan penghargaan atas teorema ini berasal dari penulis berabad-abad kemudian. - **Sebelum abad ke-1 SM.** Zhoubi Suanjing dari Tiongkok menjelaskan segitiga $3$–$4$–$5$ dan diagram dengan persegi miring, teorema gougu (kaki dan kaki). - **Sekitar 300 SM.** Elements Euclid membuktikan teorema ini sebagai I.47 dan kebalikannya sebagai I.48. - **Abad ke-12.** Bhaskara II menggambar diagram penataan ulang dengan satu kata saja, "Lihatlah!". - **1876.** Bukti trapesium Garfield terbit. - **1995.** Wiles membuktikan Teorema Terakhir Fermat, jawaban atas pertanyaan apakah persamaan Pythagoras berlaku dengan pangkat tiga atau lebih. Sebuah kisah populer mengatakan bahwa bangsa Yunani terguncang oleh penemuan bahwa diagonal persegi bukan perbandingan bilangan bulat, bilangan irasional pertama, yang tak terelakkan akibat teorema ini: lihat [bukti bahwa akar 2 irasional](https://nunada.my.id/artikel/bilangan-irasional/#why-sqrt2-is-irrational). ## Kesalahan apa yang sering terjadi pada teorema Pythagoras? **Kesalahan paling umum pada teorema ini adalah sembilan hal berikut, masing-masing dengan pernyataan yang benar.** | Kesalahan | Yang benar | |---|---| | ❌ $(a+b)^2=a^2+b^2$ | $(a+b)^2=a^2+2ab+b^2$; $2ab$ yang hilang itulah yang dijelaskan oleh bukti dengan menata ulang. | | ❌ $c=a+b$ | $c=\sqrt{a^2+b^2}$ lebih pendek daripada $a+b$: hipotenusa adalah jalan pintas. | | ❌ $c^2=25$, sehingga $c=25$ | Tarik akar kuadrat: $c=5$. | | ❌ Sisi tegak yang hilang adalah $\sqrt{c^2+a^2}$ | Kurangkan: $b=\sqrt{c^2-a^2}$. | | ❌ $\sqrt{a^2+b^2}=\sqrt{a^2}+\sqrt{b^2}$ | Akar dari jumlah bukan jumlah akar: $\sqrt{9+16}=5$, tetapi $\sqrt9+\sqrt{16}=7$. | | ❌ Membulatkan terlalu dini: $c^2=2$ sehingga $c=1{,}41$ | $\sqrt2$ irasional; biarkan $\sqrt2$ sampai langkah terakhir. | | ❌ Setiap segitiga siku-siku bersisi bilangan bulat | Sisi tegak $1$ dan $1$ memberi $\sqrt2$; sisi bilangan bulat adalah kasus khusus tripel. | | ❌ Teorema menentukan apakah segitiga tampak siku-siku | Ia hanya menentukan bila angkanya cocok persis; uji dengan $a^2+b^2=c^2$, bukan dengan mata. | | ❌ Satuan campur aduk | Ubah dulu: sisi tegak $3$ kaki dan $40$ inci membutuhkan satu satuan yang sama. | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: teorema Pythagoras sekilas - **Pernyataan:** segitiga siku-siku dengan sisi tegak $a,b$ dan hipotenusa $c$: $a^2+b^2=c^2$; $c=\sqrt{a^2+b^2}$, sisi tegak adalah $\sqrt{c^2-a^2}$. - **Bukti:** menata ulang empat segitiga dalam persegi $(a+b)$; segitiga sebangun ($a^2=cp$, $b^2=cq$); penggeseran Euclid; trapesium Garfield. - **Kebalikan:** $a^2+b^2=c^2\Rightarrow$ sudut siku-siku; tali $3$–$4$–$5$, pemeriksaan diagonal. - **Tripel:** $(m^2-n^2,2mn,m^2+n^2)$; primitif bila $\gcd(m,n)=1$ dan paritas berbeda; $60\mid abc$; pohon Berggren dari $(3,4,5)$. - **Jarak:** $\sqrt{\Delta x^2+\Delta y^2}$; diagonal ruang balok $\sqrt{l^2+w^2+h^2}$. - **Perluasan:** aturan kosinus, bangun sebangun pada sisi-sisinya, dimensi mana pun, bola ($\cos c=\cos a\cos b$), Teorema Terakhir Fermat. - **Kode:** `math.hypot`, uji bilangan bulat dengan `isqrt`, jangan kesamaan float. ## Glosarium: istilah penting - **Teorema Pythagoras**: Aturan bahwa pada segitiga siku-siku kuadrat hipotenusa sama dengan jumlah kuadrat kedua sisi tegak. - **Sisi tegak segitiga siku-siku**: Dua sisi segitiga siku-siku yang bertemu di sudut siku-siku, berbeda dari hipotenusa. - **Kebalikan teorema Pythagoras**: Pernyataan bahwa segitiga yang sisinya memenuhi a kuadrat ditambah b kuadrat sama dengan c kuadrat memiliki sudut siku-siku di depan sisi c. - **Tripel Pythagoras**: Tiga bilangan bulat positif a, b, dan c dengan a kuadrat ditambah b kuadrat sama dengan c kuadrat, seperti 3, 4, dan 5. - **Tripel Pythagoras primitif**: Tripel Pythagoras yang ketiga bilangannya tidak punya faktor persekutuan lebih dari 1, sehingga bukan kelipatan tripel yang lebih kecil. - **Rumus Euclid**: Aturan bahwa untuk bilangan bulat m lebih besar dari n bilangan m kuadrat dikurangi n kuadrat, 2mn, dan m kuadrat ditambah n kuadrat membentuk tripel Pythagoras. - **Pohon Berggren**: Pohon yang bermula dari tripel 3, 4, 5 dan memberi setiap tripel Pythagoras primitif tepat satu kali lewat tiga aturan yang menghasilkan tiga anak. - **Rumus jarak**: Rumus yang memberi jarak antara dua titik sebagai akar dari jumlah kuadrat selisih koordinat, ditemukan dengan teorema Pythagoras. - **Teorema Terakhir Fermat**: Teorema bahwa x pangkat n ditambah y pangkat n sama dengan z pangkat n tidak memiliki penyelesaian bilangan bulat positif bila n lebih besar dari 2. ## Pertanyaan yang sering diajukan ### Apa itu teorema Pythagoras? Pada segitiga siku-siku kuadrat hipotenusa sama dengan jumlah kuadrat kedua sisi tegak, ditulis a kuadrat ditambah b kuadrat sama dengan c kuadrat. Untuk sisi tegak 3 dan 4 hipotenusanya 5. Teorema ini hanya berlaku untuk segitiga bersudut siku-siku. ### Apa rumus teorema Pythagoras? Rumusnya a kuadrat ditambah b kuadrat sama dengan c kuadrat, dengan c hipotenusa. Hipotenusa adalah akar dari a kuadrat ditambah b kuadrat, dan sisi tegak yang hilang adalah akar dari c kuadrat dikurangi a kuadrat. ### Siapa yang menemukan teorema Pythagoras? Tidak ada satu orang pun. Lempeng Babilonia sekitar 1800 SM mendaftar tripel, teks India dan Tiongkok menyatakan aturannya, dan Euclid memberi bukti pertama yang bertahan. Namanya diambil dari Pythagoras dari Samos, tetapi tidak ada tulisannya yang bertahan. ### Bagaimana membuktikan teorema Pythagoras? Salah satu bukti meletakkan empat salinan segitiga di dalam persegi bersisi a ditambah b. Segitiga-segitiga itu menyisakan persegi miring bersisi c atau dua persegi bersisi a dan b, sehingga c kuadrat sama dengan a kuadrat ditambah b kuadrat. Ada ratusan bukti lain. ### Apa kebalikan teorema Pythagoras? Jika sisi-sisi segitiga memenuhi a kuadrat ditambah b kuadrat sama dengan c kuadrat, sudut di depan c adalah sudut siku-siku. Itu karena segitiga siku-siku dengan sisi tegak a dan b memiliki ketiga sisi yang sama, sehingga kedua segitiga kongruen. ### Apa aturan 3-4-5? Itu metode tukang bangunan untuk membuat sudut siku-siku. Tandai 3 satuan pada satu garis dan 4 satuan pada garis lain dari sudut; jika jarak antara kedua tanda tepat 5 satuan, sudutnya siku, karena 3 kuadrat ditambah 4 kuadrat adalah 5 kuadrat. ### Apa itu tripel Pythagoras? Itu kumpulan tiga bilangan bulat positif a, b, dan c dengan a kuadrat ditambah b kuadrat sama dengan c kuadrat, seperti 3, 4, 5 dan 5, 12, 13. Tripel primitif tidak punya faktor persekutuan, dan setiap tripel lain adalah kelipatan salah satunya. ### Bagaimana membuat tripel Pythagoras? Pakai rumus Euclid: untuk bilangan bulat m lebih besar dari n, bilangan m kuadrat dikurangi n kuadrat, 2mn, dan m kuadrat ditambah n kuadrat membentuk tripel. Dengan m 2 dan n 1 hasilnya 3, 4, 5; dengan m 3 dan n 2 hasilnya 5, 12, 13. ### Bagaimana teorema Pythagoras memberi rumus jarak? Ruas garis antara dua titik adalah hipotenusa segitiga siku-siku yang sisi tegaknya selisih koordinat x dan y. Jadi jaraknya adalah akar dari kuadrat selisih x ditambah kuadrat selisih y. ### Bagaimana mencari diagonal ruang balok? Terapkan teorema dua kali: diagonal ruang adalah akar dari panjang kuadrat ditambah lebar kuadrat ditambah tinggi kuadrat. Balok 2 kali 3 kali 6 memiliki diagonal ruang akar dari 49, yaitu 7. ### Apakah teorema Pythagoras berlaku untuk segitiga yang bukan siku-siku? Tidak seperti yang dinyatakan. Untuk segitiga mana pun pakai aturan kosinus, c kuadrat sama dengan a kuadrat ditambah b kuadrat dikurangi 2ab kali kosinus sudut di antara a dan b. Untuk sudut siku-siku kosinusnya nol dan ia menjadi teorema Pythagoras. ### Adakah teorema Pythagoras untuk pangkat tiga dan lebih tinggi? Tidak ada persamaan seperti itu dengan penyelesaian bilangan bulat. Teorema Terakhir Fermat menyatakan bahwa x pangkat n ditambah y pangkat n sama dengan z pangkat n tidak punya penyelesaian bilangan bulat positif untuk n lebih besar dari 2, dan Andrew Wiles membuktikannya pada 1995. ### Bagaimana memakai teorema Pythagoras di Python? Pakai math.hypot untuk panjang, karena menghindari luapan, dan math.dist untuk jarak antara titik. Untuk menguji sudut siku-siku bandingkan bilangan bulat, a kali a ditambah b kali b sama dengan c kali c, bukan akar float yang dibulatkan. --- # Circles: Circumference, Area, Angles and Equations Source: https://nunada.my.id/articles/circles/ Updated: 2026-10-10 ## Quick answer **A circle is the set of all points in a plane that lie the same distance, the radius, from a fixed point, the center.** Its circumference is $C=2\pi r$ and the disk it encloses has area $A=\pi r^2$, where $\pi\approx3.14159$ is the ratio of circumference to diameter. An inscribed angle is half the central angle on the same arc, a tangent is perpendicular to the radius, and a circle with center $(h,k)$ has the equation $(x-h)^2+(y-k)^2=r^2$. ### Key takeaways - Every point of a circle is at distance $r$ from the center; the diameter $d=2r$ is the longest chord, and all circles are similar, which is why $\pi=\frac Cd$ is the same for every circle. - Circumference $C=2\pi r$ and area $A=\pi r^2$; $\pi$ is irrational and transcendental, so $3.14$, $\frac{22}{7}$ and $\frac{355}{113}$ are only approximations. - A central angle of $\theta$ cuts off the fraction $\frac{\theta}{360}$ of the circle: arc $=\frac{\theta}{360}\cdot2\pi r=r\theta$ in radians, sector $=\frac12r^2\theta$, and $180^\circ=\pi$ radians. - An inscribed angle is half the central angle on the same arc; so an angle in a semicircle is $90^\circ$ (Thales) and opposite angles of a cyclic quadrilateral add up to $180^\circ$. - A tangent is perpendicular to the radius, the two tangents from an outside point are equal with length $\sqrt{OP^2-r^2}$, and for crossing chords $PA\cdot PB=PC\cdot PD$. - The circle with center $(h,k)$ and radius $r$ is $(x-h)^2+(y-k)^2=r^2$; comparing a squared distance with $r^2$ decides whether a point is inside, on or outside, and a line or another circle can be tested the same way. ## What is a circle? **A circle is the set of all points in a plane that are the same distance, called the radius, from one fixed point, called the center.** The circle is only the curve; the curve together with its inside is the disk, and in everyday language "the area of a circle" means the area of the disk. | Part | Meaning | |---|---| | Center | the fixed point $O$ | | Radius | a segment from the center to the circle; its length is $r$ | | Diameter | a chord through the center; its length is $d=2r$, the longest possible chord | | Chord | a segment joining two points of the circle | | Arc | the piece of the circle between two points | | Sector | the region between two radii and the arc between them, like a slice of pizza | | Segment | the region between a chord and its arc | | Secant | a line through two points of the circle | | Tangent | a line that touches the circle at exactly one point | | Circumference | the length of the circle itself | A circle is perfectly symmetric: every line through the center is a line of symmetry, and turning the circle by any angle about the center leaves it unchanged. It is also similar to every other circle, since one is a scaled copy of the other (the same idea as [similar triangles](https://nunada.my.id/articles/triangles/#congruence-similarity)). That is the reason the ratio of circumference to diameter is one number for all circles. *A circle with its center O, a radius r, a diameter d (dashed), a chord, and a tangent that touches it at the bottom.* ## What is π, and how do you find the circumference and area of a circle? **The number $\pi\approx3.14159$ is the ratio of the circumference of any circle to its diameter, so the circumference is $C=\pi d=2\pi r$, and the area of the disk is $A=\pi r^2$.** | Known | Circumference | Area | |---|---|---| | radius $r$ | $2\pi r$ | $\pi r^2$ | | diameter $d$ | $\pi d$ | $\frac{\pi d^2}{4}$ | | circumference $C$ | $C$ | $\frac{C^2}{4\pi}$ | | area $A$ | $2\sqrt{\pi A}$ | $A$ | **Why $\pi r^2$?** Cut the disk into many thin sectors and lay them side by side, alternately pointing up and down. They form a shape that looks more and more like a rectangle as the slices get thinner. Its height is $r$ and its width is half the circumference, $\pi r$, so the area is $\pi r\cdot r=\pi r^2$. For $r=7$ the circumference is $14\pi\approx43.98$ and the area is $49\pi\approx153.94$. Keep $\pi$ as a symbol as long as you can: the answer "$49\pi$" is exact, while $153.94$ is rounded. A ring (annulus) between radii $R$ and $r$ has area $\pi R^2-\pi r^2=\pi(R-r)(R+r)$; for $R=10$ and $r=6$ that is $64\pi\approx201.06$. **What kind of number is $\pi$?** It is irrational, so no fraction equals it, and transcendental, so it is not the solution of any polynomial equation with whole-number coefficients, a fact that ends the old puzzle of squaring the circle; see [pi, e and transcendental numbers](https://nunada.my.id/articles/irrational-numbers/#pi-e-transcendental). Its first digits are $3.14159\,26535\,89793$. Useful fractions come from [rational approximations](https://nunada.my.id/articles/irrational-numbers/#rational-approximations): $3.14$ is off by $0.05\%$, $\frac{22}{7}\approx3.142857$ by $0.04\%$, and $\frac{355}{113}\approx3.1415929$ by less than $0.00001\%$. A word problem: a round pond has a diameter of $14$ m and is to be fenced, with $\pi\approx\frac{22}{7}$. The fence is $C=\frac{22}{7}\cdot14=44$ m long, and at 12 dollars per meter it costs $44\cdot12=528$ dollars. Archimedes found bounds for $\pi$ by squeezing the circle between two polygons. The tool below repeats his doubling, from the hexagon to a polygon with thousands of sides. ## How do you find arc length, sector area and segment area? **A central angle of $\theta$ cuts off the fraction $\frac{\theta}{360}$ of the circle, so the arc is that fraction of the circumference and the sector is that fraction of the disk; the segment is the sector minus the triangle of the two radii and the chord.** | Quantity | $\theta$ in degrees | $\theta$ in radians | |---|---|---| | Arc length | $\frac{\theta}{360}\cdot2\pi r$ | $r\theta$ | | Sector area | $\frac{\theta}{360}\cdot\pi r^2$ | $\frac12r^2\theta$ | | Chord length | $2r\sin\frac{\theta}{2}$ | $2r\sin\frac{\theta}{2}$ | | Segment area | sector $-$ triangle | $\frac12r^2(\theta-\sin\theta)$ | **Radians.** One radian is the central angle whose arc is exactly as long as the radius. A full turn has $\frac{2\pi r}{r}=2\pi$ radians, so $180^\circ=\pi$ rad and $1\text{ rad}\approx57.2958^\circ$. In radians the arc is simply $r\theta$, which is why mathematics prefers them. | Degrees | $30^\circ$ | $45^\circ$ | $60^\circ$ | $90^\circ$ | $180^\circ$ | $360^\circ$ | |---|---|---|---|---|---|---| | Radians | $\frac{\pi}{6}$ | $\frac{\pi}{4}$ | $\frac{\pi}{3}$ | $\frac{\pi}{2}$ | $\pi$ | $2\pi$ | **Examples.** For $r=6$ and $\theta=120^\circ$ the fraction is $\frac13$, so the arc is $\frac13\cdot12\pi=4\pi\approx12.57$ and the sector is $\frac13\cdot36\pi=12\pi\approx37.70$. This is the [multiplication of fractions](https://nunada.my.id/articles/rational-numbers/#multiply-divide-fractions) with $\pi$ carried along. For $r=10$ and $\theta=90^\circ$: arc $5\pi\approx15.71$, sector $25\pi\approx78.54$, chord $10\sqrt2\approx14.14$ and segment $25\pi-50\approx28.54$, since the triangle has area $\frac12\cdot10\cdot10=50$. Choose a radius (or any of the other three quantities) and slide the angle below. ## What are the angle theorems of a circle? **An inscribed angle (a vertex on the circle) is half the central angle on the same arc, and from this one theorem come the right angle in a semicircle, equal angles in the same segment and the $180^\circ$ of a cyclic quadrilateral.** - **Central angle.** An angle at the center measures the same, in degrees, as the arc it cuts off. - **Inscribed angle theorem.** An angle $\angle APB$ with $P$ on the circle is half the central angle $\angle AOB$ on the same arc: central $120^\circ$ gives inscribed $60^\circ$. - **Same segment.** Inscribed angles on the same arc are equal, wherever $P$ moves on the other part of the circle. - **Thales.** If $AB$ is a diameter, the arc is $180^\circ$, so every inscribed angle $\angle APB$ is $90^\circ$. The converse is the fact that the circumcenter of a right triangle is the midpoint of its hypotenuse, as in the [centers of a triangle](https://nunada.my.id/articles/triangles/#centers). - **Cyclic quadrilateral.** If all four vertices lie on a circle, opposite angles add up to $180^\circ$, because they are half of two arcs that together make $360^\circ$. With $\angle A=75^\circ$ the opposite angle is $\angle C=105^\circ$. Ptolemy's theorem and Brahmagupta's area formula in the [history of quadrilaterals](https://nunada.my.id/articles/quadrilaterals/#history) are about these shapes. - **Tangent and radius.** A tangent is perpendicular to the radius at the point where it touches. - **Tangent and chord.** The angle between a tangent and a chord equals the inscribed angle on the other side of the chord (the alternate segment). **Why one half?** Take the case where one side of the angle passes through the center. The triangle $OPA$ is isosceles ($OP=OA=r$), so its base angles are equal, and the central angle is an exterior angle of that triangle, equal to the sum of the two base angles, as in the [angle sum and exterior angle](https://nunada.my.id/articles/triangles/#angle-sum). So the central angle is twice the inscribed one. The general case adds or subtracts two such cases. Slide the four points below: the inscribed angles on the same side of $AB$ stay equal, and on opposite sides they add up to $180^\circ$. ## What are the rules for chords, tangents and secants? **The perpendicular from the center to a chord cuts the chord in half, a tangent is perpendicular to the radius, and the products of the pieces of crossing chords or secants are equal; all three come from the right triangles that the radius makes.** - **Chord and center.** If a chord is at distance $d$ from the center, its length is $2\sqrt{r^2-d^2}$. With $r=5$ and $d=3$ it is $2\sqrt{25-9}=8$, the $3$–$4$–$5$ triangle of the [Pythagorean theorem](https://nunada.my.id/articles/pythagorean-theorem/#what-is-the-theorem). Equal chords are equally far from the center, and the closer a chord is to the center the longer it is; the diameter ($d=0$) is the longest. - **Two tangents.** From a point $P$ outside the circle there are two tangents, and the two tangent segments have equal length $\sqrt{OP^2-r^2}$. With $r=5$ and $OP=13$ the length is $\sqrt{169-25}=12$, the $5$–$12$–$13$ triangle. - **Crossing chords.** If two chords $AB$ and $CD$ cross at $P$ inside the circle, then $PA\cdot PB=PC\cdot PD$. For $PA=3$, $PB=8$ and $PC=4$ we get $PD=6$, since $3\cdot8=4\cdot6=24$. - **Secants and tangents.** From a point $P$ outside, two secants give $PA\cdot PB=PC\cdot PD$, and a tangent $PT$ and a secant give $PT^2=PA\cdot PB$. For the tangent $12$ above and the secant through the center, $PA=13-5=8$ and $PB=13+5=18$, and $8\cdot18=144=12^2$. All of these say one thing: the number $|PO|^2-r^2$, the power of the point $P$, is negative inside the circle, zero on it and positive outside, and for every line through $P$ that meets the circle at $A$ and $B$ the product $PA\cdot PB$ equals its absolute value. Radicals like $2\sqrt{r^2-d^2}$ are often best left in [simplified form](https://nunada.my.id/articles/exponents-and-radicals/#simplify-radicals). ## What is the equation of a circle? **The circle with center $(h,k)$ and radius $r$ is the set of points $(x,y)$ with $(x-h)^2+(y-k)^2=r^2$, because that says the squared distance to the center is $r^2$.** For the center $(3,-2)$ and $r=5$ it is $(x-3)^2+(y+2)^2=25$. Expanding (see [expanding brackets](https://nunada.my.id/articles/algebraic-expressions/#expand)) gives the general form $x^2+y^2+Dx+Ey+F=0$ with $D=-2h$, $E=-2k$ and $F=h^2+k^2-r^2$. Our circle is $x^2+y^2-6x+4y-12=0$. To go back, complete the square in $x$ and in $y$: $x^2-6x=(x-3)^2-9$ and $y^2+4y=(y+2)^2-4$, so $(x-3)^2+(y+2)^2=12+9+4=25$. The general form describes a real circle only when $r^2=\frac{D^2}{4}+\frac{E^2}{4}-F$ is positive. **Where is a point?** Compare the squared distance $(x-h)^2+(y-k)^2$ with $r^2$: smaller means inside, equal means on the circle, larger means outside. For the circle above, $(0,0)$ gives $13<25$ (inside), $(8,-2)$ gives $25$ (on it) and $(9,5)$ gives $85>25$ (outside). **Through three points.** Three points that are not on one line lie on exactly one circle, the circumcircle of the triangle they form. The circle through $(0,0)$, $(6,0)$ and $(0,8)$ has center $(3,4)$, the midpoint of the hypotenuse, and $r=5$: $(x-3)^2+(y-4)^2=25$. **The unit circle.** For $r=1$ and the center at the origin, $x^2+y^2=1$, and the points are $(\cos t,\sin t)$. Rational points also exist: $(\frac35,\frac45)$ is on it because $3^2+4^2=5^2$, the same [Pythagorean triple](https://nunada.my.id/articles/pythagorean-theorem/#pythagorean-triples) in disguise. ## How can a line, a point or another circle meet a circle? **Compare a distance with the radius: a line that is farther than $r$ from the center misses the circle, one at distance exactly $r$ is a tangent, and one closer than $r$ is a secant; two circles are decided the same way by the distance $d$ between their centers.** **A line and a circle.** Let $d$ be the distance from the center to the line. If $d>r$ there is no common point, if $d=r$ there is exactly one (the line is a tangent, and the point of contact is where the perpendicular from the center lands), and if $dr_1+r_2$ | apart, outside each other | | $d=r_1+r_2$ | touching from outside, one common point | | $\delta r2 else "tangent" if d2 == r2 else "secant" def sector(r, deg): # arc length, sector area, segment area t = radians(deg) return r * t, r * r * t / 2, r * r * (t - sin(t)) / 2 >>> c = (3, -2, 25) # center (3, -2) and the square of the radius, 25 >>> power(c, (0, 0)), power(c, (8, -2)), power(c, (9, 5)) (-12, 0, 60) >>> meets((0, 0, 25), 0, 1, 3), meets((0, 0, 25), 1, 0, 5), meets((0, 0, 25), 1, 0, 6) ('secant', 'tangent', 'none') >>> round(2 * pi * 7, 4), round(pi * 7 ** 2, 4) (43.9823, 153.938) >>> 22 / 7, 355 / 113, pi (3.142857142857143, 3.1415929203539825, 3.141592653589793) >>> sector(10, 90) (15.707963267948966, 78.53981633974483, 28.539816339744828) >>> sin(pi) # should be 0 ... 1.2246467991473532e-16 >>> cos(radians(3)) ** 2 + sin(radians(3)) ** 2 == 1 # ... and this should be exactly 1 False ``` ```javascript const r = 7 2 * Math.PI * r // 43.982297150257104 Math.PI * r ** 2 // 153.93804002589985 Math.sin(Math.PI) // 1.2246467991473532e-16, not 0 const power = ([h, k, r2], [x, y]) => (x - h) ** 2 + (y - k) ** 2 - r2 power([3, -2, 25], [9, 5]) // 60: outside, exact for whole numbers ``` ```cpp #include #include #include using namespace std; const double PI = acos(-1.0); // |PC|^2 - r^2: negative inside, 0 on the circle, positive outside int power(int h, int k, int r2, int x, int y) { return (x - h) * (x - h) + (y - k) * (y - k) - r2; } // the line a x + b y = c against the circle with center (h, k) and radius^2 = r2: // compare d^2 = (a h + b k - c)^2 / (a^2 + b^2) with r2, in whole numbers const char* meets(int h, int k, int r2, int a, int b, int c) { int num = (a * h + b * k - c) * (a * h + b * k - c); int rhs = r2 * (a * a + b * b); if (num > rhs) return "none"; if (num == rhs) return "tangent"; return "secant"; } int main() { cout << power(3, -2, 25, 0, 0) << " " << power(3, -2, 25, 8, -2) << " " << power(3, -2, 25, 9, 5) << endl; cout << meets(0, 0, 25, 0, 1, 3) << " " << meets(0, 0, 25, 1, 0, 5) << " " << meets(0, 0, 25, 1, 0, 6) << endl; printf("%.4f %.4f\n", 2 * PI * 7, PI * 7 * 7); // circumference and area, r = 7 printf("%.10f %.10f %.10f\n", 22.0 / 7, 355.0 / 113, PI); double r = 10, t = 90 * PI / 180; // a sector of 90 degrees printf("%.4f %.4f %.4f\n", r * t, r * r * t / 2, r * r * (t - sin(t)) / 2); // arc, sector, segment printf("%d\n", fabs(sin(PI)) < 1e-12); // sin(pi) is 1.2e-16, not 0 return 0; } /* output: -12 0 60 secant tangent none 43.9823 153.9380 3.1428571429 3.1415929204 3.1415926536 15.7080 78.5398 28.5398 1 */ ``` The pitfalls, in order of how often they bite: | Pitfall | What happens | What to do | |---|---|---| | Testing `xx + yy == r*r` with floats | rounding makes a point that is on the circle look off it | use whole numbers or `Fraction`, as in the article on [real numbers in code](https://nunada.my.id/articles/real-numbers/#real-numbers-in-code), or `math.isclose` | | `sin(pi)` and `cos(pi/2)` | they are about 1e-16, not 0 | never compare with 0; round or use a tolerance | | Degrees to `sin` and `cos` | `sin(30)` is not 0.5 | convert with `radians(30)` | | Using 3.14 or 22/7 for π | the answer is only as good as the approximation | use `math.pi` and round only the final answer | | Square root of a negative number | `sqrt(d2 - r2)` for a tangent length fails inside the circle | check that the power is positive first | | `acos` or `asin` of a rounded value | 1.0000000000000002 raises `ValueError` | clamp the argument to $[-1,1]$ | | Radius against diameter | the area uses `pi d d / 4`, not `pi * d ** 2` | name the variable `r` or `d` and keep to it | ## Where does the study of circles come from? **The circle is the oldest curve people studied, and the effort to find $\pi$ is among the longest in mathematics.** - **c. 1800 BCE.** Babylonian texts take the circumference to be three times the diameter, and later $3\frac18$. - **c. 1650 BCE.** Problem 50 of the Rhind Papyrus says that a round field of diameter 9 has the area of a square of side 8, which is $\pi\approx\left(\frac{16}{9}\right)^2\approx3.16$. - **c. 300 BCE.** Euclid's Elements, Book III, is the theory of circles: chords, tangents, the inscribed angle (III.20), the right angle in a semicircle (III.31) and the crossing chords (III.35, III.36). Book XII shows that the areas of circles are in the ratio of the squares of their diameters. - **c. 250 BCE.** Archimedes, in Measurement of a Circle, squeezes the circle between polygons with 96 sides and proves $3\frac{10}{71}<\pi<3\frac17$; he also shows that the area of a circle equals that of a right triangle with legs $r$ and $C$. - **c. 480 CE.** Zu Chongzhi in China finds $\frac{355}{113}$, correct to six decimals, a record that lasted nearly a thousand years. - **c. 1400.** Madhava of Sangamagrama finds an infinite series for $\pi$, the first of its kind. - **1706.** William Jones uses the Greek letter $\pi$ for the ratio, and Euler makes the symbol standard in the 1730s. - **1761 and 1882.** Lambert proves that $\pi$ is irrational and Lindemann that it is transcendental, so the circle cannot be squared with compass and straightedge. - **1873.** James Thomson coins the word radian for an idea Roger Cotes had described in 1714. ## What are the common mistakes with circles? **The most common mistakes with circles are the nine below, each with the correct statement.** | Mistake | Correct | |---|---| | ❌ The circumference is $\pi r^2$ | That is the area. The circumference is $2\pi r$. | | ❌ Putting the diameter into $\pi r^2$ | Halve it first: $r=\frac d2$, or use $\frac{\pi d^2}{4}$. | | ❌ $\pi$ equals $3.14$ or $\frac{22}{7}$ | Both are approximations; $\pi$ is irrational. | | ❌ The area is in cm, not cm² | Length is in cm, area in cm², volume in cm³. | | ❌ Arc length is $r\theta$ with $\theta$ in degrees | That needs radians; with degrees use $\frac{\theta}{360}\cdot2\pi r$. | | ❌ An inscribed angle equals the central angle | It is half of it. | | ❌ A tangent can cut the circle twice | A tangent has exactly one common point and is perpendicular to the radius. | | ❌ Some chord is longer than the diameter | The diameter is the longest chord. | | ❌ A calculator in the wrong mode | Radians against degrees: $\sin30$ is $0.5$ only in degree mode. | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: circles at a glance - **Definition:** all points at distance $r$ from the center $O$; diameter $d=2r$ is the longest chord; all circles are similar. - **Measures:** $C=2\pi r=\pi d$, $A=\pi r^2$; $\pi$ is irrational and transcendental. - **Arcs and sectors:** arc $=\frac{\theta}{360}\cdot2\pi r=r\theta$, sector $=\frac12r^2\theta$, segment $=\frac12r^2(\theta-\sin\theta)$; $180^\circ=\pi$ rad. - **Angles:** inscribed $=\frac12$ central; $90^\circ$ in a semicircle; opposite angles of a cyclic quadrilateral sum to $180^\circ$; a tangent is perpendicular to the radius. - **Lengths:** chord $=2\sqrt{r^2-d^2}$; tangent length $=\sqrt{OP^2-r^2}$; crossing chords $PA\cdot PB=PC\cdot PD$; $PT^2=PA\cdot PB$. - **Equation:** $(x-h)^2+(y-k)^2=r^2$, or $x^2+y^2+Dx+Ey+F=0$ with $r^2=\frac{D^2+E^2}{4}-F$. - **Position:** compare a distance with $r$ (point, line) or with $r_1\pm r_2$ (two circles). - **Code:** keep $r^2$ and compare squared distances exactly; `math.pi` and radians only at the end. ## Glossary: key terms - **Circle**: The set of all points in a plane that are the same distance from a fixed point called the center. - **Radius**: A segment from the center to a point on the circle, or its length, the distance that defines the circle. - **Diameter**: A chord that passes through the center, with length twice the radius, the longest chord of the circle. - **Chord**: A segment that joins two points on a circle. - **Arc**: The part of a circle between two of its points. - **Sector**: The region of a disk between two radii and the arc between their endpoints. - **Segment**: The region of a disk between a chord and the arc it cuts off. - **Tangent**: A line that touches a circle at exactly one point and is perpendicular to the radius there. - **Secant**: A line that meets a circle in two points. - **Circumference**: The length of the circle itself, equal to pi times the diameter. - **Pi**: The ratio of the circumference of any circle to its diameter, about 3.14159, an irrational and transcendental number. - **Central angle**: An angle whose vertex is the center of the circle, equal in degrees to the arc it cuts off. - **Inscribed angle**: An angle whose vertex is on the circle and whose sides are chords, equal to half the central angle on the same arc. - **Radian**: The central angle whose arc is as long as the radius, so that 180 degrees equals pi radians. - **Cyclic quadrilateral**: A quadrilateral whose four vertices lie on one circle, so that opposite angles add up to 180 degrees. ## Frequently asked questions ### What is a circle? A circle is the set of all points in a plane that are the same distance, the radius, from a fixed point, the center. The curve together with its inside is called a disk, and its area is pi times the radius squared. ### What is pi? Pi is the ratio of the circumference of any circle to its diameter, about 3.14159. It is the same for every circle because all circles are similar. It is irrational and transcendental, so it is not exactly 22 over 7 or 3.14. ### What are the formulas for the circumference and area of a circle? The circumference is 2 pi times the radius, which is pi times the diameter. The area is pi times the radius squared. For a radius of 7 the circumference is 14 pi, about 43.98, and the area is 49 pi, about 153.94. ### How do you find the length of an arc? Multiply the circumference by the fraction of the circle, the central angle in degrees divided by 360. In radians the arc is simply the radius times the angle. For radius 6 and 120 degrees the arc is one third of 12 pi, which is 4 pi. ### How do you find the area of a sector and a segment? A sector is the same fraction of the disk as its angle is of 360 degrees, so its area is that fraction times pi r squared. A segment is the sector minus the triangle formed by the two radii and the chord. ### What is a radian? A radian is the central angle whose arc is as long as the radius. A full turn is 2 pi radians, so 180 degrees equals pi radians and one radian is about 57.3 degrees. In radians the arc length is just radius times angle. ### What is the inscribed angle theorem? An inscribed angle, with its vertex on the circle, is half the central angle on the same arc. So all inscribed angles on one arc are equal, an angle in a semicircle is 90 degrees, and opposite angles of a cyclic quadrilateral add up to 180 degrees. ### What is Thales' theorem? If one side of a triangle is a diameter of its circumscribed circle, the angle opposite that side is a right angle. Equivalently, every angle inscribed in a semicircle is 90 degrees, and the circumcenter of a right triangle is the midpoint of its hypotenuse. ### What is a tangent to a circle? A tangent is a line that touches the circle at exactly one point and is perpendicular to the radius at that point. The two tangent segments from a point outside the circle have equal length, the square root of the squared distance to the center minus the squared radius. ### What is the equation of a circle? A circle with center h, k and radius r has the equation x minus h squared plus y minus k squared equals r squared. Expanded it becomes x squared plus y squared plus Dx plus Ey plus F equals 0, and completing the square returns the center and radius. ### How do you find the circle through three points? Three points that are not on one line lie on exactly one circle, the circumcircle of their triangle. Its center is where the perpendicular bisectors of the sides meet, and the radius is the distance from the center to any of the points. ### How do you tell whether a line is a tangent or a secant? Find the distance from the center to the line and compare it with the radius. If the distance is larger the line misses the circle, if it is equal the line is a tangent, and if it is smaller the line is a secant that cuts the circle twice. ### How do you check whether a point is inside a circle in code? Compute the squared distance from the point to the center and compare it with the squared radius, with no square root. Smaller means inside, equal means on the circle and larger means outside. Use integers or fractions, because float equality is unreliable. --- # Lingkaran: Keliling, Luas, Sudut, dan Persamaan Source: https://nunada.my.id/artikel/lingkaran/ Updated: 2026-10-10 ## Jawaban singkat **Lingkaran adalah himpunan semua titik pada bidang yang berjarak sama, yaitu jari-jari, dari sebuah titik tetap, yaitu pusat.** Kelilingnya $K=2\pi r$ dan cakram yang dibatasinya berluas $L=\pi r^2$, dengan $\pi\approx3{,}14159$ adalah perbandingan keliling terhadap diameter. Sudut keliling adalah setengah sudut pusat pada busur yang sama, garis singgung tegak lurus jari-jari, dan lingkaran berpusat $(h,k)$ memiliki persamaan $(x-h)^2+(y-k)^2=r^2$. ### Poin penting - Setiap titik pada lingkaran berjarak $r$ dari pusat; diameter $d=2r$ adalah tali busur terpanjang, dan semua lingkaran sebangun, itulah sebabnya $\pi=\frac Kd$ sama untuk setiap lingkaran. - Keliling $K=2\pi r$ dan luas $L=\pi r^2$; $\pi$ irasional dan transendental, sehingga $3{,}14$, $\frac{22}{7}$, dan $\frac{355}{113}$ hanyalah hampiran. - Sudut pusat $\theta$ memotong bagian $\frac{\theta}{360}$ dari lingkaran: busur $=\frac{\theta}{360}\cdot2\pi r=r\theta$ dalam radian, juring $=\frac12r^2\theta$, dan $180^\circ=\pi$ radian. - Sudut keliling adalah setengah sudut pusat pada busur yang sama; sehingga sudut dalam setengah lingkaran adalah $90^\circ$ (Thales) dan sudut berhadapan segiempat tali busur berjumlah $180^\circ$. - Garis singgung tegak lurus jari-jari, kedua garis singgung dari titik di luar sama panjang dengan panjang $\sqrt{OP^2-r^2}$, dan untuk tali busur yang berpotongan $PA\cdot PB=PC\cdot PD$. - Lingkaran berpusat $(h,k)$ dan berjari-jari $r$ adalah $(x-h)^2+(y-k)^2=r^2$; membandingkan kuadrat jarak dengan $r^2$ menentukan apakah titik berada di dalam, pada, atau di luar, dan garis atau lingkaran lain dapat diuji dengan cara yang sama. ## Apa itu lingkaran? **Lingkaran adalah himpunan semua titik pada bidang yang berjarak sama, yang disebut jari-jari, dari satu titik tetap, yang disebut pusat.** Lingkaran hanyalah kurvanya; kurva beserta bagian dalamnya adalah cakram, dan dalam bahasa sehari-hari "luas lingkaran" berarti luas cakram. | Unsur | Arti | |---|---| | Pusat | titik tetap $O$ | | Jari-jari | ruas garis dari pusat ke lingkaran; panjangnya $r$ | | Diameter | tali busur yang melalui pusat; panjangnya $d=2r$, tali busur terpanjang | | Tali busur | ruas garis yang menghubungkan dua titik pada lingkaran | | Busur | bagian lingkaran di antara dua titik | | Juring | daerah di antara dua jari-jari dan busur di antaranya, seperti potongan pizza | | Tembereng | daerah di antara tali busur dan busurnya | | Garis potong | garis yang melalui dua titik pada lingkaran | | Garis singgung | garis yang menyentuh lingkaran di tepat satu titik | | Keliling | panjang lingkaran itu sendiri | Lingkaran sangat simetris: setiap garis melalui pusat adalah sumbu simetri, dan memutar lingkaran dengan sudut berapa pun terhadap pusat tidak mengubahnya. Ia juga sebangun dengan setiap lingkaran lain, karena yang satu adalah salinan berskala dari yang lain (gagasan yang sama dengan [segitiga sebangun](https://nunada.my.id/artikel/segitiga/#congruence-similarity)). Itulah alasan perbandingan keliling terhadap diameter adalah satu bilangan untuk semua lingkaran. *Lingkaran dengan pusat O, jari-jari r, diameter d (putus-putus), tali busur, dan garis singgung yang menyentuhnya di bagian bawah.* ## Apa itu π, dan bagaimana mencari keliling dan luas lingkaran? **Bilangan $\pi\approx3{,}14159$ adalah perbandingan keliling lingkaran mana pun terhadap diameternya, sehingga keliling adalah $K=\pi d=2\pi r$, dan luas cakram adalah $L=\pi r^2$.** | Diketahui | Keliling | Luas | |---|---|---| | jari-jari $r$ | $2\pi r$ | $\pi r^2$ | | diameter $d$ | $\pi d$ | $\frac{\pi d^2}{4}$ | | keliling $K$ | $K$ | $\frac{K^2}{4\pi}$ | | luas $L$ | $2\sqrt{\pi L}$ | $L$ | **Mengapa $\pi r^2$?** Potong cakram menjadi banyak juring tipis dan letakkan berdampingan, bergantian menghadap ke atas dan ke bawah. Bentuknya makin menyerupai persegi panjang ketika irisannya makin tipis. Tingginya $r$ dan lebarnya setengah keliling, $\pi r$, sehingga luasnya $\pi r\cdot r=\pi r^2$. Untuk $r=7$ kelilingnya $14\pi\approx43{,}98$ dan luasnya $49\pi\approx153{,}94$. Biarkan $\pi$ sebagai simbol selama mungkin: jawaban "$49\pi$" eksak, sedangkan $153{,}94$ sudah dibulatkan. Cincin (anulus) di antara jari-jari $R$ dan $r$ berluas $\pi R^2-\pi r^2=\pi(R-r)(R+r)$; untuk $R=10$ dan $r=6$ itu $64\pi\approx201{,}06$. **Bilangan jenis apa $\pi$?** Ia irasional, sehingga tidak ada pecahan yang sama dengannya, dan transendental, sehingga ia bukan penyelesaian persamaan polinom mana pun dengan koefisien bilangan bulat, fakta yang mengakhiri teka-teki lama tentang mengkuadratkan lingkaran; lihat [pi, e, dan bilangan transendental](https://nunada.my.id/artikel/bilangan-irasional/#pi-e-transcendental). Angka-angka pertamanya $3{,}14159\,26535\,89793$. Pecahan yang berguna berasal dari [hampiran rasional](https://nunada.my.id/artikel/bilangan-irasional/#rational-approximations): $3{,}14$ meleset $0{,}05\%$, $\frac{22}{7}\approx3{,}142857$ meleset $0{,}04\%$, dan $\frac{355}{113}\approx3{,}1415929$ meleset kurang dari $0{,}00001\%$. Soal cerita: sebuah kolam bundar berdiameter $14$ m akan dipagari, dengan $\pi\approx\frac{22}{7}$. Panjang pagar $K=\frac{22}{7}\cdot14=44$ m, dan dengan harga Rp50.000 per meter biayanya 44 kali Rp50.000, yaitu Rp2.200.000. Archimedes menemukan batas-batas $\pi$ dengan mengapit lingkaran di antara dua segibanyak. Alat di bawah mengulangi penggandaannya, dari segienam sampai segibanyak dengan ribuan sisi. ## Bagaimana mencari panjang busur, luas juring, dan luas tembereng? **Sudut pusat $\theta$ memotong bagian $\frac{\theta}{360}$ dari lingkaran, sehingga busur adalah bagian itu dari keliling dan juring adalah bagian itu dari cakram; tembereng adalah juring dikurangi segitiga yang dibentuk kedua jari-jari dan tali busur.** | Besaran | $\theta$ dalam derajat | $\theta$ dalam radian | |---|---|---| | Panjang busur | $\frac{\theta}{360}\cdot2\pi r$ | $r\theta$ | | Luas juring | $\frac{\theta}{360}\cdot\pi r^2$ | $\frac12r^2\theta$ | | Panjang tali busur | $2r\sin\frac{\theta}{2}$ | $2r\sin\frac{\theta}{2}$ | | Luas tembereng | juring $-$ segitiga | $\frac12r^2(\theta-\sin\theta)$ | **Radian.** Satu radian adalah sudut pusat yang busurnya tepat sepanjang jari-jari. Satu putaran penuh memiliki $\frac{2\pi r}{r}=2\pi$ radian, sehingga $180^\circ=\pi$ rad dan $1\text{ rad}\approx57{,}2958^\circ$. Dalam radian busur cukup $r\theta$, itulah sebabnya matematika lebih menyukainya. | Derajat | $30^\circ$ | $45^\circ$ | $60^\circ$ | $90^\circ$ | $180^\circ$ | $360^\circ$ | |---|---|---|---|---|---|---| | Radian | $\frac{\pi}{6}$ | $\frac{\pi}{4}$ | $\frac{\pi}{3}$ | $\frac{\pi}{2}$ | $\pi$ | $2\pi$ | **Contoh.** Untuk $r=6$ dan $\theta=120^\circ$ bagiannya $\frac13$, sehingga busurnya $\frac13\cdot12\pi=4\pi\approx12{,}57$ dan juringnya $\frac13\cdot36\pi=12\pi\approx37{,}70$. Ini adalah [perkalian pecahan](https://nunada.my.id/artikel/bilangan-rasional/#multiply-divide-fractions) dengan $\pi$ yang ikut terbawa. Untuk $r=10$ dan $\theta=90^\circ$: busur $5\pi\approx15{,}71$, juring $25\pi\approx78{,}54$, tali busur $10\sqrt2\approx14{,}14$, dan tembereng $25\pi-50\approx28{,}54$, karena segitiganya berluas $\frac12\cdot10\cdot10=50$. Pilih jari-jari (atau salah satu dari tiga besaran lain) dan geser sudutnya di bawah. ## Apa saja teorema sudut pada lingkaran? **Sudut keliling (titik sudut berada pada lingkaran) adalah setengah sudut pusat pada busur yang sama, dan dari satu teorema ini lahir sudut siku-siku dalam setengah lingkaran, sudut sama besar pada busur yang sama, serta $180^\circ$ pada segiempat tali busur.** - **Sudut pusat.** Sudut di pusat besarnya sama, dalam derajat, dengan busur yang dipotongnya. - **Teorema sudut keliling.** Sudut $\angle APB$ dengan $P$ pada lingkaran adalah setengah sudut pusat $\angle AOB$ pada busur yang sama: sudut pusat $120^\circ$ memberi sudut keliling $60^\circ$. - **Busur yang sama.** Sudut keliling pada busur yang sama sama besar, ke mana pun $P$ bergerak pada bagian lingkaran yang lain. - **Thales.** Jika $AB$ diameter, busurnya $180^\circ$, sehingga setiap sudut keliling $\angle APB$ adalah $90^\circ$. Kebalikannya adalah fakta bahwa pusat lingkaran luar segitiga siku-siku adalah titik tengah hipotenusanya, seperti pada [titik-titik penting segitiga](https://nunada.my.id/artikel/segitiga/#centers). - **Segiempat tali busur.** Jika keempat titik sudut terletak pada lingkaran, sudut berhadapan berjumlah $180^\circ$, karena keduanya setengah dari dua busur yang bersama-sama membentuk $360^\circ$. Dengan $\angle A=75^\circ$ sudut di hadapannya $\angle C=105^\circ$. Teorema Ptolemaios dan rumus luas Brahmagupta dalam [sejarah segiempat](https://nunada.my.id/artikel/segiempat/#history) berkaitan dengan bangun ini. - **Garis singgung dan jari-jari.** Garis singgung tegak lurus jari-jari di titik sentuhnya. - **Garis singgung dan tali busur.** Sudut antara garis singgung dan tali busur sama dengan sudut keliling di sisi lain tali busur (busur yang berseberangan). **Mengapa setengah?** Ambil kasus ketika salah satu kaki sudut melalui pusat. Segitiga $OPA$ sama kaki ($OP=OA=r$), sehingga sudut alasnya sama besar, dan sudut pusat adalah sudut luar segitiga itu, sama dengan jumlah kedua sudut alas, seperti pada [jumlah sudut dan sudut luar](https://nunada.my.id/artikel/segitiga/#angle-sum). Jadi sudut pusat dua kali sudut keliling. Kasus umum menambah atau mengurangkan dua kasus seperti itu. Geser keempat titik di bawah: sudut keliling pada sisi $AB$ yang sama tetap sama, dan pada sisi yang berlawanan berjumlah $180^\circ$. ## Apa saja aturan untuk tali busur, garis singgung, dan garis potong? **Garis tegak lurus dari pusat ke tali busur membagi tali busur itu menjadi dua sama panjang, garis singgung tegak lurus jari-jari, dan hasil kali potongan tali busur atau garis potong yang berpotongan sama; ketiganya berasal dari segitiga siku-siku yang dibentuk jari-jari.** - **Tali busur dan pusat.** Jika tali busur berjarak $d$ dari pusat, panjangnya $2\sqrt{r^2-d^2}$. Dengan $r=5$ dan $d=3$ panjangnya $2\sqrt{25-9}=8$, segitiga $3$–$4$–$5$ dari [teorema Pythagoras](https://nunada.my.id/artikel/teorema-pythagoras/#what-is-the-theorem). Tali busur yang sama panjang berjarak sama dari pusat, dan makin dekat tali busur ke pusat makin panjang ia; diameter ($d=0$) yang terpanjang. - **Dua garis singgung.** Dari titik $P$ di luar lingkaran ada dua garis singgung, dan kedua ruas garis singgung sama panjang, $\sqrt{OP^2-r^2}$. Dengan $r=5$ dan $OP=13$ panjangnya $\sqrt{169-25}=12$, segitiga $5$–$12$–$13$. - **Tali busur berpotongan.** Jika dua tali busur $AB$ dan $CD$ berpotongan di $P$ di dalam lingkaran, maka $PA\cdot PB=PC\cdot PD$. Untuk $PA=3$, $PB=8$, dan $PC=4$ diperoleh $PD=6$, karena $3\cdot8=4\cdot6=24$. - **Garis potong dan garis singgung.** Dari titik $P$ di luar, dua garis potong memberi $PA\cdot PB=PC\cdot PD$, dan garis singgung $PT$ serta garis potong memberi $PT^2=PA\cdot PB$. Untuk garis singgung $12$ di atas dan garis potong melalui pusat, $PA=13-5=8$ dan $PB=13+5=18$, dan $8\cdot18=144=12^2$. Semuanya menyatakan satu hal: bilangan $|PO|^2-r^2$, yaitu kuasa titik $P$, negatif di dalam lingkaran, nol pada lingkaran, dan positif di luar, dan untuk setiap garis melalui $P$ yang memotong lingkaran di $A$ dan $B$ hasil kali $PA\cdot PB$ sama dengan nilai mutlaknya. Bentuk akar seperti $2\sqrt{r^2-d^2}$ sering paling baik dibiarkan dalam [bentuk sederhana](https://nunada.my.id/artikel/eksponen-dan-akar/#simplify-radicals). ## Apa persamaan lingkaran? **Lingkaran berpusat $(h,k)$ dan berjari-jari $r$ adalah himpunan titik $(x,y)$ dengan $(x-h)^2+(y-k)^2=r^2$, karena itu menyatakan bahwa kuadrat jarak ke pusat adalah $r^2$.** Untuk pusat $(3,-2)$ dan $r=5$ persamaannya $(x-3)^2+(y+2)^2=25$. Menjabarkannya (lihat [menjabarkan kurung](https://nunada.my.id/artikel/bentuk-aljabar/#expand)) memberi bentuk umum $x^2+y^2+Dx+Ey+F=0$ dengan $D=-2h$, $E=-2k$, dan $F=h^2+k^2-r^2$. Lingkaran kita adalah $x^2+y^2-6x+4y-12=0$. Untuk kembali, lengkapkan kuadrat pada $x$ dan $y$: $x^2-6x=(x-3)^2-9$ dan $y^2+4y=(y+2)^2-4$, sehingga $(x-3)^2+(y+2)^2=12+9+4=25$. Bentuk umum menggambarkan lingkaran nyata hanya bila $r^2=\frac{D^2}{4}+\frac{E^2}{4}-F$ positif. **Di mana letak sebuah titik?** Bandingkan kuadrat jarak $(x-h)^2+(y-k)^2$ dengan $r^2$: lebih kecil berarti di dalam, sama berarti pada lingkaran, lebih besar berarti di luar. Untuk lingkaran di atas, $(0,0)$ memberi $13<25$ (di dalam), $(8,-2)$ memberi $25$ (pada lingkaran), dan $(9,5)$ memberi $85>25$ (di luar). **Melalui tiga titik.** Tiga titik yang tidak segaris terletak pada tepat satu lingkaran, lingkaran luar segitiga yang dibentuknya. Lingkaran melalui $(0,0)$, $(6,0)$, dan $(0,8)$ berpusat di $(3,4)$, titik tengah hipotenusa, dan $r=5$: $(x-3)^2+(y-4)^2=25$. **Lingkaran satuan.** Untuk $r=1$ dengan pusat di titik asal, $x^2+y^2=1$, dan titik-titiknya $(\cos t,\sin t)$. Ada juga titik rasional: $(\frac35,\frac45)$ terletak padanya karena $3^2+4^2=5^2$, [tripel Pythagoras](https://nunada.my.id/artikel/teorema-pythagoras/#pythagorean-triples) yang sama dalam samaran. ## Bagaimana garis, titik, atau lingkaran lain dapat bertemu sebuah lingkaran? **Bandingkan sebuah jarak dengan jari-jari: garis yang berjarak lebih dari $r$ dari pusat tidak memotong lingkaran, garis yang berjarak tepat $r$ adalah garis singgung, dan garis yang berjarak kurang dari $r$ adalah garis potong; dua lingkaran ditentukan dengan cara yang sama oleh jarak $d$ antara pusatnya.** **Garis dan lingkaran.** Misalkan $d$ jarak dari pusat ke garis. Jika $d>r$ tidak ada titik persekutuan, jika $d=r$ ada tepat satu (garis adalah garis singgung, dan titik sentuhnya adalah tempat jatuhnya garis tegak lurus dari pusat), dan jika $dr_1+r_2$ | saling lepas, di luar satu sama lain | | $d=r_1+r_2$ | bersinggungan di luar, satu titik persekutuan | | $\delta r2 else "tangent" if d2 == r2 else "secant" def sector(r, deg): # arc length, sector area, segment area t = radians(deg) return r * t, r * r * t / 2, r * r * (t - sin(t)) / 2 >>> c = (3, -2, 25) # center (3, -2) and the square of the radius, 25 >>> power(c, (0, 0)), power(c, (8, -2)), power(c, (9, 5)) (-12, 0, 60) >>> meets((0, 0, 25), 0, 1, 3), meets((0, 0, 25), 1, 0, 5), meets((0, 0, 25), 1, 0, 6) ('secant', 'tangent', 'none') >>> round(2 * pi * 7, 4), round(pi * 7 ** 2, 4) (43.9823, 153.938) >>> 22 / 7, 355 / 113, pi (3.142857142857143, 3.1415929203539825, 3.141592653589793) >>> sector(10, 90) (15.707963267948966, 78.53981633974483, 28.539816339744828) >>> sin(pi) # should be 0 ... 1.2246467991473532e-16 >>> cos(radians(3)) ** 2 + sin(radians(3)) ** 2 == 1 # ... and this should be exactly 1 False ``` ```javascript const r = 7 2 * Math.PI * r // 43.982297150257104 Math.PI * r ** 2 // 153.93804002589985 Math.sin(Math.PI) // 1.2246467991473532e-16, not 0 const power = ([h, k, r2], [x, y]) => (x - h) ** 2 + (y - k) ** 2 - r2 power([3, -2, 25], [9, 5]) // 60: outside, exact for whole numbers ``` ```cpp #include #include #include using namespace std; const double PI = acos(-1.0); // |PC|^2 - r^2: negative inside, 0 on the circle, positive outside int power(int h, int k, int r2, int x, int y) { return (x - h) * (x - h) + (y - k) * (y - k) - r2; } // the line a x + b y = c against the circle with center (h, k) and radius^2 = r2: // compare d^2 = (a h + b k - c)^2 / (a^2 + b^2) with r2, in whole numbers const char* meets(int h, int k, int r2, int a, int b, int c) { int num = (a * h + b * k - c) * (a * h + b * k - c); int rhs = r2 * (a * a + b * b); if (num > rhs) return "none"; if (num == rhs) return "tangent"; return "secant"; } int main() { cout << power(3, -2, 25, 0, 0) << " " << power(3, -2, 25, 8, -2) << " " << power(3, -2, 25, 9, 5) << endl; cout << meets(0, 0, 25, 0, 1, 3) << " " << meets(0, 0, 25, 1, 0, 5) << " " << meets(0, 0, 25, 1, 0, 6) << endl; printf("%.4f %.4f\n", 2 * PI * 7, PI * 7 * 7); // circumference and area, r = 7 printf("%.10f %.10f %.10f\n", 22.0 / 7, 355.0 / 113, PI); double r = 10, t = 90 * PI / 180; // a sector of 90 degrees printf("%.4f %.4f %.4f\n", r * t, r * r * t / 2, r * r * (t - sin(t)) / 2); // arc, sector, segment printf("%d\n", fabs(sin(PI)) < 1e-12); // sin(pi) is 1.2e-16, not 0 return 0; } /* output: -12 0 60 secant tangent none 43.9823 153.9380 3.1428571429 3.1415929204 3.1415926536 15.7080 78.5398 28.5398 1 */ ``` Jebakannya, berdasarkan seberapa sering terjadi: | Jebakan | Yang terjadi | Yang sebaiknya dilakukan | |---|---|---| | Menguji `xx + yy == r*r` dengan float | pembulatan membuat titik pada lingkaran tampak di luarnya | pakai bilangan bulat atau `Fraction`, seperti pada artikel [bilangan real dalam kode](https://nunada.my.id/artikel/bilangan-real/#real-numbers-in-code), atau `math.isclose` | | `sin(pi)` dan `cos(pi/2)` | hasilnya sekitar 1e-16, bukan 0 | jangan dibandingkan dengan 0; bulatkan atau pakai toleransi | | Derajat ke `sin` dan `cos` | `sin(30)` bukan 0,5 | ubah dengan `radians(30)` | | Memakai 3,14 atau 22/7 untuk π | jawabannya hanya sebaik hampirannya | pakai `math.pi` dan bulatkan hanya jawaban akhir | | Akar bilangan negatif | `sqrt(d2 - r2)` untuk panjang garis singgung gagal di dalam lingkaran | periksa dulu bahwa kuasanya positif | | `acos` atau `asin` dari nilai yang dibulatkan | `1.0000000000000002` memunculkan `ValueError` | batasi argumen pada $[-1,1]$ | | Jari-jari dan diameter tertukar | luasnya `pi d d / 4`, bukan `pi * d ** 2` | beri nama variabel `r` atau `d` dan konsisten | ## Dari mana asal ilmu tentang lingkaran? **Lingkaran adalah kurva tertua yang dipelajari manusia, dan upaya mencari $\pi$ termasuk yang terpanjang dalam matematika.** - **Sekitar 1800 SM.** Teks Babilonia menganggap keliling sama dengan tiga kali diameter, dan kemudian $3\frac18$. - **Sekitar 1650 SM.** Soal 50 Papirus Rhind mengatakan bahwa ladang bundar berdiameter 9 berluas sama dengan persegi bersisi 8, yaitu $\pi\approx\left(\frac{16}{9}\right)^2\approx3{,}16$. - **Sekitar 300 SM.** Elements Euclid, Buku III, adalah teori lingkaran: tali busur, garis singgung, sudut keliling (III.20), sudut siku-siku dalam setengah lingkaran (III.31), dan tali busur yang berpotongan (III.35, III.36). Buku XII menunjukkan bahwa luas lingkaran berperbandingan seperti kuadrat diameternya. - **Sekitar 250 SM.** Archimedes, dalam Measurement of a Circle, mengapit lingkaran di antara segibanyak bersisi 96 dan membuktikan $3\frac{10}{71}<\pi<3\frac17$; ia juga menunjukkan bahwa luas lingkaran sama dengan luas segitiga siku-siku dengan sisi tegak $r$ dan $K$. - **Sekitar 480 M.** Zu Chongzhi di Tiongkok menemukan $\frac{355}{113}$, benar sampai enam desimal, rekor yang bertahan hampir seribu tahun. - **Sekitar 1400.** Madhava dari Sangamagrama menemukan deret tak hingga untuk $\pi$, yang pertama dari jenisnya. - **1706.** William Jones memakai huruf Yunani $\pi$ untuk perbandingan itu, dan Euler menjadikan simbol itu baku pada 1730-an. - **1761 dan 1882.** Lambert membuktikan bahwa $\pi$ irasional dan Lindemann bahwa ia transendental, sehingga lingkaran tidak dapat dikuadratkan dengan jangka dan penggaris. - **1873.** James Thomson menciptakan kata radian untuk gagasan yang telah dijelaskan Roger Cotes pada 1714. ## Apa kesalahan umum pada lingkaran? **Kesalahan paling umum pada lingkaran adalah sembilan hal berikut, masing-masing dengan pernyataan yang benar.** | Kesalahan | Yang benar | |---|---| | ❌ Keliling adalah $\pi r^2$ | Itu luas. Keliling adalah $2\pi r$. | | ❌ Memasukkan diameter ke $\pi r^2$ | Bagi dua dulu: $r=\frac d2$, atau pakai $\frac{\pi d^2}{4}$. | | ❌ $\pi$ sama dengan $3{,}14$ atau $\frac{22}{7}$ | Keduanya hampiran; $\pi$ irasional. | | ❌ Luas dalam cm, bukan cm² | Panjang dalam cm, luas dalam cm², volume dalam cm³. | | ❌ Panjang busur $r\theta$ dengan $\theta$ dalam derajat | Itu membutuhkan radian; dengan derajat pakai $\frac{\theta}{360}\cdot2\pi r$. | | ❌ Sudut keliling sama dengan sudut pusat | Ia setengahnya. | | ❌ Garis singgung dapat memotong lingkaran dua kali | Garis singgung memiliki tepat satu titik persekutuan dan tegak lurus jari-jari. | | ❌ Ada tali busur yang lebih panjang daripada diameter | Diameter adalah tali busur terpanjang. | | ❌ Kalkulator pada mode yang salah | Radian atau derajat tertukar: $\sin30$ bernilai $0{,}5$ hanya pada mode derajat. | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: lingkaran sekilas - **Definisi:** semua titik berjarak $r$ dari pusat $O$; diameter $d=2r$ adalah tali busur terpanjang; semua lingkaran sebangun. - **Ukuran:** $K=2\pi r=\pi d$, $L=\pi r^2$; $\pi$ irasional dan transendental. - **Busur dan juring:** busur $=\frac{\theta}{360}\cdot2\pi r=r\theta$, juring $=\frac12r^2\theta$, tembereng $=\frac12r^2(\theta-\sin\theta)$; $180^\circ=\pi$ rad. - **Sudut:** sudut keliling $=\frac12$ sudut pusat; $90^\circ$ dalam setengah lingkaran; sudut berhadapan segiempat tali busur berjumlah $180^\circ$; garis singgung tegak lurus jari-jari. - **Panjang:** tali busur $=2\sqrt{r^2-d^2}$; panjang garis singgung $=\sqrt{OP^2-r^2}$; tali busur berpotongan $PA\cdot PB=PC\cdot PD$; $PT^2=PA\cdot PB$. - **Persamaan:** $(x-h)^2+(y-k)^2=r^2$, atau $x^2+y^2+Dx+Ey+F=0$ dengan $r^2=\frac{D^2+E^2}{4}-F$. - **Kedudukan:** bandingkan jarak dengan $r$ (titik, garis) atau dengan $r_1\pm r_2$ (dua lingkaran). - **Kode:** simpan $r^2$ dan bandingkan kuadrat jarak secara eksak; `math.pi` dan radian hanya di akhir. ## Glosarium: istilah penting - **Lingkaran**: Himpunan semua titik pada bidang yang berjarak sama dari sebuah titik tetap yang disebut pusat. - **Jari-jari**: Ruas garis dari pusat ke sebuah titik pada lingkaran, atau panjangnya, jarak yang mendefinisikan lingkaran. - **Diameter**: Tali busur yang melalui pusat, dengan panjang dua kali jari-jari, tali busur terpanjang pada lingkaran. - **Tali busur**: Ruas garis yang menghubungkan dua titik pada lingkaran. - **Busur**: Bagian lingkaran di antara dua titiknya. - **Juring**: Daerah cakram di antara dua jari-jari dan busur di antara ujung-ujungnya. - **Tembereng**: Daerah cakram di antara tali busur dan busur yang dipotongnya. - **Garis singgung**: Garis yang menyentuh lingkaran di tepat satu titik dan tegak lurus jari-jari di titik itu. - **Garis potong**: Garis yang memotong lingkaran di dua titik. - **Keliling lingkaran**: Panjang lingkaran itu sendiri, sama dengan pi kali diameter. - **Pi**: Perbandingan keliling lingkaran mana pun terhadap diameternya, sekitar 3,14159, bilangan irasional dan transendental. - **Sudut pusat**: Sudut yang titik sudutnya adalah pusat lingkaran, besarnya dalam derajat sama dengan busur yang dipotongnya. - **Sudut keliling**: Sudut yang titik sudutnya pada lingkaran dan sisinya tali busur, sama dengan setengah sudut pusat pada busur yang sama. - **Radian**: Sudut pusat yang busurnya sepanjang jari-jari, sehingga 180 derajat sama dengan pi radian. - **Segiempat tali busur**: Segiempat yang keempat titik sudutnya terletak pada satu lingkaran, sehingga sudut berhadapan berjumlah 180 derajat. ## Pertanyaan yang sering diajukan ### Apa itu lingkaran? Lingkaran adalah himpunan semua titik pada bidang yang berjarak sama, yaitu jari-jari, dari sebuah titik tetap, yaitu pusat. Kurva beserta bagian dalamnya disebut cakram, dan luasnya pi kali jari-jari kuadrat. ### Apa itu pi? Pi adalah perbandingan keliling lingkaran mana pun terhadap diameternya, sekitar 3,14159. Nilainya sama untuk setiap lingkaran karena semua lingkaran sebangun. Ia irasional dan transendental, sehingga tidak tepat 22 per 7 atau 3,14. ### Apa rumus keliling dan luas lingkaran? Keliling adalah 2 pi kali jari-jari, yaitu pi kali diameter. Luasnya pi kali jari-jari kuadrat. Untuk jari-jari 7 kelilingnya 14 pi, sekitar 43,98, dan luasnya 49 pi, sekitar 153,94. ### Bagaimana mencari panjang busur? Kalikan keliling dengan bagian lingkaran, yaitu sudut pusat dalam derajat dibagi 360. Dalam radian busur cukup jari-jari kali sudut. Untuk jari-jari 6 dan 120 derajat busurnya sepertiga dari 12 pi, yaitu 4 pi. ### Bagaimana mencari luas juring dan tembereng? Juring adalah bagian cakram yang sama dengan besar sudutnya terhadap 360 derajat, sehingga luasnya bagian itu kali pi r kuadrat. Tembereng adalah juring dikurangi segitiga yang dibentuk kedua jari-jari dan tali busur. ### Apa itu radian? Radian adalah sudut pusat yang busurnya sepanjang jari-jari. Satu putaran penuh adalah 2 pi radian, sehingga 180 derajat sama dengan pi radian dan satu radian sekitar 57,3 derajat. Dalam radian panjang busur cukup jari-jari kali sudut. ### Apa itu teorema sudut keliling? Sudut keliling, dengan titik sudut pada lingkaran, adalah setengah sudut pusat pada busur yang sama. Jadi semua sudut keliling pada satu busur sama besar, sudut dalam setengah lingkaran adalah 90 derajat, dan sudut berhadapan segiempat tali busur berjumlah 180 derajat. ### Apa itu teorema Thales? Jika satu sisi segitiga adalah diameter lingkaran luarnya, sudut di depan sisi itu adalah sudut siku-siku. Dengan kata lain, setiap sudut keliling dalam setengah lingkaran adalah 90 derajat, dan pusat lingkaran luar segitiga siku-siku adalah titik tengah hipotenusanya. ### Apa itu garis singgung lingkaran? Garis singgung adalah garis yang menyentuh lingkaran di tepat satu titik dan tegak lurus jari-jari di titik itu. Kedua ruas garis singgung dari titik di luar lingkaran sama panjang, yaitu akar dari kuadrat jarak ke pusat dikurangi kuadrat jari-jari. ### Apa persamaan lingkaran? Lingkaran berpusat h, k dan berjari-jari r memiliki persamaan x dikurang h kuadrat ditambah y dikurang k kuadrat sama dengan r kuadrat. Dijabarkan, ia menjadi x kuadrat ditambah y kuadrat ditambah Dx ditambah Ey ditambah F sama dengan 0, dan melengkapkan kuadrat mengembalikan pusat dan jari-jari. ### Bagaimana mencari lingkaran melalui tiga titik? Tiga titik yang tidak segaris terletak pada tepat satu lingkaran, lingkaran luar segitiganya. Pusatnya adalah tempat sumbu-sumbu sisi bertemu, dan jari-jarinya adalah jarak dari pusat ke salah satu titik itu. ### Bagaimana mengetahui garis singgung atau garis potong? Cari jarak dari pusat ke garis dan bandingkan dengan jari-jari. Jika jaraknya lebih besar garis tidak memotong lingkaran, jika sama garis adalah garis singgung, dan jika lebih kecil garis adalah garis potong yang memotong lingkaran dua kali. ### Bagaimana memeriksa titik di dalam lingkaran dalam kode? Hitung kuadrat jarak dari titik ke pusat dan bandingkan dengan kuadrat jari-jari, tanpa akar. Lebih kecil berarti di dalam, sama berarti pada lingkaran, dan lebih besar berarti di luar. Pakai bilangan bulat atau pecahan, karena kesamaan float tidak dapat diandalkan. --- # Triangles: Types, Angles, Area, Centers and Congruence Source: https://nunada.my.id/articles/triangles/ Updated: 2026-10-29 ## Quick answer **A triangle is a closed shape with three straight sides, three vertices and three interior angles that always add up to 180°.** Triangles are sorted by their sides (equilateral, isosceles, scalene) and by their angles (acute, right, obtuse). Three lengths form a triangle only if the longest is shorter than the other two together. The area is half the base times the height, and the law of sines and cosines links its sides and angles. ### Key takeaways - The interior angles of every triangle add up to $180^\circ$, so a triangle has at most one right or obtuse angle, and an exterior angle equals the sum of the two interior angles not next to it. - Three lengths make a triangle only if each is shorter than the sum of the other two; the longest side then decides the type: $c^2$ obtuse. - A right triangle has its hypotenuse opposite the right angle, and the $45^\circ$–$45^\circ$–$90^\circ$ and $30^\circ$–$60^\circ$–$90^\circ$ triangles have sides in the fixed ratios $1:1:\sqrt2$ and $1:\sqrt3:2$. - Area is $\frac12bh$; with three sides use Heron's formula $\sqrt{s(s-a)(s-b)(s-c)}$, with two sides and the angle between them $\frac12ab\sin C$, and with coordinates the shoelace formula. - The four centers are the centroid (medians, 2:1), circumcenter (perpendicular bisectors), orthocenter (altitudes) and incenter (angle bisectors); the first three lie on the Euler line. - Triangles are congruent by SSS, SAS, ASA, AAS or RHS and similar by AA; to solve a triangle use the law of cosines and the law of sines, and beware the two-triangle SSA case. ## What is a triangle? **A triangle is a polygon with exactly three sides, three vertices (corners) and three interior angles.** It is the simplest polygon, and every other polygon can be cut into triangles: a diagonal splits a [quadrilateral](https://nunada.my.id/articles/quadrilaterals/#what-is-a-quadrilateral) into two. The Indonesian word is segitiga, "three-corner". We name a triangle by its vertices, $ABC$. The side opposite the vertex $A$ is written $a$ (it is $BC$), the side opposite $B$ is $b$ (it is $CA$) and the side opposite $C$ is $c$ (it is $AB$). The interior angles are $\angle A$, $\angle B$, $\angle C$. Any side can serve as the **base**. The **height** (or altitude) belonging to that base is the perpendicular distance from the opposite vertex to the line that holds the base. In an obtuse triangle this height falls outside the triangle, on the extension of the base. A triangle is rigid: its three side lengths fix its shape completely, so it cannot be pushed out of shape without breaking a side. A four-sided frame can lean into a parallelogram, a triangle cannot, which is why bridges, roof trusses, bicycle frames and camera tripods are built from triangles. *A triangle ABC. The dashed line is the height from C to the base AB, perpendicular to it.* ## Why do the angles of a triangle add up to 180°? **The three interior angles of every triangle add up to $180^\circ$, because a line through one vertex parallel to the opposite side makes the three angles fit together along a straight line.** Draw the line through $C$ parallel to $AB$. The two angles it makes with $CA$ and $CB$ are alternate angles with $\angle A$ and $\angle B$, so they are equal to them. Now $\angle A$, $\angle C$ and $\angle B$ sit side by side on the straight line through $C$, and a straight angle is $180^\circ$: $$\angle A+\angle B+\angle C=180^\circ.$$ Three consequences follow at once: - A triangle has at most one right angle or obtuse angle, since two of them would already use $180^\circ$ or more. - Knowing two angles gives the third: $50^\circ$ and $60^\circ$ leave $70^\circ$. - The **exterior angle** at $C$, formed by extending $AC$ past $C$ (or $BC$), equals $\angle A+\angle B$, the sum of the two interior angles not next to it, because both it and $\angle C$ are what is left of $180^\circ$. With $\angle A=50^\circ$ and $\angle B=60^\circ$ the exterior angle at $C$ is $110^\circ$. This is also where the $360^\circ$ of a [quadrilateral](https://nunada.my.id/articles/quadrilaterals/#angle-sum) comes from: two triangles. If three angles are in the ratio $1:2:3$, call them $x,2x,3x$ as in [turning words into algebra](https://nunada.my.id/articles/algebraic-expressions/#words-to-algebra): $6x=180$, so $x=30^\circ$ and the angles are $30^\circ,60^\circ,90^\circ$, a right triangle. *The dashed line through C is parallel to AB. The angles it makes with CA and CB equal the angles at A and B, so the three angles at C add up to a straight angle.* ## What are the types of triangles? **Triangles are sorted in two independent ways: by their sides (equilateral, isosceles, scalene) and by their largest angle (acute, right, obtuse), so every triangle has one name from each list.** | By sides | Definition | Example sides | |---|---|---| | Equilateral | all three sides equal; then all angles are $60^\circ$ | $5,5,5$ | | Isosceles | exactly two sides equal; the angles opposite them are equal | $5,5,6$ | | Scalene | all three sides different | $4,5,6$ | | By angles | Definition | Example sides | |---|---|---| | Acute | all three angles less than $90^\circ$ | $5,5,6$ | | Right | one angle equal to $90^\circ$ | $3,4,5$ | | Obtuse | one angle greater than $90^\circ$ | $2,3,4$ | Two rules link sides and angles. **Equal sides lie opposite equal angles**, and a longer side lies opposite a larger angle. So the longest side of a triangle is opposite its largest angle, and in a right triangle that side, the **hypotenuse**, is opposite the right angle. Not every pair of names can occur together. An equilateral triangle is always acute. An isosceles triangle can be acute ($5,5,6$), right ($1,1,\sqrt2$, the half of a square cut along its diagonal) or obtuse ($5,5,8$). A scalene triangle can be acute ($4,5,6$), right ($3,4,5$) or obtuse ($2,3,4$). To find the angle type without any angle, look at the longest side $c$ and compare $c^2$ with $a^2+b^2$: if $c^2a^2+b^2$ it is obtuse. For $2,3,4$: $16>4+9=13$, so it is obtuse. This is the [Pythagorean theorem](https://nunada.my.id/articles/pythagorean-theorem/#converse) and its two extensions, and the next sections use it. > **"Isosceles" depends on the book** > > **This article follows the school definition: an isosceles triangle has exactly two equal sides, so an equilateral triangle is not isosceles.** Many university texts say at least two equal sides, which makes every equilateral triangle isosceles as well. Both are consistent as long as you say which one you use. ## Can any three lengths form a triangle? **No: three lengths form a triangle only if each is shorter than the sum of the other two, which is the same as saying that the longest is shorter than the other two together.** This is the triangle inequality, and it says that a straight path is shorter than a detour: going from $A$ to $B$ directly is shorter than going through $C$, so $c1+2$, the short sides cannot even reach each other. The inequality also tells you how long the third side can be. If two sides are $a$ and $b$, the third side $c$ satisfies $|a-b|0$ (acute), $=0$ (right) or $<0$ (obtuse), which is the test in the section on types. The law of sines says that each side is proportional to the sine of the opposite angle (see [the article on the law of sines](https://nunada.my.id/articles/law-of-sines/) for the proof, the circle and the ambiguous case). | Given | How to solve | |---|---| | SSS: three sides | law of cosines for two angles, then $C=180^\circ-A-B$ | | SAS: two sides and the angle between | law of cosines for the third side, then SSS | | ASA or AAS: two angles and a side | $C=180^\circ-A-B$, then the law of sines for the other sides | | SSA: two sides and an angle opposite one of them | law of sines for the other angle: **0, 1 or 2 triangles** | **Examples.** SSS with $7,8,9$: $\cos A=\frac{64+81-49}{2\cdot8\cdot9}=\frac23$, so $A\approx48.19^\circ$; likewise $B\approx58.41^\circ$ and $C=180-48.19-58.41\approx73.40^\circ$. SAS with $a=5$, $b=8$ and $C=60^\circ$: $c^2=25+64-2\cdot5\cdot8\cdot\frac12=49$, so $c=7$. **The ambiguous case.** Take $a=3$, $b=5$ and $A=30^\circ$. The law of sines gives $\sin B=\frac{5\sin30^\circ}{3}=\frac56\approx0.8333$, and two angles have that sine, $B\approx56.44^\circ$ and $B\approx123.56^\circ$. Both leave a positive third angle ($93.56^\circ$ or $26.44^\circ$), so two triangles fit: with $c\approx5.99$ and with $c\approx2.67$. In general, with $A$ acute, side $a$ too short ($ac$, and compare $c^2$ with $a^2+b^2$.** Keep Heron's formula exact by computing the square of the area with `Fraction`, and use a root only at the very end. ```python from fractions import Fraction from math import sqrt, acos, degrees def kind(a, b, c): a, b, c = sorted((a, b, c)) if a + b <= c: return "not a triangle" sides = {1: "equilateral", 2: "isosceles", 3: "scalene"}[len({a, b, c})] d = a * a + b * b - c * c # the sign of the cosine of the largest angle return sides + (" right" if d == 0 else " acute" if d > 0 else " obtuse") def area_sq(a, b, c): s = Fraction(a + b + c, 2) return s * (s - a) * (s - b) * (s - c) # Heron without the root: exact def area_xy(p, q, r): return abs(p[0] * (q[1] - r[1]) + q[0] * (r[1] - p[1]) + r[0] * (p[1] - q[1])) / 2 >>> kind(3, 4, 5) 'scalene right' >>> kind(5, 5, 8) 'isosceles obtuse' >>> kind(2, 3, 4) 'scalene obtuse' >>> kind(1, 2, 3) 'not a triangle' >>> area_sq(13, 14, 15) Fraction(7056, 1) >>> sqrt(area_sq(13, 14, 15)) 84.0 >>> area_xy((0, 0), (6, 0), (0, 8)) 24.0 >>> degrees(acos(Fraction(2, 3))) # angle A of the 7, 8, 9 triangle 48.18968510422141 >>> a, b, c = 1e8, 1e8 - 1e-6, 1e-6 # a needle-thin triangle >>> s = (a + b + c) / 2 >>> sqrt(max(0, s * (s - a) * (s - b) * (s - c))) # Heron with floats 0.0 >>> sqrt(area_sq(Fraction(a), Fraction(b), Fraction(c))) # exact on the same numbers 2.846826518921699 ``` ```javascript const [a, b, c] = [3, 4, 5] Math.hypot(a, b) // 5 Math.acos((b * b + c * c - a * a) / (2 * b * c)) * 180 / Math.PI // angle A: 36.86989764584402 Math.sin(30 * Math.PI / 180) // 0.49999999999999994, not 0.5 a * a + b * b === c * c // true: exact for integers, the right-angle test ``` ```cpp #include #include #include using namespace std; const char* kind(int a, int b, int c) { int t; // sort so that a <= b <= c if (a > b) { t = a; a = b; b = t; } if (b > c) { t = b; b = c; c = t; } if (a > b) { t = a; a = b; b = t; } if (a + b <= c) return "not a triangle"; int d = a * a + b * b - c * c; // the sign of the cosine of the largest angle if (a == b && b == c) return "equilateral acute"; if (a == b || b == c) { if (d == 0) return "isosceles right"; if (d > 0) return "isosceles acute"; return "isosceles obtuse"; } if (d == 0) return "scalene right"; if (d > 0) return "scalene acute"; return "scalene obtuse"; } int areaSq16(int a, int b, int c) { // 16 A^2 by Heron's formula, in whole numbers return (a + b + c) * (-a + b + c) * (a - b + c) * (a + b - c); } int main() { cout << kind(3, 4, 5) << endl; // scalene right cout << kind(5, 5, 8) << endl; // isosceles obtuse cout << kind(2, 3, 4) << endl; // scalene obtuse cout << kind(1, 2, 3) << endl; // not a triangle cout << areaSq16(13, 14, 15) / 16 << " " << sqrt(areaSq16(13, 14, 15) / 16.0) << endl; // A^2 = 7056, A = 84 printf("%.4f\n", acos(2.0 / 3) * 180 / acos(-1.0)); // angle A of the 7, 8, 9 triangle // a needle-thin triangle: the textbook form of Heron's formula loses everything, the stable form does not double a = 1e8, b = 1e8 - 1e-6, c = 1e-6; double s = (a + b + c) / 2, naive = s * (s - a) * (s - b) * (s - c); printf("%d\n", naive <= 0); // 1: nothing is left of the area under the root printf("%.6f\n", 0.25 * sqrt((a + (b + c)) * (c - (a - b)) * (c + (a - b)) * (a + (b - c)))); // the stable form return 0; } /* output: scalene right isosceles obtuse scalene obtuse not a triangle 7056 84 48.1897 1 2.846827 */ ``` The pitfalls, in order of how often they bite: | Pitfall | What happens | What to do | |---|---|---| | Testing a right angle with floats | `math.sqrt(aa + bb) == c` can fail through rounding | compare the integers `aa + bb == c*c`, or use `math.isclose`; see [real numbers in code](https://nunada.my.id/articles/real-numbers/#real-numbers-in-code) | | Heron's formula on a thin triangle | $s-a$ and $s-b$ lose their digits and the area becomes `0.0` | use `Fraction` as above, or sort the sides and use Kahan's stable form | | Degrees against radians | `math.sin(30)` is not $0.5$ | use `math.radians(30)`; `math.degrees` goes back | | `acos` of a rounded cosine | a value like 1.0000000000000002 raises `ValueError` | clamp the argument to $[-1,1]$ | | Not sorting the sides | the longest side is not tested | sort first, or take `max` | | Degenerate input | $a+b=c$ is a flat triangle with area 0 | require `a + b > c` strictly | | `^` for a square | it is XOR | use `**` or multiply: `a * a` | ## Where does the study of triangles come from? **Triangles are the oldest tool of surveying and of proof, and most of what this article covers was set down in Euclid's Elements or soon after.** - **c. 600 BCE.** Tradition says that Thales of Miletus measured the height of a pyramid from the length of its shadow, an early use of similar triangles. - **c. 300 BCE.** Euclid's Elements, Book I, proves that the angles of a triangle add up to two right angles (I.32), and the triangle inequality (I.20); Book II gives the law of cosines in geometric form. - **c. 60 CE.** Heron of Alexandria's Metrica proves the formula for the area from the three sides, which Arabic sources credit to Archimedes. - **1765.** Leonhard Euler shows that the circumcenter, centroid and orthocenter of a triangle are collinear: the Euler line. - **1822.** Karl Feuerbach describes the nine-point circle, which passes through the midpoints of the sides, the feet of the altitudes and the midpoints between the orthocenter and the vertices, and which touches the incircle. ## What are the common mistakes with triangles? **The most common mistakes with triangles are the nine below, each with the correct statement.** | Mistake | Correct | |---|---| | ❌ The angles of a triangle add up to $360^\circ$ | That is a quadrilateral. A triangle has $180^\circ$. | | ❌ Any three lengths make a triangle | The longest must be shorter than the other two together: $1,2,3$ is flat. | | ❌ The height is the slanted side | The height is the perpendicular distance; the slanted side is longer. | | ❌ The area is base times height | It is half of that: $\frac12bh$. | | ❌ $a^2+b^2=c^2$ holds in every triangle | Only in a right triangle; otherwise use the law of cosines. | | ❌ Any side can be the hypotenuse | It is the longest side, opposite the right angle: $c^2=a^2+b^2$. | | ❌ $4,5,6$ is a right triangle | $16+25=41\ne36$: it is acute. Check the squares. | | ❌ In SSA there is always one triangle | There can be none, one or two; check the second angle $180^\circ-B$. | | ❌ A calculator in radian mode gives $\sin30^\circ=0.5$ | It gives $-0.988$: use degree mode, or convert. | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: triangles at a glance - **Angles:** $\angle A+\angle B+\angle C=180^\circ$; an exterior angle is the sum of the two remote interior angles. - **Existence:** each side is shorter than the sum of the other two; the third side is between $|a-b|$ and $a+b$. - **Types:** equilateral, isosceles, scalene by sides; acute, right, obtuse by $c^2$ against $a^2+b^2$ for the longest side $c$. - **Area:** $\frac12bh$, Heron $\sqrt{s(s-a)(s-b)(s-c)}$, $\frac12ab\sin C$, and the coordinate formula. - **Centers:** centroid $G$ (medians, $2:1$), circumcenter $O$, orthocenter $H$ ($O,G,H$ on the Euler line), incenter $I$ ($r=\frac Ks$). - **Congruent:** SSS, SAS, ASA, AAS, RHS; **similar:** AA, with areas in the ratio $k^2$. - **Solve:** law of cosines $c^2=a^2+b^2-2ab\cos C$, law of sines; SSA can give 0, 1 or 2 triangles. - **Code:** integer squares for the right-angle test, `Fraction` for exact Heron, radians for `sin` and `cos`. ## Glossary: key terms - **Triangle**: A polygon with three sides, three vertices and three interior angles that add up to 180 degrees. - **Hypotenuse**: The longest side of a right triangle, opposite the right angle. - **Altitude**: The perpendicular segment from a vertex to the line holding the opposite side; its length is the height for that base. - **Median**: The segment from a vertex to the midpoint of the opposite side. - **Centroid**: The point where the three medians meet, the balance point of the triangle, two thirds of the way along each median from its vertex. - **Circumcenter**: The point where the perpendicular bisectors of the sides meet, equally far from the three vertices. - **Orthocenter**: The point where the three altitudes of a triangle meet. - **Incenter**: The point where the three angle bisectors meet, equally far from the three sides and the center of the inscribed circle. - **Triangle inequality**: The rule that each side of a triangle is shorter than the sum of the other two sides. - **Congruent triangles**: Triangles with the same shape and size, so that all corresponding sides and angles are equal. - **Similar triangles**: Triangles with equal angles and proportional sides, the same shape but possibly different sizes. - **Heron's formula**: The formula that gives the area of a triangle from its three sides as the square root of s times s minus a times s minus b times s minus c. - **Law of cosines**: The rule that c squared equals a squared plus b squared minus twice a times b times the cosine of the angle C between them. - **Law of sines**: The rule that each side of a triangle divided by the sine of its opposite angle gives the same number. ## Frequently asked questions ### What is a triangle? A triangle is a polygon with three sides, three vertices and three interior angles. The angles always add up to 180 degrees. It is the simplest polygon, and any other polygon can be divided into triangles. ### What are the types of triangles? By sides, a triangle is equilateral (three equal sides), isosceles (two equal sides) or scalene (no equal sides). By angles it is acute (all angles below 90 degrees), right (one angle of 90 degrees) or obtuse (one angle above 90 degrees). ### Why do the angles of a triangle add up to 180 degrees? Draw a line through one vertex parallel to the opposite side. The alternate angles it makes equal the other two angles of the triangle, so all three angles sit together on a straight line, which measures 180 degrees. ### Can any three lengths form a triangle? No. Each length must be shorter than the sum of the other two. The lengths 3, 4 and 5 work, but 1, 2 and 3 only make a flat line and 1, 2 and 4 cannot meet. This is the triangle inequality. ### How do you find the area of a triangle? Multiply the base by the height and divide by two. If you only know the three sides, use Heron's formula with the semiperimeter s, the square root of s times s minus a times s minus b times s minus c. For sides 13, 14 and 15 the area is 84. ### How do you find the area of a triangle from coordinates? Take half the absolute value of x1 times y2 minus y3, plus x2 times y3 minus y1, plus x3 times y1 minus y2. For the vertices 0,0, 6,0 and 0,8 this gives half of 48, which is 24. ### What is the difference between a median and an altitude? A median goes from a vertex to the midpoint of the opposite side and splits that side in half. An altitude goes from a vertex perpendicular to the opposite side and measures the height. They are the same line only in an isosceles triangle, for the apex. ### What are the centroid, circumcenter, orthocenter and incenter? They are the meeting points of the medians, the perpendicular bisectors, the altitudes and the angle bisectors. The first three lie on the Euler line, and the centroid is one third of the way from the circumcenter to the orthocenter. The incenter is the center of the inscribed circle. ### How do you know if two triangles are congruent? Show that three suitable measurements match: all three sides (SSS), two sides and the angle between them (SAS), two angles and the side between them (ASA), two angles and another side (AAS), or the hypotenuse and a leg of right triangles (RHS). Side-side-angle is not enough. ### What is the law of cosines? It says that c squared equals a squared plus b squared minus 2ab times the cosine of the angle C between sides a and b. It extends the Pythagorean theorem to every triangle, because for a right angle the cosine is zero. ### Why can two sides and an angle make two triangles? When the angle is opposite one of the two given sides, the law of sines gives a sine, and two different angles share it: an acute one and its supplement. If both leave a positive third angle, two triangles fit. This is the ambiguous SSA case. ### How do you classify a triangle in Python? Sort the three sides, check that the two shorter ones add up to more than the longest, then compare the square of the longest with the sum of the other two squares using integers. Avoid comparing square roots as floats, which can differ by rounding. --- # Segitiga: Jenis, Sudut, Luas, Titik Penting, dan Kekongruenan Source: https://nunada.my.id/artikel/segitiga/ Updated: 2026-10-29 ## Jawaban singkat **Segitiga adalah bangun tertutup dengan tiga sisi lurus, tiga titik sudut, dan tiga sudut dalam yang selalu berjumlah 180°.** Segitiga digolongkan menurut sisinya (sama sisi, sama kaki, sembarang) dan menurut sudutnya (lancip, siku-siku, tumpul). Tiga panjang membentuk segitiga hanya bila yang terpanjang lebih pendek daripada jumlah dua lainnya. Luasnya setengah alas kali tinggi, dan aturan sinus dan kosinus menghubungkan sisi dan sudutnya. ### Poin penting - Sudut dalam setiap segitiga berjumlah $180^\circ$, sehingga segitiga paling banyak punya satu sudut siku-siku atau tumpul, dan sudut luar sama dengan jumlah dua sudut dalam yang tidak bersebelahan dengannya. - Tiga panjang membentuk segitiga hanya bila masing-masing lebih pendek daripada jumlah dua lainnya; sisi terpanjang lalu menentukan jenisnya: $c^2$ tumpul. - Segitiga siku-siku memiliki hipotenusa di depan sudut siku-siku, dan segitiga $45^\circ$–$45^\circ$–$90^\circ$ serta $30^\circ$–$60^\circ$–$90^\circ$ memiliki sisi berperbandingan tetap $1:1:\sqrt2$ dan $1:\sqrt3:2$. - Luas adalah $\frac12bh$; dengan tiga sisi pakai rumus Heron $\sqrt{s(s-a)(s-b)(s-c)}$, dengan dua sisi dan sudut apitnya $\frac12ab\sin C$, dan dengan koordinat rumus tali sepatu. - Empat titik pentingnya adalah titik berat (garis berat, 2:1), pusat lingkaran luar (sumbu sisi), titik tinggi (garis tinggi), dan pusat lingkaran dalam (garis bagi); tiga yang pertama terletak pada garis Euler. - Segitiga kongruen menurut SSS, SAS, ASA, AAS, atau RHS dan sebangun menurut AA; untuk memecahkan segitiga pakai aturan kosinus dan aturan sinus, dan waspadai kasus SSA yang menghasilkan dua segitiga. ## Apa itu segitiga? **Segitiga adalah poligon dengan tepat tiga sisi, tiga titik sudut, dan tiga sudut dalam.** Ia poligon paling sederhana, dan setiap poligon lain dapat dipotong menjadi segitiga: satu diagonal membagi [segiempat](https://nunada.my.id/artikel/segiempat/#what-is-a-quadrilateral) menjadi dua. Segitiga diberi nama dari titik sudutnya, $ABC$. Sisi di depan titik $A$ ditulis $a$ (yaitu $BC$), sisi di depan $B$ ditulis $b$ (yaitu $CA$), dan sisi di depan $C$ ditulis $c$ (yaitu $AB$). Sudut dalamnya $\angle A$, $\angle B$, $\angle C$. Sisi mana pun dapat menjadi **alas**. **Tinggi** yang bersesuaian dengan alas itu adalah jarak tegak lurus dari titik sudut di depannya ke garis yang memuat alas. Pada segitiga tumpul tinggi ini jatuh di luar segitiga, pada perpanjangan alas. Segitiga bersifat kaku: ketiga panjang sisinya menentukan bentuknya sepenuhnya, sehingga ia tidak dapat didorong berubah bentuk tanpa mematahkan sisinya. Rangka bersisi empat dapat miring menjadi jajargenjang, segitiga tidak, itulah sebabnya jembatan, rangka atap, rangka sepeda, dan tripod kamera dibangun dari segitiga. *Segitiga ABC. Garis putus-putus adalah tinggi dari C ke alas AB, tegak lurus terhadapnya.* ## Mengapa sudut-sudut segitiga berjumlah 180°? **Ketiga sudut dalam setiap segitiga berjumlah $180^\circ$, karena garis melalui satu titik sudut yang sejajar sisi di depannya membuat ketiga sudut itu tersusun sepanjang garis lurus.** Gambar garis melalui $C$ yang sejajar $AB$. Kedua sudut yang dibentuknya dengan $CA$ dan $CB$ adalah sudut dalam berseberangan dengan $\angle A$ dan $\angle B$, sehingga sama besar dengan keduanya. Kini $\angle A$, $\angle C$, dan $\angle B$ berdampingan pada garis lurus melalui $C$, dan sudut lurus besarnya $180^\circ$: $$\angle A+\angle B+\angle C=180^\circ.$$ Tiga akibat langsung mengikuti: - Segitiga paling banyak memiliki satu sudut siku-siku atau tumpul, sebab dua sudut seperti itu sudah memakai $180^\circ$ atau lebih. - Mengetahui dua sudut memberi sudut ketiga: $50^\circ$ dan $60^\circ$ menyisakan $70^\circ$. - **Sudut luar** di $C$, yang dibentuk dengan memperpanjang $AC$ melewati $C$ (atau $BC$), sama dengan $\angle A+\angle B$, jumlah dua sudut dalam yang tidak bersebelahan dengannya, karena ia dan $\angle C$ sama-sama sisa dari $180^\circ$. Dengan $\angle A=50^\circ$ dan $\angle B=60^\circ$ sudut luar di $C$ adalah $110^\circ$. Dari sinilah $360^\circ$ pada [segiempat](https://nunada.my.id/artikel/segiempat/#angle-sum) berasal: dua segitiga. Jika tiga sudut berperbandingan $1:2:3$, namai $x,2x,3x$ seperti pada [mengubah kata menjadi aljabar](https://nunada.my.id/artikel/bentuk-aljabar/#words-to-algebra): $6x=180$, sehingga $x=30^\circ$ dan sudutnya $30^\circ,60^\circ,90^\circ$, sebuah segitiga siku-siku. *Garis putus-putus melalui C sejajar AB. Sudut yang dibentuknya dengan CA dan CB sama dengan sudut di A dan B, sehingga ketiga sudut di C berjumlah sudut lurus.* ## Apa saja jenis-jenis segitiga? **Segitiga digolongkan dengan dua cara yang saling bebas: menurut sisinya (sama sisi, sama kaki, sembarang) dan menurut sudut terbesarnya (lancip, siku-siku, tumpul), sehingga setiap segitiga memiliki satu nama dari tiap daftar.** | Menurut sisi | Definisi | Contoh sisi | |---|---|---| | Sama sisi | ketiga sisi sama panjang; maka semua sudutnya $60^\circ$ | $5,5,5$ | | Sama kaki | tepat dua sisi sama panjang; sudut di depannya sama besar | $5,5,6$ | | Sembarang | ketiga sisi berbeda | $4,5,6$ | | Menurut sudut | Definisi | Contoh sisi | |---|---|---| | Lancip | ketiga sudut kurang dari $90^\circ$ | $5,5,6$ | | Siku-siku | satu sudut sama dengan $90^\circ$ | $3,4,5$ | | Tumpul | satu sudut lebih dari $90^\circ$ | $2,3,4$ | Dua aturan menghubungkan sisi dan sudut. **Sisi yang sama panjang berada di depan sudut yang sama besar**, dan sisi yang lebih panjang berada di depan sudut yang lebih besar. Jadi sisi terpanjang segitiga berada di depan sudut terbesarnya, dan pada segitiga siku-siku sisi itu, yaitu **hipotenusa** (sisi miring), berada di depan sudut siku-siku. Tidak setiap pasangan nama dapat muncul bersama. Segitiga sama sisi selalu lancip. Segitiga sama kaki dapat lancip ($5,5,6$), siku-siku ($1,1,\sqrt2$, separuh persegi yang dipotong sepanjang diagonalnya), atau tumpul ($5,5,8$). Segitiga sembarang dapat lancip ($4,5,6$), siku-siku ($3,4,5$), atau tumpul ($2,3,4$). Untuk menentukan jenis sudut tanpa mengukur sudut, lihat sisi terpanjang $c$ dan bandingkan $c^2$ dengan $a^2+b^2$: jika $c^2a^2+b^2$ tumpul. Untuk $2,3,4$: $16>4+9=13$, sehingga tumpul. Inilah [teorema Pythagoras](https://nunada.my.id/artikel/teorema-pythagoras/#converse) dan dua perluasannya, dan bagian-bagian berikutnya memakainya. > **"Sama kaki" bergantung pada bukunya** > > **Artikel ini mengikuti definisi sekolah: segitiga sama kaki memiliki tepat dua sisi sama panjang, sehingga segitiga sama sisi bukan sama kaki.** Banyak buku perguruan tinggi menulis paling sedikit dua sisi sama panjang, yang membuat setiap segitiga sama sisi juga sama kaki. Keduanya konsisten asalkan kamu menyebut yang kamu pakai. ## Dapatkah tiga panjang sembarang membentuk segitiga? **Tidak: tiga panjang membentuk segitiga hanya bila masing-masing lebih pendek daripada jumlah dua lainnya, yang sama artinya dengan sisi terpanjang lebih pendek daripada jumlah dua sisi lainnya.** Inilah ketaksamaan segitiga, dan ia mengatakan bahwa jalan lurus lebih pendek daripada jalan memutar: pergi dari $A$ ke $B$ langsung lebih pendek daripada lewat $C$, sehingga $c1+2$, kedua sisi pendek bahkan tidak dapat saling bertemu. Ketaksamaan itu juga memberi tahu seberapa panjang sisi ketiga. Jika dua sisi adalah $a$ dan $b$, sisi ketiga $c$ memenuhi $|a-b|0$ (lancip), $=0$ (siku-siku), atau $<0$ (tumpul), yaitu uji pada bagian jenis segitiga. Aturan sinus mengatakan bahwa tiap sisi sebanding dengan sinus sudut di depannya (lihat [artikel tentang aturan sinus](https://nunada.my.id/artikel/aturan-sinus/) untuk bukti, lingkaran, dan kasus ambigunya). | Diketahui | Cara memecahkan | |---|---| | SSS: tiga sisi | aturan kosinus untuk dua sudut, lalu $C=180^\circ-A-B$ | | SAS: dua sisi dan sudut apit | aturan kosinus untuk sisi ketiga, lalu SSS | | ASA atau AAS: dua sudut dan satu sisi | $C=180^\circ-A-B$, lalu aturan sinus untuk sisi lainnya | | SSA: dua sisi dan sudut di depan salah satunya | aturan sinus untuk sudut lainnya: **0, 1, atau 2 segitiga** | **Contoh.** SSS dengan $7,8,9$: $\cos A=\frac{64+81-49}{2\cdot8\cdot9}=\frac23$, sehingga $A\approx48{,}19^\circ$; demikian pula $B\approx58{,}41^\circ$ dan $C=180-48{,}19-58{,}41\approx73{,}40^\circ$. SAS dengan $a=5$, $b=8$, dan $C=60^\circ$: $c^2=25+64-2\cdot5\cdot8\cdot\frac12=49$, sehingga $c=7$. **Kasus ambigu.** Ambil $a=3$, $b=5$, dan $A=30^\circ$. Aturan sinus memberi $\sin B=\frac{5\sin30^\circ}{3}=\frac56\approx0{,}8333$, dan dua sudut memiliki sinus itu, $B\approx56{,}44^\circ$ dan $B\approx123{,}56^\circ$. Keduanya menyisakan sudut ketiga positif ($93{,}56^\circ$ atau $26{,}44^\circ$), sehingga dua segitiga cocok: dengan $c\approx5{,}99$ dan dengan $c\approx2{,}67$. Secara umum, dengan $A$ lancip, sisi $a$ terlalu pendek ($ac$, dan bandingkan $c^2$ dengan $a^2+b^2$.** Jaga rumus Heron tetap eksak dengan menghitung kuadrat luas memakai `Fraction`, dan pakai akar hanya di akhir. ```python from fractions import Fraction from math import sqrt, acos, degrees def kind(a, b, c): a, b, c = sorted((a, b, c)) if a + b <= c: return "not a triangle" sides = {1: "equilateral", 2: "isosceles", 3: "scalene"}[len({a, b, c})] d = a * a + b * b - c * c # the sign of the cosine of the largest angle return sides + (" right" if d == 0 else " acute" if d > 0 else " obtuse") def area_sq(a, b, c): s = Fraction(a + b + c, 2) return s * (s - a) * (s - b) * (s - c) # Heron without the root: exact def area_xy(p, q, r): return abs(p[0] * (q[1] - r[1]) + q[0] * (r[1] - p[1]) + r[0] * (p[1] - q[1])) / 2 >>> kind(3, 4, 5) 'scalene right' >>> kind(5, 5, 8) 'isosceles obtuse' >>> kind(2, 3, 4) 'scalene obtuse' >>> kind(1, 2, 3) 'not a triangle' >>> area_sq(13, 14, 15) Fraction(7056, 1) >>> sqrt(area_sq(13, 14, 15)) 84.0 >>> area_xy((0, 0), (6, 0), (0, 8)) 24.0 >>> degrees(acos(Fraction(2, 3))) # angle A of the 7, 8, 9 triangle 48.18968510422141 >>> a, b, c = 1e8, 1e8 - 1e-6, 1e-6 # a needle-thin triangle >>> s = (a + b + c) / 2 >>> sqrt(max(0, s * (s - a) * (s - b) * (s - c))) # Heron with floats 0.0 >>> sqrt(area_sq(Fraction(a), Fraction(b), Fraction(c))) # exact on the same numbers 2.846826518921699 ``` ```javascript const [a, b, c] = [3, 4, 5] Math.hypot(a, b) // 5 Math.acos((b * b + c * c - a * a) / (2 * b * c)) * 180 / Math.PI // angle A: 36.86989764584402 Math.sin(30 * Math.PI / 180) // 0.49999999999999994, not 0.5 a * a + b * b === c * c // true: exact for integers, the right-angle test ``` ```cpp #include #include #include using namespace std; const char* kind(int a, int b, int c) { int t; // sort so that a <= b <= c if (a > b) { t = a; a = b; b = t; } if (b > c) { t = b; b = c; c = t; } if (a > b) { t = a; a = b; b = t; } if (a + b <= c) return "not a triangle"; int d = a * a + b * b - c * c; // the sign of the cosine of the largest angle if (a == b && b == c) return "equilateral acute"; if (a == b || b == c) { if (d == 0) return "isosceles right"; if (d > 0) return "isosceles acute"; return "isosceles obtuse"; } if (d == 0) return "scalene right"; if (d > 0) return "scalene acute"; return "scalene obtuse"; } int areaSq16(int a, int b, int c) { // 16 A^2 by Heron's formula, in whole numbers return (a + b + c) * (-a + b + c) * (a - b + c) * (a + b - c); } int main() { cout << kind(3, 4, 5) << endl; // scalene right cout << kind(5, 5, 8) << endl; // isosceles obtuse cout << kind(2, 3, 4) << endl; // scalene obtuse cout << kind(1, 2, 3) << endl; // not a triangle cout << areaSq16(13, 14, 15) / 16 << " " << sqrt(areaSq16(13, 14, 15) / 16.0) << endl; // A^2 = 7056, A = 84 printf("%.4f\n", acos(2.0 / 3) * 180 / acos(-1.0)); // angle A of the 7, 8, 9 triangle // a needle-thin triangle: the textbook form of Heron's formula loses everything, the stable form does not double a = 1e8, b = 1e8 - 1e-6, c = 1e-6; double s = (a + b + c) / 2, naive = s * (s - a) * (s - b) * (s - c); printf("%d\n", naive <= 0); // 1: nothing is left of the area under the root printf("%.6f\n", 0.25 * sqrt((a + (b + c)) * (c - (a - b)) * (c + (a - b)) * (a + (b - c)))); // the stable form return 0; } /* output: scalene right isosceles obtuse scalene obtuse not a triangle 7056 84 48.1897 1 2.846827 */ ``` Jebakannya, berdasarkan seberapa sering terjadi: | Jebakan | Yang terjadi | Yang sebaiknya dilakukan | |---|---|---| | Menguji sudut siku-siku dengan float | `math.sqrt(aa + bb) == c` dapat gagal karena pembulatan | bandingkan bilangan bulat `aa + bb == c*c`, atau pakai `math.isclose`; lihat [bilangan real dalam kode](https://nunada.my.id/artikel/bilangan-real/#real-numbers-in-code) | | Rumus Heron pada segitiga tipis | $s-a$ dan $s-b$ kehilangan digitnya dan luasnya menjadi `0.0` | pakai `Fraction` seperti di atas, atau urutkan sisi dan pakai bentuk stabil Kahan | | Derajat dan radian tertukar | `math.sin(30)` bukan $0{,}5$ | pakai `math.radians(30)`; `math.degrees` untuk kembali | | `acos` dari kosinus yang dibulatkan | nilai seperti `1.0000000000000002` memunculkan `ValueError` | batasi argumen pada $[-1,1]$ | | Tidak mengurutkan sisi | sisi terpanjang tidak diuji | urutkan dulu, atau ambil `max` | | Masukan merosot | $a+b=c$ adalah segitiga datar berluas 0 | wajibkan `a + b > c` secara ketat | | `^` untuk kuadrat | itu XOR | pakai `**` atau kalikan: `a * a` | ## Dari mana asal ilmu tentang segitiga? **Segitiga adalah alat tertua dalam pengukuran tanah dan pembuktian, dan sebagian besar isi artikel ini sudah dituliskan dalam Elements Euclid atau tak lama sesudahnya.** - **Sekitar 600 SM.** Tradisi mengatakan bahwa Thales dari Miletos mengukur tinggi piramida dari panjang bayangannya, penggunaan awal segitiga sebangun. - **Sekitar 300 SM.** Elements Euclid, Buku I, membuktikan bahwa sudut segitiga berjumlah dua sudut siku-siku (I.32), dan ketaksamaan segitiga (I.20); Buku II memberi aturan kosinus dalam bentuk geometri. - **Sekitar 60 M.** Metrica karya Heron dari Aleksandria membuktikan rumus luas dari ketiga sisi, yang menurut sumber Arab berasal dari Archimedes. - **1765.** Leonhard Euler menunjukkan bahwa pusat lingkaran luar, titik berat, dan titik tinggi segitiga segaris: garis Euler. - **1822.** Karl Feuerbach menguraikan lingkaran sembilan titik, yang melalui titik tengah sisi-sisi, kaki garis-garis tinggi, dan titik tengah antara titik tinggi dan titik-titik sudut, dan yang menyinggung lingkaran dalam. ## Apa kesalahan umum pada segitiga? **Kesalahan paling umum pada segitiga adalah sembilan hal berikut, masing-masing dengan pernyataan yang benar.** | Kesalahan | Yang benar | |---|---| | ❌ Sudut segitiga berjumlah $360^\circ$ | Itu segiempat. Segitiga berjumlah $180^\circ$. | | ❌ Tiga panjang sembarang membentuk segitiga | Yang terpanjang harus lebih pendek daripada jumlah dua lainnya: $1,2,3$ datar. | | ❌ Tinggi adalah sisi yang miring | Tinggi adalah jarak tegak lurus; sisi yang miring lebih panjang. | | ❌ Luas adalah alas kali tinggi | Luasnya setengah dari itu: $\frac12bh$. | | ❌ $a^2+b^2=c^2$ berlaku pada setiap segitiga | Hanya pada segitiga siku-siku; selain itu pakai aturan kosinus. | | ❌ Sisi mana pun dapat menjadi hipotenusa | Hipotenusa adalah sisi terpanjang, di depan sudut siku-siku: $c^2=a^2+b^2$. | | ❌ $4,5,6$ adalah segitiga siku-siku | $16+25=41\ne36$: ia lancip. Periksa kuadratnya. | | ❌ Pada SSA selalu ada satu segitiga | Bisa tidak ada, satu, atau dua; periksa sudut kedua $180^\circ-B$. | | ❌ Kalkulator mode radian memberi $\sin30^\circ=0{,}5$ | Ia memberi $-0{,}988$: pakai mode derajat, atau ubah satuannya. | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: segitiga sekilas - **Sudut:** $\angle A+\angle B+\angle C=180^\circ$; sudut luar adalah jumlah dua sudut dalam yang tidak bersebelahan. - **Keberadaan:** tiap sisi lebih pendek daripada jumlah dua lainnya; sisi ketiga berada di antara $|a-b|$ dan $a+b$. - **Jenis:** sama sisi, sama kaki, sembarang menurut sisi; lancip, siku-siku, tumpul menurut $c^2$ terhadap $a^2+b^2$ untuk sisi terpanjang $c$. - **Luas:** $\frac12bh$, Heron $\sqrt{s(s-a)(s-b)(s-c)}$, $\frac12ab\sin C$, dan rumus koordinat. - **Titik penting:** titik berat $G$ (garis berat, $2:1$), pusat lingkaran luar $O$, titik tinggi $H$ ($O,G,H$ pada garis Euler), pusat lingkaran dalam $I$ ($r=\frac Ks$). - **Kongruen:** SSS, SAS, ASA, AAS, RHS; **sebangun:** AA, dengan luas berperbandingan $k^2$. - **Memecahkan:** aturan kosinus $c^2=a^2+b^2-2ab\cos C$, aturan sinus; SSA dapat memberi 0, 1, atau 2 segitiga. - **Kode:** kuadrat bilangan bulat untuk uji sudut siku-siku, `Fraction` untuk Heron eksak, radian untuk `sin` dan `cos`. ## Glosarium: istilah penting - **Segitiga**: Poligon dengan tiga sisi, tiga titik sudut, dan tiga sudut dalam yang berjumlah 180 derajat. - **Hipotenusa**: Sisi terpanjang segitiga siku-siku, di depan sudut siku-siku. - **Garis tinggi**: Ruas garis tegak lurus dari titik sudut ke garis yang memuat sisi di depannya; panjangnya adalah tinggi untuk alas itu. - **Garis berat**: Ruas garis dari titik sudut ke titik tengah sisi di depannya. - **Titik berat**: Titik tempat ketiga garis berat bertemu, titik keseimbangan segitiga, berada dua pertiga sepanjang tiap garis berat dari titik sudutnya. - **Pusat lingkaran luar**: Titik tempat sumbu-sumbu sisi bertemu, berjarak sama dari ketiga titik sudut. - **Titik tinggi**: Titik tempat ketiga garis tinggi segitiga bertemu. - **Pusat lingkaran dalam**: Titik tempat ketiga garis bagi sudut bertemu, berjarak sama dari ketiga sisi dan pusat lingkaran dalam. - **Ketaksamaan segitiga**: Aturan bahwa tiap sisi segitiga lebih pendek daripada jumlah dua sisi lainnya. - **Segitiga kongruen**: Segitiga dengan bentuk dan ukuran yang sama, sehingga semua sisi dan sudut yang bersesuaian sama. - **Segitiga sebangun**: Segitiga dengan sudut sama dan sisi sebanding, bentuk sama tetapi ukuran mungkin berbeda. - **Rumus Heron**: Rumus yang memberi luas segitiga dari ketiga sisinya sebagai akar dari s kali s dikurang a kali s dikurang b kali s dikurang c. - **Aturan kosinus**: Aturan bahwa c kuadrat sama dengan a kuadrat ditambah b kuadrat dikurangi dua kali a kali b kali kosinus sudut C di antara keduanya. - **Aturan sinus**: Aturan bahwa tiap sisi segitiga dibagi sinus sudut di depannya memberi bilangan yang sama. ## Pertanyaan yang sering diajukan ### Apa itu segitiga? Segitiga adalah poligon dengan tiga sisi, tiga titik sudut, dan tiga sudut dalam. Sudutnya selalu berjumlah 180 derajat. Ia poligon paling sederhana, dan poligon lain mana pun dapat dibagi menjadi segitiga. ### Apa saja jenis-jenis segitiga? Menurut sisinya, segitiga adalah sama sisi (tiga sisi sama), sama kaki (dua sisi sama), atau sembarang (tidak ada sisi sama). Menurut sudutnya ia lancip (semua sudut di bawah 90 derajat), siku-siku (satu sudut 90 derajat), atau tumpul (satu sudut di atas 90 derajat). ### Mengapa sudut segitiga berjumlah 180 derajat? Gambar garis melalui satu titik sudut yang sejajar sisi di depannya. Sudut dalam berseberangan yang terbentuk sama dengan dua sudut lain segitiga, sehingga ketiga sudut berdampingan pada garis lurus, yang besarnya 180 derajat. ### Dapatkah tiga panjang sembarang membentuk segitiga? Tidak. Setiap panjang harus lebih pendek daripada jumlah dua lainnya. Panjang 3, 4, dan 5 dapat, tetapi 1, 2, dan 3 hanya membentuk garis datar dan 1, 2, dan 4 tidak dapat bertemu. Inilah ketaksamaan segitiga. ### Bagaimana mencari luas segitiga? Kalikan alas dengan tinggi lalu bagi dua. Jika hanya tahu ketiga sisinya, pakai rumus Heron dengan setengah keliling s, akar dari s kali s dikurang a kali s dikurang b kali s dikurang c. Untuk sisi 13, 14, dan 15 luasnya 84. ### Bagaimana mencari luas segitiga dari koordinat? Ambil setengah nilai mutlak dari x1 kali y2 dikurang y3, ditambah x2 kali y3 dikurang y1, ditambah x3 kali y1 dikurang y2. Untuk titik sudut 0,0, 6,0, dan 0,8 ini memberi setengah dari 48, yaitu 24. ### Apa beda garis berat dan garis tinggi? Garis berat berjalan dari titik sudut ke titik tengah sisi di depannya dan membagi sisi itu menjadi dua. Garis tinggi berjalan dari titik sudut tegak lurus sisi di depannya dan mengukur tinggi. Keduanya garis yang sama hanya pada segitiga sama kaki, untuk puncaknya. ### Apa itu titik berat, pusat lingkaran luar, titik tinggi, dan pusat lingkaran dalam? Itu titik temu garis berat, sumbu sisi, garis tinggi, dan garis bagi sudut. Tiga yang pertama terletak pada garis Euler, dan titik berat berada sepertiga dari pusat lingkaran luar menuju titik tinggi. Pusat lingkaran dalam adalah pusat lingkaran dalam segitiga. ### Bagaimana mengetahui dua segitiga kongruen? Tunjukkan bahwa tiga ukuran yang sesuai sama: ketiga sisi (SSS), dua sisi dan sudut di antaranya (SAS), dua sudut dan sisi di antaranya (ASA), dua sudut dan sisi lain (AAS), atau hipotenusa dan satu sisi tegak segitiga siku-siku (RHS). Sisi-sisi-sudut tidak cukup. ### Apa itu aturan kosinus? Aturan ini menyatakan bahwa c kuadrat sama dengan a kuadrat ditambah b kuadrat dikurangi 2ab kali kosinus sudut C di antara sisi a dan b. Ia memperluas teorema Pythagoras ke setiap segitiga, karena untuk sudut siku-siku kosinusnya nol. ### Mengapa dua sisi dan satu sudut dapat membentuk dua segitiga? Bila sudutnya berada di depan salah satu dari dua sisi yang diketahui, aturan sinus memberi sebuah sinus, dan dua sudut berbeda memilikinya: satu lancip dan pelurusnya. Jika keduanya menyisakan sudut ketiga positif, dua segitiga cocok. Inilah kasus SSA yang ambigu. ### Bagaimana mengklasifikasikan segitiga di Python? Urutkan ketiga sisi, periksa bahwa dua sisi yang lebih pendek berjumlah lebih dari yang terpanjang, lalu bandingkan kuadrat yang terpanjang dengan jumlah dua kuadrat lainnya memakai bilangan bulat. Hindari membandingkan akar sebagai float, yang dapat berbeda karena pembulatan. --- # Quadrilaterals: Types, Properties, Perimeter and Area Source: https://nunada.my.id/articles/quadrilaterals/ Updated: 2026-10-10 ## Quick answer **A quadrilateral is a closed shape with four straight sides and four vertices, and its four interior angles always add up to 360°.** The named types are the parallelogram, rectangle, rhombus, square, kite and trapezoid, each defined by which sides are parallel or equal and which angles are right. Perimeter is the sum of the four sides; area comes from a formula for the type, or from the coordinates of the vertices with the shoelace formula. ### Key takeaways - A quadrilateral has four sides, four vertices and two diagonals, and the angles of any simple quadrilateral add up to $360^\circ$, because a diagonal cuts it into two triangles. - The types form a family tree: a square is a rectangle and a rhombus; rectangles and rhombuses are parallelograms; a rhombus is also a kite; a trapezoid has exactly one pair of parallel sides. - A parallelogram has equal and parallel opposite sides and diagonals that bisect each other; a rectangle adds equal diagonals and right angles; a rhombus adds equal sides and perpendicular diagonals. - Area: rectangle $lw$, parallelogram $bh$, trapezoid $\frac{(a+b)h}{2}$, and $\frac{d_1d_2}{2}$ for a rhombus or kite; the perimeter is always the sum of the four sides. - With coordinates, parallel means a zero cross product, perpendicular a zero dot product and equal length equal squared distance; the area is half the absolute shoelace sum. - Test shapes with exact integers or fractions, never with floats: $0.7\cdot0.3-0.1\cdot2.1$ is not $0$ in floating point, although it is $0$ in mathematics. ## What is a quadrilateral? **A quadrilateral is a polygon with exactly four sides, four vertices (corners) and four interior angles.** The word comes from the Latin quattuor (four) and latus (side); quadrangle and tetragon mean the same, and the Indonesian word is segiempat. We name a quadrilateral by its vertices in order round the shape, such as $ABCD$. Its **sides** are $AB$, $BC$, $CD$ and $DA$. Two sides that share a vertex are **adjacent**; $AB$ and $CD$ are **opposite**, and so are $BC$ and $DA$. A **diagonal** joins two opposite vertices: $AC$ and $BD$. Quadrilaterals come in three kinds of outline: - **Convex.** Every interior angle is less than $180^\circ$ and both diagonals lie inside the shape. - **Concave.** One interior angle is more than $180^\circ$ and one diagonal lies outside. The concave kite in the second picture is called a dart or arrowhead. - **Crossed.** Two opposite sides cross each other, giving a bow-tie. A crossed quadrilateral is not a simple polygon, so it has no single inside, no area in the usual sense, and the rules in this article do not apply to it. Unless it says otherwise, "quadrilateral" below means a simple one: its sides meet only at the vertices. *A convex quadrilateral ABCD. The dashed lines are its two diagonals, AC and BD; both lie inside.* *A concave quadrilateral (a dart): the angle at D is more than 180°, and the diagonal AC lies outside the shape.* ## Why do the angles of a quadrilateral add up to 360°? **The interior angles of every simple quadrilateral add up to $360^\circ$, because one diagonal that lies inside it splits it into two triangles and each triangle has angle sum $180^\circ$.** Draw the diagonal $AC$ of a convex $ABCD$. The angle at $A$ is split between the triangles $ABC$ and $ACD$, and so is the angle at $C$, while $B$ belongs to the first triangle and $D$ to the second. The four angles of the quadrilateral are therefore exactly the six angles of the two [triangles](https://nunada.my.id/articles/triangles/#angle-sum), regrouped: $$\angle A+\angle B+\angle C+\angle D=180^\circ+180^\circ=360^\circ.$$ The same holds for a concave quadrilateral: use the diagonal that lies inside, and count the reflex angle (more than $180^\circ$) as it is. In the dart of the first section the angles are about $37^\circ$, $53^\circ$, $37^\circ$ and $233^\circ$, and $37+53+37+233=360$. A polygon with $n$ sides has angle sum $(n-2)\cdot180^\circ$: a pentagon has $540^\circ$. This one fact solves many problems. If three angles are $70^\circ$, $95^\circ$ and $120^\circ$ the fourth is $360-285=75^\circ$. If the angles are in the ratio $1:2:3:4$, call them $x,2x,3x,4x$ as in [turning words into algebra](https://nunada.my.id/articles/algebraic-expressions/#words-to-algebra): then $10x=360$, so $x=36^\circ$ and the angles are $36^\circ,72^\circ,108^\circ,144^\circ$. ## What are the types of quadrilaterals? **The named quadrilaterals are the parallelogram, rectangle, rhombus, square, kite and trapezoid, and they form a family tree in which every special type keeps all the properties of the more general ones.** | Type | Defining property | |---|---| | Parallelogram | both pairs of opposite sides are parallel | | Rectangle | four right angles | | Rhombus | four equal sides | | Square | four equal sides and four right angles | | Kite | two pairs of equal adjacent sides | | Trapezoid | exactly one pair of parallel sides | | Isosceles trapezoid | a trapezoid whose two non-parallel sides (legs) are equal | Read the table as a hierarchy, from the general to the special: - A **square** is a rectangle (right angles), a rhombus (equal sides), a parallelogram and a kite, all at once. - Every **rectangle** and every **rhombus** is a parallelogram, because their opposite sides are parallel. - Every **rhombus** is a kite, since all four sides are equal and so the adjacent ones are equal in pairs. - A **rectangle that is not a square**, a **parallelogram that is not a rectangle** and a **kite that is not a rhombus** are the genuinely different cases. - A **trapezoid** is its own branch: with one pair of parallel sides it can never be a parallelogram. So "is a square a rectangle?" has the answer yes: a rectangle is any quadrilateral with four right angles, and a square has them. The everyday habit of treating the names as separate boxes is exactly what the next section's table corrects. > **Two names depend on the book** > > **Trapezoid and kite are defined slightly differently in different books, and this article uses the exclusive school definition.** Here a trapezoid has exactly one pair of parallel sides, so a parallelogram is not a trapezoid; many university texts say at least one pair, which makes every parallelogram a trapezoid. Both are fine if you say which you use. The name also differs by country: what American English calls a trapezoid is a trapezium in British English and trapesium in Indonesian. Likewise a kite here may have two or four equal-side pairs, so a rhombus counts as a kite; some books require the two pairs to be different. ## What are the properties of each quadrilateral? **Each type is told apart by its sides, its angles, its diagonals and its symmetry, and the table gives all of them for a typical example of each type.** A special case can have more: a particular parallelogram may happen to be a rectangle. | Property | Parallelogram | Rectangle | Rhombus | Square | Kite | Isosceles trapezoid | |---|---|---|---|---|---|---| | Pairs of parallel sides | 2 | 2 | 2 | 2 | 0 | 1 | | Opposite sides equal | yes | yes | yes | yes | no | no | | All four sides equal | no | no | yes | yes | no | no | | Right angles | 0 | 4 | 0 | 4 | 0 | 0 | | Opposite angles equal | yes | yes | yes | yes | one pair | no | | Diagonals equal | no | yes | no | yes | no | yes | | Diagonals perpendicular | no | no | yes | yes | yes | no | | Diagonals bisect each other | yes | yes | yes | yes | no | no | | Lines of symmetry | 0 | 2 | 2 | 4 | 1 | 1 | | Order of rotational symmetry | 2 | 2 | 2 | 4 | 1 | 1 | Some of these have a neat reason. A diagonal of a parallelogram cuts it into two congruent triangles, which is why opposite sides are equal, opposite angles are equal and the diagonals bisect each other. The angles next to one side of a parallelogram add up to $180^\circ$, since they sit between parallel lines. In a kite the diagonal along the axis of symmetry cuts the other diagonal in half at a right angle, which is why the area is half the product of the diagonals. An isosceles trapezoid has equal base angles in each pair, so it has one line of symmetry, through the midpoints of its two bases. Try each type below and read its checklist. **The diagonals of a rectangle with sides $l$ and $w$ are equal and have length $\sqrt{l^2+w^2}$, by the Pythagorean theorem.** For a $6\times4$ rectangle that is $\sqrt{52}=2\sqrt{13}\approx7.21$, after you [simplify the radical](https://nunada.my.id/articles/exponents-and-radicals/#simplify-radicals). For a square with side $s$ the diagonal is $s\sqrt2$, and because $\sqrt2$ is [irrational](https://nunada.my.id/articles/irrational-numbers/#why-sqrt2-is-irrational), no square with whole-number sides has a whole-number diagonal. For a rhombus the diagonals cross at right angles and halve each other, so each side is the [hypotenuse](https://nunada.my.id/articles/pythagorean-theorem/#what-is-the-theorem) of a right triangle whose legs are half of each diagonal. With diagonals $10$ and $24$ the legs are $5$ and $12$, the side is $\sqrt{25+144}=13$, and the perimeter is $4\cdot13=52$. ## How do you find the perimeter and area of a quadrilateral? **The perimeter is the sum of the four sides, and the area comes from a formula for the type: base times height for a parallelogram, half the product of the diagonals for a rhombus or kite, and half the sum of the parallel sides times the height for a trapezoid.** | Type | Perimeter | Area | |---|---|---| | Square (side $s$) | $4s$ | $s^2$ | | Rectangle (length $l$, width $w$) | $2(l+w)$ | $lw$ | | Parallelogram (sides $a,b$, base $b$, height $h$) | $2(a+b)$ | $bh$ | | Rhombus (side $s$, diagonals $d_1,d_2$) | $4s$ | $\frac{d_1d_2}{2}$ | | Kite (sides $a,b$, diagonals $d_1,d_2$) | $2(a+b)$ | $\frac{d_1d_2}{2}$ | | Trapezoid (parallel sides $a,b$, legs $c,d$, height $h$) | $a+b+c+d$ | $\frac{(a+b)h}{2}$ | The height is the perpendicular distance between the parallel sides, never the slanted side. Perimeter is a length, in meters; area is a count of unit squares, in square meters. Each formula is the rectangle in disguise: - **Parallelogram.** Cut a right triangle off one slanted end and slide it to the other end: you get a rectangle with the same base and height, so the area is $bh$. - **Trapezoid.** Two copies, one turned upside down, fit together into a parallelogram with base $a+b$ and height $h$. The trapezoid is half of it, so its area is $\frac{(a+b)h}{2}$. - **Rhombus and kite.** The diagonals are perpendicular, so the rectangle $d_1\times d_2$ drawn round the shape has exactly twice its area: the area is $\frac12d_1d_2$. The same holds for every convex quadrilateral whose diagonals are perpendicular. For the trapezoid in the picture, $a=8$, $b=4$ and $h=4$ give $\frac{(8+4)\cdot4}{2}=24$. The $\frac12$ in these formulas is the usual [multiplication of fractions](https://nunada.my.id/articles/rational-numbers/#multiply-divide-fractions): half of $48$ is $24$. A word problem: a plot of land is a trapezoid whose parallel sides are $30$ m and $20$ m, $12$ m apart, and land costs 80 dollars per square meter. The area is $\frac{(30+20)\cdot12}{2}=300$ m², so the plot costs $300\cdot80=24000$ dollars. *A trapezoid with parallel sides AB = 8 and CD = 4. The dashed line is the height h = 4, drawn perpendicular to both.* ## How do you classify a quadrilateral and find its area from coordinates? **Place the vertices on a grid and use three exact tests: a zero cross product means parallel, a zero dot product means perpendicular, and equal squared distances mean equal lengths; the area is half the absolute shoelace sum.** For the side from $P=(x_1,y_1)$ to $Q=(x_2,y_2)$ write the vector $\vec{PQ}=(u,v)=(x_2-x_1,\,y_2-y_1)$. For two vectors $(u_1,v_1)$ and $(u_2,v_2)$: - they are **parallel** exactly when $u_1v_2-v_1u_2=0$ (the cross product); - they are **perpendicular** exactly when $u_1u_2+v_1v_2=0$ (the dot product); - a side has **length** $\sqrt{u^2+v^2}$, so two sides are equal exactly when $u^2+v^2$ agrees; no square root is needed. These tests use only multiplication and addition, so on integer or fraction coordinates they are exact, and they cope with vertical sides, where a slope would divide by zero. Take $A(0,0)$, $B(6,0)$, $C(8,4)$, $D(2,4)$. The sides are $\vec{AB}=(6,0)$, $\vec{BC}=(2,4)$, $\vec{CD}=(-6,0)$, $\vec{DA}=(-2,-4)$. The cross products $6\cdot0-0\cdot(-6)$ and $2\cdot(-4)-4\cdot(-2)$ are both $0$, so both pairs of opposite sides are parallel: a parallelogram. The squared sides are $36$ and $20$, so it is not a rhombus, and $\vec{AB}\cdot\vec{BC}=12\ne0$, so it is not a rectangle. For the area use the **shoelace formula** (Gauss's area formula, also called the surveyor's formula). List the vertices in order and add $x_iy_{i+1}-x_{i+1}y_i$ over the four edges, going back to the first vertex at the end: $$\text{area}=\tfrac12\left|\sum_{i}\bigl(x_iy_{i+1}-x_{i+1}y_i\bigr)\right|.$$ For the parallelogram above the four terms are $0,\,24,\,24,\,0$, the sum is $48$ and the area is $24=6\cdot4$, base times height, as it must be. For $A(0,0)$, $B(6,0)$, $C(6,4)$, $D(2,6)$ the terms are $0,24,28,0$, so the area is $26$; check by splitting into triangles $ABC$ ($12$) and $ACD$ ($14$). The sign of the sum tells the direction: positive for counterclockwise vertices, negative for clockwise, which is why we take the absolute value. The order matters. A bow-tie such as $(0,0),(4,4),(4,0),(0,4)$ gives a sum of exactly $0$, because its two lobes cancel: the formula is only an area for a simple polygon. ## How do you classify a quadrilateral in code? **Write the three tests as small functions on integer or `Fraction` coordinates, and the classifier is a few comparisons.** The code assumes `a, b, c, d` are the vertices in order round a simple convex quadrilateral. ```python from fractions import Fraction as F def sub(p, q): return (p[0] - q[0], p[1] - q[1]) def cross(u, v): return u[0] * v[1] - u[1] * v[0] def dot(u, v): return u[0] * v[0] + u[1] * v[1] def d2(p, q): return dot(sub(p, q), sub(p, q)) # squared length def kind(a, b, c, d): ab, bc, cd, da = sub(b, a), sub(c, b), sub(d, c), sub(a, d) p1, p2 = cross(ab, cd) == 0, cross(bc, da) == 0 # AB || CD, BC || DA s = [d2(a, b), d2(b, c), d2(c, d), d2(d, a)] if p1 and p2: rhombus, right = len(set(s)) == 1, dot(ab, bc) == 0 if rhombus and right: return "square" if right: return "rectangle" return "rhombus" if rhombus else "parallelogram" if p1 or p2: return "trapezoid" if (s[0] == s[1] and s[2] == s[3]) or (s[0] == s[3] and s[1] == s[2]): return "kite" return "none of these" def area(*pts): s = sum(p[0] * q[1] - q[0] * p[1] for p, q in zip(pts, pts[1:] + pts[:1])) return F(abs(s), 2) >>> kind((0, 0), (6, 0), (8, 4), (2, 4)) 'parallelogram' >>> kind((4, 0), (8, 3), (4, 6), (0, 3)) 'rhombus' >>> kind((0, 0), (3, 2), (0, 6), (-3, 2)) 'kite' >>> area((0, 0), (6, 0), (6, 4), (2, 6)) Fraction(26, 1) >>> area((F(1, 2), 0), (4, 0), (4, F(7, 3)), (0, 2)) # fractions stay exact Fraction(49, 6) >>> 0.7 * 0.3 - 0.1 * 2.1 # should be 0 ... -2.7755575615628914e-17 >>> F(7, 10) * F(3, 10) - F(1, 10) * F(21, 10) # ... and with fractions it is Fraction(0, 1) ``` ```javascript const cross = (u, v) => u[0] * v[1] - u[1] * v[0] cross([6, 0], [-6, 0]) // 0: parallel (exact for small integers) cross([0.7, 0.1], [2.1, 0.3]) // -2.7755575615628914e-17, not 0 Math.abs(cross([0.7, 0.1], [2.1, 0.3])) < 1e-9 // true: with floats, compare with a tolerance const shoelace = (pts) => Math.abs(pts.reduce((s, [x, y], i) => { const [u, v] = pts[(i + 1) % pts.length]; return s + x * v - u * y }, 0)) / 2 shoelace([[0, 0], [6, 0], [6, 4], [2, 6]]) // 26 ``` ```cpp #include #include using namespace std; int cross(int ux, int uy, int vx, int vy) { return ux * vy - uy * vx; } int dot(int ux, int uy, int vx, int vy) { return ux * vx + uy * vy; } int d2(int px, int py, int qx, int qy) { return (px - qx) * (px - qx) + (py - qy) * (py - qy); } const char* kind(int ax, int ay, int bx, int by, int cx, int cy, int dx, int dy) { bool p1 = cross(bx - ax, by - ay, dx - cx, dy - cy) == 0; // AB parallel to CD bool p2 = cross(cx - bx, cy - by, ax - dx, ay - dy) == 0; // BC parallel to DA int s0 = d2(ax, ay, bx, by), s1 = d2(bx, by, cx, cy), s2 = d2(cx, cy, dx, dy), s3 = d2(dx, dy, ax, ay); if (p1 && p2) { bool rhombus = s0 == s1 && s1 == s2 && s2 == s3; bool right = dot(bx - ax, by - ay, cx - bx, cy - by) == 0; if (rhombus && right) return "square"; if (right) return "rectangle"; return rhombus ? "rhombus" : "parallelogram"; } if (p1 || p2) return "trapezoid"; if ((s0 == s1 && s2 == s3) || (s0 == s3 && s1 == s2)) return "kite"; return "none of these"; } int twiceArea(int x[], int y[], int n) { // the shoelace formula, doubled: whole numbers int s = 0; for (int i = 0; i < n; i++) s += x[i] * y[(i + 1) % n] - x[(i + 1) % n] * y[i]; return s < 0 ? -s : s; } int main() { cout << kind(0, 0, 6, 0, 8, 4, 2, 4) << endl; // parallelogram cout << kind(4, 0, 8, 3, 4, 6, 0, 3) << endl; // rhombus cout << kind(0, 0, 3, 2, 0, 6, -3, 2) << endl; // kite int x[4] = {0, 6, 6, 2}, y[4] = {0, 0, 4, 6}; cout << twiceArea(x, y, 4) / 2 << endl; // 26 printf("%.20f\n", 0.7 * 0.3 - 0.1 * 2.1); // should be 0 ... cout << 7 * 3 - 1 * 21 << endl; // ... and with whole numbers (tenths) it is return 0; } /* output: parallelogram rhombus kite 26 -0.00000000000000002776 0 */ ``` The pitfalls, in order of how often they bite: | Pitfall | What happens | What to do | |---|---|---| | Testing parallel with floats | `0.7 0.3 - 0.1 2.1 == 0` is false | use integers or `Fraction`, as in the article on [fractions in code](https://nunada.my.id/articles/rational-numbers/#fractions-in-code); or compare with a tolerance | | Using a slope | a vertical side divides by 0 | use the cross product | | Vertices out of order | `a, c, b, d` describes a bow-tie, and the area comes out wrong | order the vertices round the shape first | | Forgetting `abs` in the shoelace sum | a clockwise polygon has negative area | take the absolute value | | Comparing sides with `sqrt` | rounding makes equal sides unequal | compare the squared lengths | | Degenerate input | three collinear points make a triangle, not a quadrilateral | check that no three consecutive cross products are 0 | | A concave shape | the classifier above would call a dart a kite | check that all four turns point the same way first | ## Where do the quadrilaterals come from? **Quadrilaterals are among the oldest shapes in mathematics, because fields, walls and tiles are four-sided, and the names we use come mostly from Greek.** - **c. 1550 BCE.** The Rhind Papyrus, problem 52, finds the area of a trapezoid, which the Egyptian scribe describes as a triangle with its tip cut off. - **c. 300 BCE.** Euclid's Elements, Book I, definition 22, names the square, the oblong (our rectangle), the rhombus and the rhomboid (our parallelogram), and calls every other quadrilateral a trapezium. Proposition I.34 proves that the opposite sides and angles of a parallelogram are equal and that a diagonal bisects it. Later Greek writers narrowed trapezium to a quadrilateral with a pair of parallel sides. - **c. 150 CE.** Ptolemy's theorem: in a quadrilateral whose vertices lie on a [circle](https://nunada.my.id/articles/circles/#angle-theorems), the product of the diagonals equals the sum of the products of the opposite sides. - **628 CE.** Brahmagupta gives the area of a quadrilateral inscribed in a circle, $\sqrt{(s-a)(s-b)(s-c)(s-d)}$, where $s$ is half the perimeter. It generalizes Heron's formula for a triangle. - **1769.** Albrecht Meister describes the shoelace formula for the area of a polygon from its coordinates; it is now also known by Gauss's name, and as the surveyor's formula. The names themselves drifted. Over time British English kept trapezium for a quadrilateral with one pair of parallel sides, while American English moved to trapezoid, which is why one shape has two names today. ## What are the common mistakes with quadrilaterals? **The most common mistakes with quadrilaterals are the nine below, each with the correct statement.** | Mistake | Correct | |---|---| | ❌ A square is not a rectangle | It is: it has four right angles. Every square is a rectangle and a rhombus. | | ❌ The diagonals of a rectangle are perpendicular | They are equal and bisect each other; they are perpendicular only in a square. | | ❌ The diagonals of a parallelogram are equal | Only for a rectangle; in general they are different, but always bisect each other. | | ❌ The area of a parallelogram is the product of two neighboring sides | It is base times height; the slanted side is longer than the height. | | ❌ The area of a rhombus is $s^2$ | That is a square. A rhombus has $\frac{d_1d_2}{2}$, or base times height. | | ❌ The area of a trapezoid is $abh$ | It is $\frac{(a+b)h}{2}$: the average of the parallel sides times the height. | | ❌ The angles of a quadrilateral add up to $180^\circ$ | That is a triangle. A quadrilateral has $360^\circ$. | | ❌ The diagonals of a kite bisect each other | Only the axis diagonal bisects the other one; they are perpendicular. | | ❌ Naming the vertices in any order | $ABCD$ must go round the shape; $ACBD$ can describe a bow-tie. | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: quadrilaterals at a glance - **Definition:** four sides, four vertices, two diagonals; the angles of a simple quadrilateral add up to $360^\circ$. - **Family tree:** square $\subset$ rectangle, rhombus $\subset$ parallelogram; rhombus $\subset$ kite; a trapezoid has exactly one parallel pair. - **Parallelogram:** opposite sides parallel and equal, opposite angles equal, diagonals bisect each other. - **Rectangle / rhombus / square:** equal diagonals / perpendicular diagonals / both. - **Area:** $lw$, $bh$, $\frac{(a+b)h}{2}$, and $\frac{d_1d_2}{2}$ for a rhombus or kite; perimeter is the sum of the sides. - **Coordinates:** cross product $0$ is parallel, dot product $0$ is perpendicular, squared distances for equal length; area is $\frac12\left|\sum(x_iy_{i+1}-x_{i+1}y_i)\right|$. - **Code:** use integers or `Fraction`, never float equality; order the vertices round the shape. ## Glossary: key terms - **Quadrilateral**: A polygon with four sides, four vertices and four interior angles that add up to 360 degrees. - **Parallelogram**: A quadrilateral whose two pairs of opposite sides are parallel, which makes opposite sides and opposite angles equal. - **Rectangle**: A quadrilateral with four right angles, which is a parallelogram with equal diagonals. - **Rhombus**: A quadrilateral with four equal sides, which is a parallelogram whose diagonals are perpendicular. - **Square**: A quadrilateral with four equal sides and four right angles, so it is both a rectangle and a rhombus. - **Kite**: A quadrilateral with two pairs of equal adjacent sides, whose diagonals are perpendicular. - **Trapezoid**: A quadrilateral with exactly one pair of parallel sides, called the bases, in the school definition used here. - **Diagonal**: A segment that joins two opposite vertices of a quadrilateral. - **Convex quadrilateral**: A quadrilateral in which every interior angle is less than 180 degrees and both diagonals lie inside. - **Shoelace formula**: A formula giving the area of a simple polygon as half the absolute sum of x sub i times y sub i plus 1 minus x sub i plus 1 times y sub i. - **Line of symmetry**: A line that divides a shape into two mirror-image halves, so that reflecting the shape in it leaves it unchanged. ## Frequently asked questions ### What is a quadrilateral? A quadrilateral is a polygon with four sides, four vertices and four interior angles. The angles of any simple quadrilateral add up to 360 degrees. It can be convex, concave, or crossed like a bow-tie. ### What are the types of quadrilaterals? The named types are the parallelogram, rectangle, rhombus, square, kite and trapezoid. A square is also a rectangle and a rhombus, and both of those are parallelograms. A trapezoid in the school definition has exactly one pair of parallel sides. ### Why do the angles of a quadrilateral add up to 360 degrees? A diagonal that lies inside the quadrilateral splits it into two triangles. Each triangle has angles adding up to 180 degrees, and the four angles of the quadrilateral are made of all six, so the total is 360 degrees. ### Is a square a rectangle? Yes. A rectangle is any quadrilateral with four right angles, and a square has them. A square is also a rhombus, a parallelogram and a kite. The reverse is false: a rectangle with unequal sides is not a square. ### What is the difference between a rhombus and a parallelogram? Every rhombus is a parallelogram, but not the other way round. A parallelogram has opposite sides parallel and equal; a rhombus also has all four sides equal, so its diagonals are perpendicular and bisect its angles. ### What are the properties of a parallelogram? Opposite sides are parallel and equal, opposite angles are equal, angles next to a side add up to 180 degrees, and the diagonals bisect each other. A diagonal splits it into two congruent triangles. ### How do you find the area of a trapezoid? Add the two parallel sides, multiply by the height and divide by two. For parallel sides 8 and 4 and height 4 the area is 12 times 4 over 2, which is 24. The height is the perpendicular distance between the parallel sides. ### How do you find the area of a rhombus or a kite? Multiply the two diagonals and divide by two. This works because the diagonals are perpendicular, so the rectangle drawn round the shape has exactly twice its area. A rhombus with diagonals 10 and 24 has area 120. ### What is the shoelace formula? It gives the area of a polygon from the coordinates of its vertices listed in order. For each edge compute x times the next y minus the next x times y, add them up and halve the absolute value. It is valid when the polygon does not cross itself. ### How can you tell from coordinates whether two sides are parallel? Write each side as a vector and compute the cross product, u1 times v2 minus v1 times u2. Parallel sides give exactly zero. This test needs no division, so it also works for vertical sides, where a slope is undefined. ### What is the difference between a trapezoid and a trapezium? They name the same shape in different countries: American English says trapezoid, and British English says trapezium, for a quadrilateral with a pair of parallel sides. Indonesian uses trapesium. Books also differ on whether a parallelogram counts, so check the definition. ### What is a concave quadrilateral? A concave quadrilateral has one interior angle greater than 180 degrees, so one vertex points inward and one diagonal lies outside the shape. A concave kite is called a dart or arrowhead. Its angles still add up to 360 degrees. ### How do you classify a quadrilateral in Python? Use integer or Fraction coordinates. Test parallel sides with the cross product being zero, right angles with the dot product being zero and equal sides by comparing squared distances. Avoid float equality, because 0.7 times 0.3 minus 0.1 times 2.1 is not exactly zero. --- # Segiempat: Jenis, Sifat, Keliling, dan Luas Source: https://nunada.my.id/artikel/segiempat/ Updated: 2026-10-10 ## Jawaban singkat **Segiempat adalah bangun tertutup dengan empat sisi lurus dan empat titik sudut, dan keempat sudut dalamnya selalu berjumlah 360°.** Jenis-jenis yang bernama adalah jajargenjang, persegi panjang, belah ketupat, persegi, layang-layang, dan trapesium, masing-masing ditentukan oleh sisi yang sejajar atau sama panjang dan sudut yang siku-siku. Keliling adalah jumlah keempat sisi; luas diperoleh dari rumus menurut jenisnya, atau dari koordinat titik sudut dengan rumus tali sepatu. ### Poin penting - Segiempat memiliki empat sisi, empat titik sudut, dan dua diagonal, dan sudut-sudut segiempat sederhana mana pun berjumlah $360^\circ$, karena satu diagonal memotongnya menjadi dua segitiga. - Jenis-jenisnya membentuk pohon keluarga: persegi adalah persegi panjang sekaligus belah ketupat; persegi panjang dan belah ketupat adalah jajargenjang; belah ketupat juga layang-layang; trapesium memiliki tepat satu pasang sisi sejajar. - Jajargenjang memiliki sisi berhadapan yang sama dan sejajar serta diagonal yang saling membagi dua; persegi panjang menambahkan diagonal sama panjang dan sudut siku-siku; belah ketupat menambahkan sisi sama panjang dan diagonal tegak lurus. - Luas: persegi panjang $lw$, jajargenjang $bh$, trapesium $\frac{(a+b)h}{2}$, dan $\frac{d_1d_2}{2}$ untuk belah ketupat atau layang-layang; keliling selalu jumlah keempat sisi. - Dengan koordinat, sejajar berarti hasil kali silang nol, tegak lurus berarti hasil kali titik nol, dan sama panjang berarti kuadrat jarak sama; luasnya setengah nilai mutlak jumlah tali sepatu. - Uji bangun dengan bilangan bulat atau pecahan eksak, jangan dengan float: $0{,}7\cdot0{,}3-0{,}1\cdot2{,}1$ bukan $0$ dalam titik mengambang, padahal dalam matematika hasilnya $0$. ## Apa itu segiempat? **Segiempat adalah poligon dengan tepat empat sisi, empat titik sudut, dan empat sudut dalam.** Kata Inggrisnya berasal dari bahasa Latin quattuor (empat) dan latus (sisi); quadrangle dan tetragon artinya sama. Segiempat diberi nama dari titik sudutnya secara berurutan mengelilingi bangun, misalnya $ABCD$. **Sisi**-nya adalah $AB$, $BC$, $CD$, dan $DA$. Dua sisi yang berbagi satu titik sudut **berdekatan**; $AB$ dan $CD$ **berhadapan**, begitu juga $BC$ dan $DA$. **Diagonal** menghubungkan dua titik sudut yang berhadapan: $AC$ dan $BD$. Ada tiga macam bentuk segiempat: - **Cembung.** Setiap sudut dalam kurang dari $180^\circ$ dan kedua diagonal berada di dalam bangun. - **Cekung.** Satu sudut dalam lebih dari $180^\circ$ dan satu diagonal berada di luar. Layang-layang cekung pada gambar kedua disebut dart atau kepala panah. - **Bersilang.** Dua sisi berhadapan saling memotong sehingga berbentuk pita. Segiempat bersilang bukan poligon sederhana, sehingga tidak punya satu bagian dalam, tidak punya luas dalam arti biasa, dan aturan dalam artikel ini tidak berlaku untuknya. Kecuali disebutkan lain, "segiempat" di bawah berarti segiempat sederhana: sisi-sisinya hanya bertemu di titik sudut. *Segiempat cembung ABCD. Garis putus-putus adalah kedua diagonalnya, AC dan BD; keduanya berada di dalam.* *Segiempat cekung (dart): sudut di D lebih dari 180°, dan diagonal AC berada di luar bangun.* ## Mengapa sudut-sudut segiempat berjumlah 360°? **Sudut dalam setiap segiempat sederhana berjumlah $360^\circ$, karena satu diagonal yang berada di dalamnya membaginya menjadi dua segitiga dan tiap segitiga memiliki jumlah sudut $180^\circ$.** Gambar diagonal $AC$ pada $ABCD$ yang cembung. Sudut di $A$ terbagi di antara segitiga $ABC$ dan $ACD$, begitu pula sudut di $C$, sedangkan $B$ milik segitiga pertama dan $D$ milik segitiga kedua. Keempat sudut segiempat itu dengan demikian tepat enam sudut dari kedua [segitiga](https://nunada.my.id/artikel/segitiga/#angle-sum), yang dikelompokkan ulang: $$\angle A+\angle B+\angle C+\angle D=180^\circ+180^\circ=360^\circ.$$ Hal yang sama berlaku untuk segiempat cekung: pakai diagonal yang berada di dalam, dan hitung sudut refleks (lebih dari $180^\circ$) apa adanya. Pada dart di bagian pertama sudut-sudutnya sekitar $37^\circ$, $53^\circ$, $37^\circ$, dan $233^\circ$, dan $37+53+37+233=360$. Poligon dengan $n$ sisi memiliki jumlah sudut $(n-2)\cdot180^\circ$: segilima memiliki $540^\circ$. Satu fakta ini menyelesaikan banyak soal. Jika tiga sudut adalah $70^\circ$, $95^\circ$, dan $120^\circ$, sudut keempat adalah $360-285=75^\circ$. Jika sudut-sudutnya berperbandingan $1:2:3:4$, namai $x,2x,3x,4x$ seperti pada [mengubah kata menjadi aljabar](https://nunada.my.id/artikel/bentuk-aljabar/#words-to-algebra): maka $10x=360$, sehingga $x=36^\circ$ dan sudut-sudutnya $36^\circ,72^\circ,108^\circ,144^\circ$. ## Apa saja jenis-jenis segiempat? **Segiempat yang bernama adalah jajargenjang, persegi panjang, belah ketupat, persegi, layang-layang, dan trapesium, dan semuanya membentuk pohon keluarga di mana setiap jenis khusus mempertahankan semua sifat jenis yang lebih umum.** | Jenis | Sifat penentu | |---|---| | Jajargenjang | kedua pasang sisi berhadapan sejajar | | Persegi panjang | empat sudut siku-siku | | Belah ketupat | empat sisi sama panjang | | Persegi | empat sisi sama panjang dan empat sudut siku-siku | | Layang-layang | dua pasang sisi berdekatan yang sama panjang | | Trapesium | tepat satu pasang sisi sejajar | | Trapesium sama kaki | trapesium yang kedua sisi tak sejajarnya (kaki) sama panjang | Baca tabel itu sebagai hierarki, dari yang umum ke yang khusus: - **Persegi** adalah persegi panjang (sudut siku-siku), belah ketupat (sisi sama panjang), jajargenjang, dan layang-layang, sekaligus. - Setiap **persegi panjang** dan setiap **belah ketupat** adalah jajargenjang, karena sisi berhadapannya sejajar. - Setiap **belah ketupat** adalah layang-layang, sebab keempat sisinya sama panjang sehingga sisi berdekatannya sama panjang berpasangan. - **Persegi panjang yang bukan persegi**, **jajargenjang yang bukan persegi panjang**, dan **layang-layang yang bukan belah ketupat** adalah kasus yang benar-benar berbeda. - **Trapesium** adalah cabang tersendiri: dengan satu pasang sisi sejajar, ia tidak pernah menjadi jajargenjang. Jadi "apakah persegi itu persegi panjang?" dijawab ya: persegi panjang adalah segiempat mana pun dengan empat sudut siku-siku, dan persegi memilikinya. Kebiasaan menganggap nama-nama itu kotak yang terpisah inilah yang dikoreksi oleh tabel di bagian berikutnya. > **Dua nama bergantung pada bukunya** > > **Trapesium dan layang-layang didefinisikan sedikit berbeda di buku yang berbeda, dan artikel ini memakai definisi eksklusif ala sekolah.** Di sini trapesium memiliki tepat satu pasang sisi sejajar, sehingga jajargenjang bukan trapesium; banyak buku perguruan tinggi menulis paling sedikit satu pasang, yang membuat setiap jajargenjang menjadi trapesium. Keduanya sah asalkan kamu menyebut yang kamu pakai. Namanya juga berbeda menurut negara: yang disebut trapezoid dalam bahasa Inggris Amerika adalah trapezium dalam bahasa Inggris Britania dan trapesium dalam bahasa Indonesia. Demikian pula layang-layang di sini boleh memiliki dua atau empat sisi berpasangan sama panjang, sehingga belah ketupat tergolong layang-layang; sebagian buku mengharuskan kedua pasangan itu berbeda. ## Apa saja sifat tiap segiempat? **Tiap jenis dibedakan oleh sisi, sudut, diagonal, dan simetrinya, dan tabel memuat semuanya untuk contoh khas tiap jenis.** Kasus khusus bisa memiliki lebih banyak: sebuah jajargenjang tertentu mungkin kebetulan persegi panjang. | Sifat | Jajargenjang | Persegi panjang | Belah ketupat | Persegi | Layang-layang | Trapesium sama kaki | |---|---|---|---|---|---|---| | Pasang sisi sejajar | 2 | 2 | 2 | 2 | 0 | 1 | | Sisi berhadapan sama panjang | ya | ya | ya | ya | tidak | tidak | | Keempat sisi sama panjang | tidak | tidak | ya | ya | tidak | tidak | | Sudut siku-siku | 0 | 4 | 0 | 4 | 0 | 0 | | Sudut berhadapan sama besar | ya | ya | ya | ya | satu pasang | tidak | | Diagonal sama panjang | tidak | ya | tidak | ya | tidak | ya | | Diagonal tegak lurus | tidak | tidak | ya | ya | ya | tidak | | Diagonal saling membagi dua | ya | ya | ya | ya | tidak | tidak | | Sumbu simetri | 0 | 2 | 2 | 4 | 1 | 1 | | Orde simetri putar | 2 | 2 | 2 | 4 | 1 | 1 | Beberapa di antaranya punya alasan yang rapi. Satu diagonal jajargenjang memotongnya menjadi dua segitiga yang kongruen, itulah sebabnya sisi berhadapan sama panjang, sudut berhadapan sama besar, dan diagonal saling membagi dua. Sudut-sudut yang berdekatan pada satu sisi jajargenjang berjumlah $180^\circ$, karena berada di antara dua garis sejajar. Pada layang-layang diagonal sepanjang sumbu simetri membagi dua diagonal lainnya secara tegak lurus, itulah sebabnya luasnya setengah hasil kali diagonal. Trapesium sama kaki memiliki sudut alas yang sama pada tiap pasang, sehingga ia punya satu sumbu simetri, melalui titik tengah kedua alasnya. Coba tiap jenis di bawah dan baca daftar sifatnya. **Diagonal persegi panjang dengan sisi $l$ dan $w$ sama panjang dan panjangnya $\sqrt{l^2+w^2}$, menurut teorema Pythagoras.** Untuk persegi panjang $6\times4$ itu $\sqrt{52}=2\sqrt{13}\approx7{,}21$, setelah kamu [menyederhanakan bentuk akar](https://nunada.my.id/artikel/eksponen-dan-akar/#simplify-radicals). Untuk persegi dengan sisi $s$ diagonalnya $s\sqrt2$, dan karena $\sqrt2$ [irasional](https://nunada.my.id/artikel/bilangan-irasional/#why-sqrt2-is-irrational), tidak ada persegi bersisi bilangan bulat yang diagonalnya bilangan bulat. Pada belah ketupat kedua diagonal berpotongan tegak lurus dan saling membagi dua, sehingga tiap sisi adalah [sisi miring](https://nunada.my.id/artikel/teorema-pythagoras/#what-is-the-theorem) segitiga siku-siku yang kakinya setengah dari tiap diagonal. Dengan diagonal $10$ dan $24$ kakinya $5$ dan $12$, sisinya $\sqrt{25+144}=13$, dan kelilingnya $4\cdot13=52$. ## Bagaimana mencari keliling dan luas segiempat? **Keliling adalah jumlah keempat sisi, dan luas diperoleh dari rumus menurut jenisnya: alas kali tinggi untuk jajargenjang, setengah hasil kali diagonal untuk belah ketupat atau layang-layang, dan setengah jumlah sisi sejajar kali tinggi untuk trapesium.** | Jenis | Keliling | Luas | |---|---|---| | Persegi (sisi $s$) | $4s$ | $s^2$ | | Persegi panjang (panjang $l$, lebar $w$) | $2(l+w)$ | $lw$ | | Jajargenjang (sisi $a,b$, alas $b$, tinggi $h$) | $2(a+b)$ | $bh$ | | Belah ketupat (sisi $s$, diagonal $d_1,d_2$) | $4s$ | $\frac{d_1d_2}{2}$ | | Layang-layang (sisi $a,b$, diagonal $d_1,d_2$) | $2(a+b)$ | $\frac{d_1d_2}{2}$ | | Trapesium (sisi sejajar $a,b$, kaki $c,d$, tinggi $h$) | $a+b+c+d$ | $\frac{(a+b)h}{2}$ | Tinggi adalah jarak tegak lurus antara sisi-sisi sejajar, bukan sisi yang miring. Keliling adalah panjang, dalam meter; luas adalah banyaknya persegi satuan, dalam meter persegi. Setiap rumus adalah persegi panjang yang menyamar: - **Jajargenjang.** Potong segitiga siku-siku dari satu ujung yang miring dan geser ke ujung lainnya: kamu mendapat persegi panjang dengan alas dan tinggi yang sama, sehingga luasnya $bh$. - **Trapesium.** Dua salinan, satu dibalik, bergabung menjadi jajargenjang dengan alas $a+b$ dan tinggi $h$. Trapesium adalah setengahnya, sehingga luasnya $\frac{(a+b)h}{2}$. - **Belah ketupat dan layang-layang.** Diagonalnya tegak lurus, sehingga persegi panjang $d_1\times d_2$ yang mengelilingi bangun itu luasnya tepat dua kali luas bangun: luasnya $\frac12d_1d_2$. Hal yang sama berlaku untuk setiap segiempat cembung yang diagonalnya tegak lurus. Untuk trapesium pada gambar, $a=8$, $b=4$, dan $h=4$ memberi $\frac{(8+4)\cdot4}{2}=24$. Tanda $\frac12$ dalam rumus-rumus ini adalah [perkalian pecahan](https://nunada.my.id/artikel/bilangan-rasional/#multiply-divide-fractions) biasa: setengah dari $48$ adalah $24$. Soal cerita: sebidang tanah berbentuk trapesium dengan sisi sejajar $30$ m dan $20$ m, berjarak $12$ m, dan harga tanah Rp500.000 per meter persegi. Luasnya $\frac{(30+20)\cdot12}{2}=300$ m², sehingga harga tanahnya 300 kali Rp500.000, yaitu Rp150.000.000. *Trapesium dengan sisi sejajar AB = 8 dan CD = 4. Garis putus-putus adalah tinggi h = 4, ditarik tegak lurus pada keduanya.* ## Bagaimana menentukan jenis dan luas segiempat dari koordinat? **Letakkan titik sudut pada kisi dan pakai tiga uji eksak: hasil kali silang nol berarti sejajar, hasil kali titik nol berarti tegak lurus, dan kuadrat jarak yang sama berarti panjang yang sama; luasnya setengah nilai mutlak jumlah tali sepatu.** Untuk sisi dari $P=(x_1,y_1)$ ke $Q=(x_2,y_2)$ tulis vektor $\vec{PQ}=(u,v)=(x_2-x_1,\,y_2-y_1)$. Untuk dua vektor $(u_1,v_1)$ dan $(u_2,v_2)$: - keduanya **sejajar** tepat bila $u_1v_2-v_1u_2=0$ (hasil kali silang); - keduanya **tegak lurus** tepat bila $u_1u_2+v_1v_2=0$ (hasil kali titik); - sebuah sisi memiliki **panjang** $\sqrt{u^2+v^2}$, sehingga dua sisi sama panjang tepat bila $u^2+v^2$ sama; tidak perlu akar. Uji-uji ini hanya memakai perkalian dan penjumlahan, sehingga pada koordinat bilangan bulat atau pecahan hasilnya eksak, dan sisi tegak pun tertangani, padahal gradien akan membagi dengan nol. Ambil $A(0,0)$, $B(6,0)$, $C(8,4)$, $D(2,4)$. Sisi-sisinya $\vec{AB}=(6,0)$, $\vec{BC}=(2,4)$, $\vec{CD}=(-6,0)$, $\vec{DA}=(-2,-4)$. Hasil kali silang $6\cdot0-0\cdot(-6)$ dan $2\cdot(-4)-4\cdot(-2)$ keduanya $0$, sehingga kedua pasang sisi berhadapan sejajar: jajargenjang. Kuadrat sisinya $36$ dan $20$, sehingga bukan belah ketupat, dan $\vec{AB}\cdot\vec{BC}=12\ne0$, sehingga bukan persegi panjang. Untuk luas pakai **rumus tali sepatu** (rumus luas Gauss, disebut juga rumus juru ukur). Daftar titik sudut berurutan dan jumlahkan $x_iy_{i+1}-x_{i+1}y_i$ pada keempat sisi, dengan kembali ke titik pertama di akhir: $$\text{luas}=\tfrac12\left|\sum_{i}\bigl(x_iy_{i+1}-x_{i+1}y_i\bigr)\right|.$$ Untuk jajargenjang di atas keempat sukunya $0,\,24,\,24,\,0$, jumlahnya $48$, dan luasnya $24=6\cdot4$, alas kali tinggi, sebagaimana mestinya. Untuk $A(0,0)$, $B(6,0)$, $C(6,4)$, $D(2,6)$ sukunya $0,24,28,0$, sehingga luasnya $26$; periksa dengan membagi menjadi segitiga $ABC$ ($12$) dan $ACD$ ($14$). Tanda jumlahnya menunjukkan arah: positif untuk titik sudut berlawanan arah jarum jam, negatif untuk searah jarum jam, itulah sebabnya kita ambil nilai mutlak. Urutannya penting. Pita seperti $(0,0),(4,4),(4,0),(0,4)$ memberi jumlah tepat $0$, karena kedua kelopaknya saling meniadakan: rumus ini hanya merupakan luas untuk poligon sederhana. ## Bagaimana mengklasifikasikan segiempat dalam kode? **Tulis ketiga uji itu sebagai fungsi kecil pada koordinat bilangan bulat atau `Fraction`, dan pengklasifikasinya hanya beberapa perbandingan.** Kode ini mengandaikan `a, b, c, d` adalah titik sudut berurutan pada segiempat cembung sederhana. ```python from fractions import Fraction as F def sub(p, q): return (p[0] - q[0], p[1] - q[1]) def cross(u, v): return u[0] * v[1] - u[1] * v[0] def dot(u, v): return u[0] * v[0] + u[1] * v[1] def d2(p, q): return dot(sub(p, q), sub(p, q)) # squared length def kind(a, b, c, d): ab, bc, cd, da = sub(b, a), sub(c, b), sub(d, c), sub(a, d) p1, p2 = cross(ab, cd) == 0, cross(bc, da) == 0 # AB || CD, BC || DA s = [d2(a, b), d2(b, c), d2(c, d), d2(d, a)] if p1 and p2: rhombus, right = len(set(s)) == 1, dot(ab, bc) == 0 if rhombus and right: return "square" if right: return "rectangle" return "rhombus" if rhombus else "parallelogram" if p1 or p2: return "trapezoid" if (s[0] == s[1] and s[2] == s[3]) or (s[0] == s[3] and s[1] == s[2]): return "kite" return "none of these" def area(*pts): s = sum(p[0] * q[1] - q[0] * p[1] for p, q in zip(pts, pts[1:] + pts[:1])) return F(abs(s), 2) >>> kind((0, 0), (6, 0), (8, 4), (2, 4)) 'parallelogram' >>> kind((4, 0), (8, 3), (4, 6), (0, 3)) 'rhombus' >>> kind((0, 0), (3, 2), (0, 6), (-3, 2)) 'kite' >>> area((0, 0), (6, 0), (6, 4), (2, 6)) Fraction(26, 1) >>> area((F(1, 2), 0), (4, 0), (4, F(7, 3)), (0, 2)) # fractions stay exact Fraction(49, 6) >>> 0.7 * 0.3 - 0.1 * 2.1 # should be 0 ... -2.7755575615628914e-17 >>> F(7, 10) * F(3, 10) - F(1, 10) * F(21, 10) # ... and with fractions it is Fraction(0, 1) ``` ```javascript const cross = (u, v) => u[0] * v[1] - u[1] * v[0] cross([6, 0], [-6, 0]) // 0: parallel (exact for small integers) cross([0.7, 0.1], [2.1, 0.3]) // -2.7755575615628914e-17, not 0 Math.abs(cross([0.7, 0.1], [2.1, 0.3])) < 1e-9 // true: with floats, compare with a tolerance const shoelace = (pts) => Math.abs(pts.reduce((s, [x, y], i) => { const [u, v] = pts[(i + 1) % pts.length]; return s + x * v - u * y }, 0)) / 2 shoelace([[0, 0], [6, 0], [6, 4], [2, 6]]) // 26 ``` ```cpp #include #include using namespace std; int cross(int ux, int uy, int vx, int vy) { return ux * vy - uy * vx; } int dot(int ux, int uy, int vx, int vy) { return ux * vx + uy * vy; } int d2(int px, int py, int qx, int qy) { return (px - qx) * (px - qx) + (py - qy) * (py - qy); } const char* kind(int ax, int ay, int bx, int by, int cx, int cy, int dx, int dy) { bool p1 = cross(bx - ax, by - ay, dx - cx, dy - cy) == 0; // AB parallel to CD bool p2 = cross(cx - bx, cy - by, ax - dx, ay - dy) == 0; // BC parallel to DA int s0 = d2(ax, ay, bx, by), s1 = d2(bx, by, cx, cy), s2 = d2(cx, cy, dx, dy), s3 = d2(dx, dy, ax, ay); if (p1 && p2) { bool rhombus = s0 == s1 && s1 == s2 && s2 == s3; bool right = dot(bx - ax, by - ay, cx - bx, cy - by) == 0; if (rhombus && right) return "square"; if (right) return "rectangle"; return rhombus ? "rhombus" : "parallelogram"; } if (p1 || p2) return "trapezoid"; if ((s0 == s1 && s2 == s3) || (s0 == s3 && s1 == s2)) return "kite"; return "none of these"; } int twiceArea(int x[], int y[], int n) { // the shoelace formula, doubled: whole numbers int s = 0; for (int i = 0; i < n; i++) s += x[i] * y[(i + 1) % n] - x[(i + 1) % n] * y[i]; return s < 0 ? -s : s; } int main() { cout << kind(0, 0, 6, 0, 8, 4, 2, 4) << endl; // parallelogram cout << kind(4, 0, 8, 3, 4, 6, 0, 3) << endl; // rhombus cout << kind(0, 0, 3, 2, 0, 6, -3, 2) << endl; // kite int x[4] = {0, 6, 6, 2}, y[4] = {0, 0, 4, 6}; cout << twiceArea(x, y, 4) / 2 << endl; // 26 printf("%.20f\n", 0.7 * 0.3 - 0.1 * 2.1); // should be 0 ... cout << 7 * 3 - 1 * 21 << endl; // ... and with whole numbers (tenths) it is return 0; } /* output: parallelogram rhombus kite 26 -0.00000000000000002776 0 */ ``` Jebakannya, berdasarkan seberapa sering terjadi: | Jebakan | Yang terjadi | Yang sebaiknya dilakukan | |---|---|---| | Menguji sejajar dengan float | `0.7 0.3 - 0.1 2.1 == 0` bernilai salah | pakai bilangan bulat atau `Fraction`, seperti pada artikel [pecahan dalam kode](https://nunada.my.id/artikel/bilangan-rasional/#fractions-in-code); atau bandingkan dengan toleransi | | Memakai gradien | sisi tegak membagi dengan 0 | pakai hasil kali silang | | Titik sudut tidak berurutan | `a, c, b, d` menggambarkan pita, dan luasnya salah | urutkan titik sudut mengelilingi bangun lebih dulu | | Lupa `abs` pada jumlah tali sepatu | poligon searah jarum jam berluas negatif | ambil nilai mutlak | | Membandingkan sisi dengan `sqrt` | pembulatan membuat sisi yang sama jadi tak sama | bandingkan kuadrat panjangnya | | Masukan yang runtuh | tiga titik segaris membentuk segitiga, bukan segiempat | periksa bahwa tidak ada tiga hasil kali silang berurutan yang 0 | | Bangun cekung | pengklasifikasi di atas menyebut dart sebagai layang-layang | periksa dulu bahwa keempat belokan searah | ## Dari mana asal segiempat? **Segiempat termasuk bangun tertua dalam matematika, karena ladang, dinding, dan ubin berbentuk bersisi empat, dan nama-nama yang kita pakai sebagian besar berasal dari bahasa Yunani.** - **Sekitar 1550 SM.** Papirus Rhind, soal 52, mencari luas trapesium, yang digambarkan juru tulis Mesir sebagai segitiga yang ujungnya dipotong. - **Sekitar 300 SM.** Elements Euclid, Buku I, definisi 22, menamai persegi, oblong (persegi panjang kita), belah ketupat, dan rhomboid (jajargenjang kita), dan menyebut segiempat lainnya trapezium. Proposisi I.34 membuktikan bahwa sisi dan sudut berhadapan jajargenjang sama dan bahwa diagonal membaginya menjadi dua bagian sama. Penulis Yunani kemudian mempersempit trapezium menjadi segiempat dengan sepasang sisi sejajar. - **Sekitar 150 M.** Teorema Ptolemaios: pada segiempat yang titik sudutnya terletak pada sebuah [lingkaran](https://nunada.my.id/artikel/lingkaran/#angle-theorems), hasil kali diagonal sama dengan jumlah hasil kali sisi-sisi berhadapan. - **628 M.** Brahmagupta memberikan luas segiempat yang terletak dalam lingkaran, $\sqrt{(s-a)(s-b)(s-c)(s-d)}$, dengan $s$ setengah keliling. Rumus ini menggeneralisasi rumus Heron untuk segitiga. - **1769.** Albrecht Meister menguraikan rumus tali sepatu untuk luas poligon dari koordinatnya; kini rumus ini juga dikenal dengan nama Gauss, dan sebagai rumus juru ukur. Namanya sendiri bergeser. Seiring waktu bahasa Inggris Britania mempertahankan trapezium untuk segiempat dengan sepasang sisi sejajar, sedangkan bahasa Inggris Amerika beralih ke trapezoid, sehingga satu bangun kini punya dua nama. ## Apa kesalahan umum pada segiempat? **Kesalahan paling umum pada segiempat adalah sembilan hal berikut, masing-masing dengan pernyataan yang benar.** | Kesalahan | Yang benar | |---|---| | ❌ Persegi bukan persegi panjang | Persegi adalah persegi panjang: ia memiliki empat sudut siku-siku. Setiap persegi adalah persegi panjang sekaligus belah ketupat. | | ❌ Diagonal persegi panjang tegak lurus | Diagonalnya sama panjang dan saling membagi dua; tegak lurus hanya pada persegi. | | ❌ Diagonal jajargenjang sama panjang | Hanya untuk persegi panjang; secara umum berbeda, tetapi selalu saling membagi dua. | | ❌ Luas jajargenjang adalah hasil kali dua sisi bertetangga | Luasnya alas kali tinggi; sisi yang miring lebih panjang daripada tinggi. | | ❌ Luas belah ketupat adalah $s^2$ | Itu persegi. Belah ketupat memiliki $\frac{d_1d_2}{2}$, atau alas kali tinggi. | | ❌ Luas trapesium adalah $abh$ | Luasnya $\frac{(a+b)h}{2}$: rata-rata sisi sejajar kali tinggi. | | ❌ Sudut segiempat berjumlah $180^\circ$ | Itu segitiga. Segiempat berjumlah $360^\circ$. | | ❌ Diagonal layang-layang saling membagi dua | Hanya diagonal sumbu yang membagi dua diagonal lainnya; keduanya tegak lurus. | | ❌ Menamai titik sudut dalam urutan sembarang | $ABCD$ harus mengelilingi bangun; $ACBD$ dapat menggambarkan pita. | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: segiempat sekilas - **Definisi:** empat sisi, empat titik sudut, dua diagonal; sudut segiempat sederhana berjumlah $360^\circ$. - **Pohon keluarga:** persegi $\subset$ persegi panjang, belah ketupat $\subset$ jajargenjang; belah ketupat $\subset$ layang-layang; trapesium memiliki tepat satu pasang sisi sejajar. - **Jajargenjang:** sisi berhadapan sejajar dan sama panjang, sudut berhadapan sama besar, diagonal saling membagi dua. - **Persegi panjang / belah ketupat / persegi:** diagonal sama panjang / diagonal tegak lurus / keduanya. - **Luas:** $lw$, $bh$, $\frac{(a+b)h}{2}$, dan $\frac{d_1d_2}{2}$ untuk belah ketupat atau layang-layang; keliling adalah jumlah sisi-sisinya. - **Koordinat:** hasil kali silang $0$ berarti sejajar, hasil kali titik $0$ berarti tegak lurus, kuadrat jarak untuk panjang yang sama; luasnya $\frac12\left|\sum(x_iy_{i+1}-x_{i+1}y_i)\right|$. - **Kode:** pakai bilangan bulat atau `Fraction`, jangan kesamaan float; urutkan titik sudut mengelilingi bangun. ## Glosarium: istilah penting - **Segiempat**: Poligon dengan empat sisi, empat titik sudut, dan empat sudut dalam yang berjumlah 360 derajat. - **Jajargenjang**: Segiempat yang kedua pasang sisi berhadapannya sejajar, sehingga sisi dan sudut berhadapannya sama. - **Persegi panjang**: Segiempat dengan empat sudut siku-siku, yaitu jajargenjang dengan diagonal sama panjang. - **Belah ketupat**: Segiempat dengan empat sisi sama panjang, yaitu jajargenjang yang diagonalnya tegak lurus. - **Persegi**: Segiempat dengan empat sisi sama panjang dan empat sudut siku-siku, sehingga ia persegi panjang sekaligus belah ketupat. - **Layang-layang**: Segiempat dengan dua pasang sisi berdekatan yang sama panjang, yang diagonalnya tegak lurus. - **Trapesium**: Segiempat dengan tepat satu pasang sisi sejajar, yang disebut alas, dalam definisi sekolah yang dipakai di sini. - **Diagonal**: Ruas garis yang menghubungkan dua titik sudut berhadapan pada segiempat. - **Segiempat cembung**: Segiempat yang setiap sudut dalamnya kurang dari 180 derajat dan kedua diagonalnya berada di dalam. - **Rumus tali sepatu**: Rumus yang memberi luas poligon sederhana sebagai setengah nilai mutlak jumlah x indeks i kali y indeks i tambah 1 dikurangi x indeks i tambah 1 kali y indeks i. - **Sumbu simetri**: Garis yang membagi bangun menjadi dua bagian bayangan cermin, sehingga pencerminan bangun terhadapnya tidak mengubahnya. ## Pertanyaan yang sering diajukan ### Apa itu segiempat? Segiempat adalah poligon dengan empat sisi, empat titik sudut, dan empat sudut dalam. Sudut segiempat sederhana mana pun berjumlah 360 derajat. Ia bisa cembung, cekung, atau bersilang seperti pita. ### Apa saja jenis-jenis segiempat? Jenis yang bernama adalah jajargenjang, persegi panjang, belah ketupat, persegi, layang-layang, dan trapesium. Persegi juga persegi panjang dan belah ketupat, dan keduanya jajargenjang. Trapesium dalam definisi sekolah memiliki tepat satu pasang sisi sejajar. ### Mengapa sudut segiempat berjumlah 360 derajat? Diagonal yang berada di dalam segiempat membaginya menjadi dua segitiga. Sudut tiap segitiga berjumlah 180 derajat, dan keempat sudut segiempat tersusun dari keenam sudut itu, sehingga totalnya 360 derajat. ### Apakah persegi itu persegi panjang? Ya. Persegi panjang adalah segiempat mana pun dengan empat sudut siku-siku, dan persegi memilikinya. Persegi juga belah ketupat, jajargenjang, dan layang-layang. Kebalikannya salah: persegi panjang dengan sisi tak sama bukan persegi. ### Apa beda belah ketupat dan jajargenjang? Setiap belah ketupat adalah jajargenjang, tetapi tidak sebaliknya. Jajargenjang memiliki sisi berhadapan yang sejajar dan sama panjang; belah ketupat juga memiliki keempat sisi sama panjang, sehingga diagonalnya tegak lurus dan membagi dua sudutnya. ### Apa sifat-sifat jajargenjang? Sisi berhadapan sejajar dan sama panjang, sudut berhadapan sama besar, sudut yang berdekatan pada satu sisi berjumlah 180 derajat, dan diagonal saling membagi dua. Satu diagonal membaginya menjadi dua segitiga yang kongruen. ### Bagaimana mencari luas trapesium? Jumlahkan kedua sisi sejajar, kalikan dengan tinggi, lalu bagi dua. Untuk sisi sejajar 8 dan 4 dan tinggi 4, luasnya 12 kali 4 dibagi 2, yaitu 24. Tinggi adalah jarak tegak lurus antara sisi-sisi sejajar. ### Bagaimana mencari luas belah ketupat atau layang-layang? Kalikan kedua diagonal lalu bagi dua. Ini berlaku karena diagonalnya tegak lurus, sehingga persegi panjang yang mengelilingi bangun itu luasnya tepat dua kali luas bangun. Belah ketupat dengan diagonal 10 dan 24 berluas 120. ### Apa itu rumus tali sepatu? Rumus ini memberi luas poligon dari koordinat titik sudutnya yang dituliskan berurutan. Untuk tiap sisi hitung x kali y berikutnya dikurangi x berikutnya kali y, jumlahkan, lalu setengahkan nilai mutlaknya. Rumus berlaku bila poligon tidak memotong dirinya sendiri. ### Bagaimana mengetahui dari koordinat bahwa dua sisi sejajar? Tulis tiap sisi sebagai vektor dan hitung hasil kali silang, u1 kali v2 dikurangi v1 kali u2. Sisi sejajar memberi tepat nol. Uji ini tidak memakai pembagian, sehingga berlaku juga untuk sisi tegak, di mana gradien tidak terdefinisi. ### Apa beda trapezoid dan trapezium? Keduanya menamai bangun yang sama di negara berbeda: bahasa Inggris Amerika menyebut trapezoid dan bahasa Inggris Britania menyebut trapezium untuk segiempat dengan sepasang sisi sejajar. Bahasa Indonesia memakai trapesium. Buku juga berbeda soal apakah jajargenjang termasuk, jadi periksa definisinya. ### Apa itu segiempat cekung? Segiempat cekung memiliki satu sudut dalam lebih dari 180 derajat, sehingga satu titik sudut menjorok ke dalam dan satu diagonal berada di luar bangun. Layang-layang cekung disebut dart atau kepala panah. Sudutnya tetap berjumlah 360 derajat. ### Bagaimana mengklasifikasikan segiempat di Python? Pakai koordinat bilangan bulat atau Fraction. Uji sisi sejajar dengan hasil kali silang sama dengan nol, sudut siku-siku dengan hasil kali titik sama dengan nol, dan sisi sama panjang dengan membandingkan kuadrat jarak. Hindari kesamaan float, karena 0,7 kali 0,3 dikurangi 0,1 kali 2,1 tidak tepat nol. --- # Geometric Sequences and Series: Ratio, Sums and Growth Source: https://nunada.my.id/articles/geometric-sequences-and-series/ Updated: 2026-10-10 ## Quick answer **A geometric sequence is a list of numbers in which each term is the previous one multiplied by the same fixed number $r$, the common ratio: $3,6,12,24,\ldots$ has $r=2$.** Its $n$-th term is $a_n=a_1r^{n-1}$, and the sum of the first $n$ terms is $S_n=\dfrac{a_1(1-r^n)}{1-r}$ for $r\neq1$. An infinite geometric series has a sum, $\dfrac{a_1}{1-r}$, only when $|r|<1$; otherwise it diverges. ### Key takeaways - In a geometric sequence the ratio of neighbors is constant: $\dfrac{a_{n+1}}{a_n}=r$, so each step multiplies by $r$ where an arithmetic sequence adds. - The $n$-th term is $a_n=a_1r^{n-1}$, an exponential function of $n$: $|r|>1$ grows, $0<|r|<1$ decays, and a negative $r$ alternates in sign. - Two terms give the ratio: $r^{q-p}=\dfrac{a_q}{a_p}$; $k$ geometric means between $a$ and $b$ have $r^{k+1}=\dfrac ba$. - The sum of $n$ terms is $S_n=a_1\dfrac{1-r^n}{1-r}$ (and $na_1$ if $r=1$), found by subtracting $rS_n$ from $S_n$. - If $|r|<1$ the infinite series converges to $S_\infty=\dfrac{a_1}{1-r}$; this turns repeating decimals into fractions, as in $0.\overline{3}=\frac13$. - Compound interest, depreciation and half-life are all geometric: a rise of $p\%$ has $r=1+\frac p{100}$ and a fall has $r=1-\frac p{100}$. ## What is a geometric sequence? **A geometric sequence (or geometric progression) is a list of non-zero numbers $a_1,a_2,a_3,\ldots$ in which the ratio of each term to the one before it is always the same number $r$, called the common ratio.** The rule is $a_{n+1}=r\,a_n$: to get the next term, multiply by $r$. | Sequence | Common ratio | Behavior | |---|---|---| | $3,6,12,24,\ldots$ | $r=2$ | doubling: grows | | $81,27,9,3,\ldots$ | $r=\frac13$ | shrinks toward 0 | | $5,-10,20,-40,\ldots$ | $r=-2$ | alternates in sign, grows in size | | $7,7,7,7,\ldots$ | $r=1$ | constant | | $1,0.1,0.01,\ldots$ | $r=0.1$ | shrinks toward 0 | | $2,4,6,8,\ldots$ | ratios $2,\frac32,\frac43$ | **not** geometric: it adds 2 each time | | $1,4,9,16,\ldots$ | ratios $4,\frac94,\frac{16}9$ | **not** geometric (and not arithmetic) | **How to tell.** Divide each term by the one before it, later over earlier. If every ratio is the same, the sequence is geometric. No term may be 0, because the ratio of a term to 0 is undefined and a 0 would make every later term 0. **Compare with arithmetic.** An [arithmetic sequence](https://nunada.my.id/articles/arithmetic-sequences-and-series/#what-is-an-arithmetic-sequence) adds the same amount each step, so its terms lie on a straight line; a geometric sequence multiplies, so its terms lie on an exponential curve and eventually leave any arithmetic sequence far behind. **The geometric mean.** For three neighbors of the same sign $a_n^2=a_{n-1}a_{n+1}$, so each term is the geometric mean $\sqrt{ab}$ of the two beside it, as each term of an arithmetic sequence is their arithmetic mean. That is where the name comes from. Type a list of numbers below and see whether it is geometric. ## How do you find the n-th term of a geometric sequence? **The $n$-th term of a geometric sequence is $a_n=a_1r^{n-1}$: start at the first term and multiply by the ratio $n-1$ times.** As in the arithmetic case, going from term 1 to term $n$ takes $n-1$ steps. For $3,6,12,\ldots$ we have $a_1=3$ and $r=2$, so $a_n=3\cdot2^{n-1}$ and $a_{10}=3\cdot2^9=1536$. For $64,32,16,\ldots$, $r=\frac12$ and $a_7=64\cdot\left(\frac12\right)^6=1$. **It is an exponential function.** Writing $a_n=\frac{a_1}{r}\,r^n$ shows the variable $n$ in an exponent, so the laws of [exponents](https://nunada.my.id/articles/exponents-and-radicals/#laws-of-exponents) apply, and the points of the sequence lie on a curve rather than a line. The size of $r$ decides the picture: - $r>1$: exponential growth. The terms get larger faster and faster. - $01$ or shrink if $|r|<1$. - $r=1$: constant. $r=-1$: the sequence alternates between $a_1$ and $-a_1$. **Why it feels so fast.** A penny, doubled each day for 30 days, is worth $2^{29}$ cents on day 30, which is 5,368,709.12 dollars; adding a fixed 1,000 dollars a day would give only 30,000 dollars. Doubling beats any fixed addition in the end. **Which term is a given number?** Solve $a_1r^{n-1}=L$. For $3,6,12,\ldots,768$: $\frac{768}{3}=256=2^8$, so $n-1=8$ and $n=9$. When the ratio is not a neat power, the number of terms needs logarithms, which are the inverse of the exponent. Choose a first term, a ratio and a length below and watch the bars. ## How do you find the ratio from two terms, and what is a geometric mean? **Two terms and their positions give the ratio: between term $p$ and term $q$ there are $q-p$ multiplications by $r$, so $a_q=a_p\,r^{q-p}$ and $r^{q-p}=\dfrac{a_q}{a_p}$.** Then $a_1=a_p\div r^{p-1}$. Example: $a_2=6$ and $a_5=48$. Then $r^3=\frac{48}{6}=8$, so $r=2$ and $a_1=\frac62=3$: the sequence is $3,6,12,24,48,\ldots$ **How many answers?** Taking a root can give two. If the number of steps $q-p$ is odd there is one real ratio, with the sign of $\frac{a_q}{a_p}$. If it is even there are two, $+r$ and $-r$, provided $\frac{a_q}{a_p}$ is positive: $a_1=3$ and $a_3=12$ fit both $3,6,12,\ldots$ and $3,-6,12,\ldots$. If it is negative and the number of steps is even, no real ratio exists. And the ratio need not be a fraction: $a_1=1$ and $a_3=2$ give $r=\pm\sqrt2$, which is [irrational](https://nunada.my.id/articles/irrational-numbers/#which-roots-are-irrational). **Geometric means.** Inserting $k$ numbers between $a$ and $b$ so that the whole list is geometric is the same problem with $k+1$ steps: $r^{k+1}=\frac ba$. Two means between 3 and 81 have $r^3=27$, so $r=3$ and the means are 9 and 27. With a single mean, $r^2=\frac ba$ and the mean is $\sqrt{ab}$: between 2 and 32 it is $\sqrt{64}=8$. **Why the geometric mean matters.** When a quantity grows by factors, the right average is the geometric one. Prices that rise by 10% and then 20% have grown by the factors 1.1 and 1.2, whose geometric mean is $\sqrt{1.1\cdot1.2}\approx1.149$, an average of about 14.9% a period, not the 15% that averaging the percentages would suggest. Try two terms of your own below. ## How do you find the sum of a geometric series? **The sum of the first $n$ terms of a geometric sequence with $r\neq1$ is $S_n=\dfrac{a_1(1-r^n)}{1-r}$, which is the same as $\dfrac{a_1(r^n-1)}{r-1}$; if $r=1$ every term is $a_1$ and $S_n=na_1$.** A sum of terms like this is a geometric series. **Where the formula comes from.** Multiply the sum by $r$ and subtract; nearly everything cancels: $S_n=a_1+a_1r+a_1r^2+\cdots+a_1r^{n-1}$ $rS_n=\ \ \ \ \ \ \ \,a_1r+a_1r^2+\cdots+a_1r^{n-1}+a_1r^{n}$ $S_n-rS_n=a_1-a_1r^n\quad\Rightarrow\quad S_n(1-r)=a_1(1-r^n)$ Dividing by $1-r$ is allowed only when $r\neq1$, which is why that case is separate. **Examples.** - $3+6+12+\cdots$ with 10 terms: $S_{10}=\frac{3(2^{10}-1)}{2-1}=3069$. - $1+\frac12+\frac14+\cdots+\frac1{512}$ with 10 terms: $S_{10}=\frac{1-(1/2)^{10}}{1-1/2}=2-\frac1{512}=\frac{1023}{512}$. - The Rhind Papyrus problem of seven houses with seven cats, seven mice, seven ears of wheat and seven measures of grain adds $7+49+343+2401+16807=19607$, which is $\frac{7(7^5-1)}{6}$. - **The chessboard.** One grain on the first square, two on the second, doubling on each of the 64 squares, gives $2^{64}-1=18{,}446{,}744{,}073{,}709{,}551{,}615$ grains, far more than the world has grown. **A link with binary.** With $a_1=1$ and $r=2$ the sum is $1+2+4+\cdots+2^{n-1}=2^n-1$, which is the number written as $n$ ones in binary: $11111111_2=255=2^8-1$, as in the article on [binary numbers](https://nunada.my.id/articles/binary-numbers/#bits-and-bytes). Watch the subtraction and the sum below, together with the partial sums. ## When does an infinite geometric series have a sum? **An infinite geometric series has a sum exactly when $|r|<1$, and then $S_\infty=\dfrac{a_1}{1-r}$; for $|r|\ge1$ it diverges (unless every term is 0).** The reason is in the finite formula: $S_n=\dfrac{a_1(1-r^n)}{1-r}$, and when $|r|<1$ the power $r^n$ shrinks to 0, so $S_n$ approaches $\dfrac{a_1}{1-r}$. The gap after $n$ terms is exactly $\dfrac{a_1r^n}{1-r}$, which can be made as small as you like. - $\frac12+\frac14+\frac18+\cdots=\dfrac{1/2}{1-1/2}=1$: halving what is left of a unit square, over and over, fills the square. - $6+4+\frac83+\cdots$ has $r=\frac23$, so $S_\infty=\frac{6}{1/3}=18$. - $1-\frac12+\frac14-\cdots$ has $r=-\frac12$, so $S_\infty=\frac{1}{3/2}=\frac23$. - $1+\frac14+\frac1{16}+\cdots=\frac43$, the series Archimedes used for the area of a parabolic segment. For $|r|\ge1$ the partial sums do not settle: $r=1$ gives $na_1$, which grows; $r=-1$ gives $a_1,0,a_1,0,\ldots$; and $|r|>1$ grows without bound, as $1+2+4+8+\cdots$ does. The formula $\frac{a_1}{1-r}$ would give $-1$ for that last series, which is meaningless, so check $|r|<1$ before using it. An arithmetic series never converges, as the [infinite arithmetic series](https://nunada.my.id/articles/arithmetic-sequences-and-series/#infinite-arithmetic-series) section shows. **Repeating decimals are geometric series.** $0.\overline{3}=\frac3{10}+\frac3{100}+\cdots$ has $a_1=\frac3{10}$ and $r=\frac1{10}$, so it is $\frac{3/10}{9/10}=\frac13$. In the same way $0.\overline{9}=\frac{9/10}{9/10}=1$ exactly, and $0.\overline{27}=\frac{27/100}{99/100}=\frac{3}{11}$. A repeating block of $m$ digits has $r=10^{-m}$. This is the method behind the conversion of repeating decimals to fractions in the article on [real numbers](https://nunada.my.id/articles/real-numbers/#rational-numbers), and it is why [every repeating decimal is rational](https://nunada.my.id/articles/rational-numbers/#decimals-percent). **Zeno's paradox.** Achilles runs after a tortoise that has a head start. Each time he reaches where the tortoise was, it has moved a little further, so there are infinitely many steps. But the times of the steps form a geometric series with a finite sum, so Achilles does pass the tortoise, at a definite moment. **A bouncing ball.** Dropped from 10 m and bouncing back to $\frac35$ of its previous height each time, a ball travels $10+2\left(6+3.6+2.16+\cdots\right)=10+2\cdot\dfrac{6}{1-3/5}=40$ m in all. ## Where do geometric sequences appear: interest, decay and growth? **Anything that changes by a fixed percentage each period is a geometric sequence: a rise of $p\%$ multiplies by $r=1+\frac p{100}$ and a fall of $p\%$ multiplies by $r=1-\frac p{100}$.** Note that a 5% increase has ratio 1.05, not 0.05, and a 20% decrease has ratio 0.8, not 0.2. | Situation | Setup | Result | |---|---|---| | Savings of 1,000 dollars earn 5% a year, compounded | $r=1.05$ | after 10 years $1000\cdot1.05^{10}\approx1628.89$ dollars | | A car worth 20,000 dollars loses 20% of its value each year | $r=0.8$ | after 3 years $20000\cdot0.8^3=10240$ dollars | | 200 mg of caffeine with a half-life of 5 hours | $r=\frac12$ per 5 hours | after 15 hours $200\cdot\frac18=25$ mg | | A sheet of paper 0.1 mm thick, folded in half 10 times | $r=2$ | $0.1\cdot2^{10}=102.4$ mm | | A savings plan of 100 dollars at the end of each month at 1% a month | a geometric sum | after 12 months $100\cdot\frac{1.01^{12}-1}{0.01}\approx1268.25$ dollars | **Compound interest** gives the balance $P\,(1+i)^n$ after $n$ periods at rate $i$ per period. Interest that is added only to the original deposit instead gives an [arithmetic sequence](https://nunada.my.id/articles/arithmetic-sequences-and-series/#word-problems). Compounding more often helps only a little: the factor $\left(1+\frac1n\right)^n$ approaches the irrational number $e\approx2.71828$, which Jacob Bernoulli met in 1683 while studying exactly this, as the article on [π, e and transcendental numbers](https://nunada.my.id/articles/irrational-numbers/#pi-e-transcendental) recounts. **Decay never reaches zero.** A half-life, a depreciating value or a cooling difference in temperature keeps getting multiplied by a ratio below 1, so it shrinks toward 0 without ever being 0. **Annuities** are sums of geometric series. Each deposit grows by $r=1+i$ for a different number of periods, so the total is $P\,\bigl(1+(1+i)+\cdots+(1+i)^{n-1}\bigr)=P\,\dfrac{(1+i)^n-1}{i}$, the sum formula with ratio $1+i$. **Folding paper** shows how fast doubling is. A sheet 0.1 mm thick folded 42 times, which cannot actually be done, would be $0.1\cdot2^{42}$ mm, about 440,000 km, more than the distance to the Moon. ## How do you work with geometric sequences in Python and JavaScript? **Build the terms with the power operator, `a1 * r ** i` in both languages, and use `fractions.Fraction` in Python when the sum must be exact.** Powers grow or shrink so fast that floats overflow to infinity or underflow to 0 long before the math becomes interesting. ```python >>> a1, r, n = 3, 2, 10 >>> [a1 * r ** i for i in range(5)] # a_1 r^(i), i from 0 [3, 6, 12, 24, 48] >>> a1 * r ** (n - 1) # the n-th term 1536 >>> a1 * (r ** n - 1) // (r - 1) # the sum of n terms (exact for integers) 3069 >>> from fractions import Fraction >>> sum(Fraction(1, 2) ** i for i in range(10)) # exact, no rounding Fraction(1023, 512) >>> 2 ** 64 - 1 # the chessboard 18446744073709551615 >>> 1000 * 1.05 ** 10 # compound interest, as a float 1628.894626777442 >>> 2.0 ** 1024 # beyond the largest float: raises OverflowError ``` ```javascript const terms = (a1, r, n) => Array.from({ length: n }, (_, i) => a1 * r ** i) terms(3, 2, 5) // [3, 6, 12, 24, 48] terms(3, 2, 10).reduce((s, x) => s + x, 0) // 3069 2 ** 1024 // Infinity: beyond the largest float 0.5 ** 1075 // 0: smaller than the smallest float 2n ** 64n - 1n // 18446744073709551615n (BigInt is exact) ``` ```cpp #include #include #include using namespace std; int main() { int a1 = 3, r = 2, n = 10; int term = a1, sum = 0, rn = 1; for (int i = 0; i < n; i++) { if (i < 5) cout << term << " "; // the first five terms sum += term; term *= r; rn *= r; } cout << endl; cout << a1 * (rn / r) << endl; // the n-th term: a1 r^(n-1) cout << sum << " " << a1 * (rn - 1) / (r - 1) << endl; // the sum of n terms, by loop and by formula int num = 0; for (int i = 0; i < 10; i++) num += 1 << (9 - i); // (1/2)^0 + ... + (1/2)^9 over the denominator 512 cout << num << "/512" << endl; printf("%.0f\n", pow(2, 64) - 1); // 18446744073709551616: a double cannot hold 2^64 - 1 printf("%.4f\n", 1000 * pow(1.05, 10)); // compound interest cout << (pow(2.0, 1024) > 1.7976931348623157e308) << endl; // 1: beyond the largest double (inf) return 0; } /* output: 3 6 12 24 48 1536 3069 3069 1023/512 18446744073709551616 1628.8946 1 */ ``` The pitfalls, in order of how often they bite: | Pitfall | What happens | What to do | |---|---|---| | `a1 * r ** n` for the n-th term | gives the term after it | use `r ** (n - 1)`, or index from 0 | | The sum formula with `r == 1` | ZeroDivisionError in Python, `NaN` or `Infinity` in JavaScript | handle `r == 1` separately: the sum is `n * a1` | | `^` for a power | it is XOR, not a power | use `**`, as in the article on [binary numbers](https://nunada.my.id/articles/binary-numbers/#bitwise-operators) | | Large powers as floats | `2.0 ** 1024` raises OverflowError in Python and is `Infinity` in JavaScript | use integers, `BigInt` or `Fraction` | | Tiny powers as floats | `0.5 ** 1075` is 0 | use `Fraction` or `Decimal` | | `/` in the sum formula | gives a float: `3069.0` | use `//` when everything is an integer | | Summing an infinite series | a loop never ends | use `a1 / (1 - r)` when `abs(r) < 1` | Exact fractions avoid the rounding of floats, as in the article on [rational numbers](https://nunada.my.id/articles/rational-numbers/#fractions-in-code). Check a closed form against a short loop before relying on it. ## Where do geometric series come from? **Geometric progressions appear in the oldest mathematics, and the idea that infinitely many terms can add to a finite number took the Greeks centuries to accept.** - **c. 1550 BCE.** Problem 79 of the Rhind Papyrus lists seven houses, each with seven cats, each killing seven mice, and so on: the powers of 7 and their sum, 19607. - **5th century BCE.** Zeno's paradoxes of motion, such as Achilles and the tortoise, puzzled the Greeks because they seemed to add infinitely many steps. - **c. 300 BCE.** Euclid's Elements, Book IX, proposition 35, gives the sum of terms in geometric progression in the language of proportions, the first proof of the finite sum formula. - **c. 250 BCE.** Archimedes, in the Quadrature of the Parabola, summed $1+\frac14+\frac1{16}+\cdots=\frac43$ to find the area of a parabolic segment, an early use of an infinite series with the sum found by a careful argument. - **1683.** Jacob Bernoulli found the number $e$ as the limit of compound interest $\left(1+\frac1n\right)^n$. A well-known legend tells of the inventor of chess who asked a king for one grain of rice on the first square, two on the second and so on, and asked for more than the kingdom could ever supply. The tale is old, with versions told in Arabic sources by the 13th century, and it remains the most memorable way to feel how fast $2^{n}$ grows. ## What are the common mistakes with geometric sequences? **The most common mistakes with geometric sequences are the nine below, each with the correct statement and a number that shows why.** | Mistake | Correct | |---|---| | ❌ $a_n=a_1r^n$ | $a_n=a_1r^{n-1}$: for $n=1$ the term is $a_1$, not $a_1r$. | | ❌ $3,6,9,12$ is geometric | It adds 3, so it is arithmetic; a geometric sequence multiplies. | | ❌ $r=\frac{a_n}{a_{n+1}}$ | Later over earlier: $r=\frac{a_{n+1}}{a_n}$; for $64,32,16$ it is $\frac12$, not 2. | | ❌ A 5% rise has $r=0.05$ | It has $r=1.05$; a 20% fall has $r=0.8$. | | ❌ Doubling for 10 years gives 20 times | It gives $2^{10}=1024$ times. | | ❌ $S_n=a_1\frac{r^n-1}{r}$ | Divide by $r-1$: $S_n=a_1\frac{r^n-1}{r-1}$. | | ❌ The formula works for $r=1$ | It divides by 0; for $r=1$ the sum is $na_1$. | | ❌ $1+2+4+8+\cdots=\frac{1}{1-2}=-1$ | $|r|\ge1$: the series diverges and has no sum. | | ❌ The geometric mean of 2 and 8 is 5 | That is the arithmetic mean; the geometric mean is $\sqrt{16}=4$. | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: geometric sequences and series at a glance - **Definition:** $\frac{a_{n+1}}{a_n}=r$ is constant and no term is 0; each term is the geometric mean of its neighbors. - **n-th term:** $a_n=a_1r^{n-1}$, exponential in $n$; $|r|>1$ grows, $|r|<1$ decays, $r<0$ alternates. - **From two terms:** $r^{q-p}=\frac{a_q}{a_p}$ (one or two real ratios); $k$ means between $a$ and $b$: $r^{k+1}=\frac ba$. - **Sum of n terms:** $S_n=\dfrac{a_1(1-r^n)}{1-r}$ for $r\neq1$, and $na_1$ for $r=1$. - **Infinite series:** $S_\infty=\dfrac{a_1}{1-r}$ only for $|r|<1$; repeating decimals are such series. - **Percent change:** a rise of $p\%$ has $r=1+\frac p{100}$, a fall has $r=1-\frac p{100}$; compound interest is $P(1+i)^n$. - **Code:** `a1 * r ** (n - 1)`; use integers, `BigInt` or `Fraction` to avoid float overflow and rounding. ## Glossary: key terms - **Geometric sequence**: A sequence of non-zero numbers in which each term is the previous one times the same fixed number, such as 3, 6, 12, 24. - **Common ratio**: The constant multiplier r between neighboring terms of a geometric sequence, found by dividing a term by the one before it. - **Geometric series**: The sum of the terms of a geometric sequence, finite or infinite. - **Exponential growth**: Growth in which a quantity is multiplied by the same factor greater than 1 in each period, as in a geometric sequence with ratio above 1. - **Exponential decay**: Decrease in which a quantity is multiplied by the same factor between 0 and 1 in each period, so it shrinks toward 0 but never reaches it. - **Geometric mean**: For two positive numbers a and b, the number equal to the square root of a times b; each term of a geometric sequence is the geometric mean of its neighbors. - **Partial sum**: The sum S sub n of the first n terms of a series. - **Convergent series**: A series whose partial sums approach a fixed finite number, called its sum; an infinite geometric series converges exactly when the ratio is smaller than 1 in size. - **Divergent series**: A series whose partial sums do not approach a finite number, such as 1 plus 2 plus 4 plus 8 and so on. - **Sum to infinity**: The value a convergent infinite series approaches, equal to the first term over 1 minus the ratio for a geometric series. - **Compound interest**: Interest that is added to the balance so that it earns interest itself, which makes the balance a geometric sequence with ratio 1 plus the rate. - **Half-life**: The time in which a decaying quantity falls to half its value, so that it is multiplied by one half each half-life. - **Annuity**: A series of equal payments at regular intervals, whose total value is a geometric sum. - **Arithmetic sequence**: A sequence in which each term is the previous one plus the same fixed number, as opposed to multiplied by it. ## Frequently asked questions ### What is a geometric sequence? A geometric sequence is a list of non-zero numbers in which each term is the previous term multiplied by the same fixed number, called the common ratio. For example 3, 6, 12, 24 doubles each time, so the ratio is 2. The ratio can be a fraction or negative. ### What is the formula for the n-th term of a geometric sequence? The n-th term is the first term times the ratio raised to the power n minus 1, written a sub n equals a sub 1 times r to the n minus 1. For 3, 6, 12 the tenth term is 3 times 2 to the 9, which is 1536. ### What is the formula for the sum of a geometric series? For a ratio r not equal to 1, the sum of the first n terms is the first term times 1 minus r to the n, all over 1 minus r. If r equals 1 every term is the same and the sum is n times the first term. For 3, 6, 12 with 10 terms it is 3069. ### How do you tell whether a sequence is geometric? Divide each term by the one before it, always later over earlier. If all the ratios are equal and no term is zero, the sequence is geometric and that value is the common ratio. If the differences are equal instead, it is arithmetic. ### What is the difference between arithmetic and geometric sequences? An arithmetic sequence adds the same number each time, such as 2, 5, 8, 11, and grows along a straight line. A geometric sequence multiplies by the same number each time, such as 2, 4, 8, 16, and grows or decays exponentially, so it soon leaves any arithmetic sequence behind. ### When does an infinite geometric series have a sum? Exactly when the common ratio is smaller than 1 in size, between minus 1 and 1. Then the sum is the first term divided by 1 minus the ratio. For a ratio of 1 or more in size the partial sums do not settle and the series diverges. ### How do you find the sum to infinity? First check that the ratio is between minus 1 and 1. Then divide the first term by 1 minus the ratio. For 6, 4, 8 over 3 and so on the ratio is 2 over 3, so the sum is 6 divided by one third, which is 18. ### How do you write a repeating decimal as a fraction? Treat it as a geometric series. The first repeating block over a power of ten is the first term, and one over ten to the block length is the ratio. For 0.272727 that is 27 over 100 divided by 99 over 100, which is 3 over 11. ### Why does 0.999 repeating equal 1? It is a geometric series with first term 9 over 10 and ratio 1 over 10. The sum is 9 over 10 divided by 9 over 10, which is exactly 1. The decimal is another name for 1, not a number that is slightly smaller. ### How do you find the ratio from two terms? Divide the later term by the earlier one, then take the root whose index is the number of steps between them. With the second term 6 and the fifth term 48, the quotient is 8 and its cube root is 2. An even number of steps allows a positive and a negative ratio. ### What is a geometric mean? The geometric mean of two positive numbers is the square root of their product, so for 2 and 8 it is 4, not the arithmetic mean 5. It is the middle term of a geometric sequence, and the right average for growth factors. ### How does compound interest relate to geometric sequences? With compound interest the balance is multiplied by 1 plus the interest rate each period, so the balances form a geometric sequence. After n periods a deposit P is worth P times 1.05 to the n at 5 percent. Simple interest, by contrast, is arithmetic. ### What common ratio does a 20 percent decrease have? The ratio is 0.8, because a value that falls by 20 percent keeps 80 percent of itself. A rise of 20 percent has ratio 1.2. A common mistake is to use 0.2, which would be a fall of 80 percent each period. ### How do you build a geometric sequence in Python? Use a list comprehension with the power operator, a1 times r to the i for i in range n. Use the Fraction class for exact sums, because floats overflow or underflow quickly. Remember that the caret is XOR in Python, so write powers with a double asterisk. --- # Barisan dan Deret Geometri: Rasio, Jumlah, dan Pertumbuhan Source: https://nunada.my.id/artikel/barisan-dan-deret-geometri/ Updated: 2026-10-10 ## Jawaban singkat **Barisan geometri adalah daftar bilangan yang setiap sukunya sama dengan suku sebelumnya dikali bilangan tetap $r$, yaitu rasio: $3,6,12,24,\ldots$ memiliki $r=2$.** Suku ke-$n$-nya adalah $a_n=a_1r^{n-1}$, dan jumlah $n$ suku pertama adalah $S_n=\dfrac{a_1(1-r^n)}{1-r}$ untuk $r\neq1$. Deret geometri tak hingga punya jumlah, $\dfrac{a_1}{1-r}$, hanya bila $|r|<1$; jika tidak, ia divergen. ### Poin penting - Pada barisan geometri rasio antartetangga konstan: $\dfrac{a_{n+1}}{a_n}=r$, sehingga tiap langkah mengalikan dengan $r$ sedangkan barisan aritmetika menambah. - Suku ke-$n$ adalah $a_n=a_1r^{n-1}$, fungsi eksponensial dari $n$: $|r|>1$ tumbuh, $0<|r|<1$ meluruh, dan $r$ negatif membuat tanda bergantian. - Dua suku memberi rasio: $r^{q-p}=\dfrac{a_q}{a_p}$; $k$ rata-rata geometri di antara $a$ dan $b$ memiliki $r^{k+1}=\dfrac ba$. - Jumlah $n$ suku adalah $S_n=a_1\dfrac{1-r^n}{1-r}$ (dan $na_1$ bila $r=1$), diperoleh dengan mengurangkan $rS_n$ dari $S_n$. - Jika $|r|<1$ deret tak hingga konvergen ke $S_\infty=\dfrac{a_1}{1-r}$; ini mengubah desimal berulang menjadi pecahan, seperti $0{,}\overline{3}=\frac13$. - Bunga majemuk, penyusutan, dan waktu paruh semuanya geometri: kenaikan $p\%$ berarti $r=1+\frac p{100}$ dan penurunan berarti $r=1-\frac p{100}$. ## Apa itu barisan geometri? **Barisan geometri (atau progresi geometri) adalah daftar bilangan bukan nol $a_1,a_2,a_3,\ldots$ yang rasio tiap suku terhadap suku sebelumnya selalu bilangan yang sama $r$, yang disebut rasio.** Aturannya $a_{n+1}=r\,a_n$: untuk mendapat suku berikutnya, kalikan dengan $r$. | Barisan | Rasio | Perilaku | |---|---|---| | $3,6,12,24,\ldots$ | $r=2$ | berlipat dua: tumbuh | | $81,27,9,3,\ldots$ | $r=\frac13$ | mengecil menuju 0 | | $5,-10,20,-40,\ldots$ | $r=-2$ | tanda bergantian, ukuran tumbuh | | $7,7,7,7,\ldots$ | $r=1$ | konstan | | $1,0{,}1,0{,}01,\ldots$ | $r=0{,}1$ | mengecil menuju 0 | | $2,4,6,8,\ldots$ | rasio $2,\frac32,\frac43$ | **bukan** geometri: ia menambah 2 setiap kali | | $1,4,9,16,\ldots$ | rasio $4,\frac94,\frac{16}9$ | **bukan** geometri (dan bukan aritmetika) | **Cara mengetahuinya.** Bagi tiap suku dengan suku sebelumnya, yang kemudian per yang lebih dulu. Jika setiap rasio sama, barisannya geometri. Tidak boleh ada suku 0, karena rasio suatu suku terhadap 0 tidak terdefinisi dan suku 0 membuat setiap suku berikutnya 0. **Bandingkan dengan aritmetika.** [Barisan aritmetika](https://nunada.my.id/artikel/barisan-dan-deret-aritmetika/#what-is-an-arithmetic-sequence) menambah jumlah yang sama tiap langkah, sehingga sukunya terletak pada garis lurus; barisan geometri mengalikan, sehingga sukunya terletak pada kurva eksponensial dan akhirnya meninggalkan barisan aritmetika apa pun jauh di belakang. **Rata-rata geometri.** Untuk tiga tetangga yang bertanda sama $a_n^2=a_{n-1}a_{n+1}$, sehingga tiap suku adalah rata-rata geometri $\sqrt{ab}$ dari dua suku di sampingnya, seperti tiap suku barisan aritmetika adalah rata-rata aritmetika keduanya. Dari situlah namanya berasal. Ketik daftar bilangan di bawah dan lihat apakah ia geometri. ## Bagaimana mencari suku ke-n barisan geometri? **Suku ke-$n$ barisan geometri adalah $a_n=a_1r^{n-1}$: mulai dari suku pertama dan kalikan dengan rasio sebanyak $n-1$ kali.** Seperti pada kasus aritmetika, dari suku 1 ke suku $n$ diperlukan $n-1$ langkah. Untuk $3,6,12,\ldots$ kita punya $a_1=3$ dan $r=2$, sehingga $a_n=3\cdot2^{n-1}$ dan $a_{10}=3\cdot2^9=1536$. Untuk $64,32,16,\ldots$, $r=\frac12$ dan $a_7=64\cdot\left(\frac12\right)^6=1$. **Ia fungsi eksponensial.** Menulis $a_n=\frac{a_1}{r}\,r^n$ menunjukkan peubah $n$ berada di eksponen, sehingga hukum [eksponen](https://nunada.my.id/artikel/eksponen-dan-akar/#laws-of-exponents) berlaku, dan titik-titik barisan terletak pada kurva, bukan garis. Besarnya $r$ menentukan gambarnya: - $r>1$: pertumbuhan eksponensial. Suku-sukunya membesar makin cepat. - $01$ atau mengecil bila $|r|<1$. - $r=1$: konstan. $r=-1$: barisan bergantian antara $a_1$ dan $-a_1$. **Mengapa terasa begitu cepat.** Uang Rp100 yang dilipatduakan tiap hari selama 30 hari bernilai $100\cdot2^{29}=$ Rp53.687.091.200 pada hari ke-30; menambah Rp1.000.000 tetap tiap hari hanya memberi Rp30.000.000. Penggandaan akhirnya mengalahkan penambahan tetap mana pun. **Suku keberapa yang sama dengan bilangan tertentu?** Selesaikan $a_1r^{n-1}=L$. Untuk $3,6,12,\ldots,768$: $\frac{768}{3}=256=2^8$, sehingga $n-1=8$ dan $n=9$. Bila rasionya bukan pangkat yang rapi, banyak suku memerlukan logaritma, yaitu kebalikan dari eksponen. Pilih suku pertama, rasio, dan panjang di bawah dan perhatikan batangnya. ## Bagaimana mencari rasio dari dua suku, dan apa itu rata-rata geometri? **Dua suku dan posisinya memberi rasio: di antara suku $p$ dan suku $q$ ada $q-p$ perkalian dengan $r$, sehingga $a_q=a_p\,r^{q-p}$ dan $r^{q-p}=\dfrac{a_q}{a_p}$.** Lalu $a_1=a_p\div r^{p-1}$. Contoh: $a_2=6$ dan $a_5=48$. Maka $r^3=\frac{48}{6}=8$, sehingga $r=2$ dan $a_1=\frac62=3$: barisannya $3,6,12,24,48,\ldots$ **Berapa banyak jawaban?** Menarik akar dapat memberi dua. Jika banyak langkah $q-p$ ganjil ada satu rasio real, bertanda sama dengan $\frac{a_q}{a_p}$. Jika genap ada dua, $+r$ dan $-r$, asalkan $\frac{a_q}{a_p}$ positif: $a_1=3$ dan $a_3=12$ cocok dengan $3,6,12,\ldots$ maupun $3,-6,12,\ldots$. Jika ia negatif dan banyak langkahnya genap, tidak ada rasio real. Dan rasio tidak harus pecahan: $a_1=1$ dan $a_3=2$ memberi $r=\pm\sqrt2$, yang [irasional](https://nunada.my.id/artikel/bilangan-irasional/#which-roots-are-irrational). **Rata-rata geometri.** Menyisipkan $k$ bilangan di antara $a$ dan $b$ sehingga seluruh daftarnya geometri adalah masalah yang sama dengan $k+1$ langkah: $r^{k+1}=\frac ba$. Dua sisipan di antara 3 dan 81 memiliki $r^3=27$, sehingga $r=3$ dan sisipannya 9 dan 27. Dengan satu sisipan, $r^2=\frac ba$ dan sisipannya $\sqrt{ab}$: di antara 2 dan 32 ia $\sqrt{64}=8$. **Mengapa rata-rata geometri penting.** Bila suatu besaran tumbuh dengan faktor, rata-rata yang tepat adalah yang geometri. Harga yang naik 10% lalu 20% tumbuh dengan faktor 1,1 dan 1,2, yang rata-rata geometrinya $\sqrt{1{,}1\cdot1{,}2}\approx1{,}149$, rata-rata sekitar 14,9% per periode, bukan 15% seperti yang disarankan merata-ratakan persentasenya. Coba dua sukumu sendiri di bawah. ## Bagaimana mencari jumlah deret geometri? **Jumlah $n$ suku pertama barisan geometri dengan $r\neq1$ adalah $S_n=\dfrac{a_1(1-r^n)}{1-r}$, yang sama dengan $\dfrac{a_1(r^n-1)}{r-1}$; jika $r=1$ setiap suku adalah $a_1$ dan $S_n=na_1$.** Jumlah suku-suku seperti ini adalah deret geometri. **Dari mana rumusnya.** Kalikan jumlah dengan $r$ lalu kurangkan; hampir semuanya saling meniadakan: $S_n=a_1+a_1r+a_1r^2+\cdots+a_1r^{n-1}$ $rS_n=\ \ \ \ \ \ \ \,a_1r+a_1r^2+\cdots+a_1r^{n-1}+a_1r^{n}$ $S_n-rS_n=a_1-a_1r^n\quad\Rightarrow\quad S_n(1-r)=a_1(1-r^n)$ Membagi dengan $1-r$ hanya boleh bila $r\neq1$, itulah sebabnya kasus itu terpisah. **Contoh.** - $3+6+12+\cdots$ dengan 10 suku: $S_{10}=\frac{3(2^{10}-1)}{2-1}=3069$. - $1+\frac12+\frac14+\cdots+\frac1{512}$ dengan 10 suku: $S_{10}=\frac{1-(1/2)^{10}}{1-1/2}=2-\frac1{512}=\frac{1023}{512}$. - Soal Papirus Rhind tentang tujuh rumah dengan tujuh kucing, tujuh tikus, tujuh bulir gandum, dan tujuh takaran biji menjumlahkan $7+49+343+2401+16807=19607$, yaitu $\frac{7(7^5-1)}{6}$. - **Papan catur.** Satu butir beras pada petak pertama, dua pada petak kedua, berlipat dua pada tiap dari 64 petak, menghasilkan $2^{64}-1=18.446.744.073.709.551.615$ butir, jauh lebih banyak daripada yang pernah ditanam dunia. **Kaitan dengan biner.** Dengan $a_1=1$ dan $r=2$ jumlahnya $1+2+4+\cdots+2^{n-1}=2^n-1$, yaitu bilangan yang ditulis sebagai $n$ angka satu dalam biner: $11111111_2=255=2^8-1$, seperti pada artikel [bilangan biner](https://nunada.my.id/artikel/bilangan-biner/#bits-and-bytes). Perhatikan pengurangan dan jumlahnya di bawah, beserta jumlah parsialnya. ## Kapan deret geometri tak hingga punya jumlah? **Deret geometri tak hingga punya jumlah tepat bila $|r|<1$, dan kemudian $S_\infty=\dfrac{a_1}{1-r}$; untuk $|r|\ge1$ ia divergen (kecuali setiap sukunya 0).** Alasannya ada dalam rumus berhingga: $S_n=\dfrac{a_1(1-r^n)}{1-r}$, dan bila $|r|<1$ pangkat $r^n$ mengecil menuju 0, sehingga $S_n$ mendekati $\dfrac{a_1}{1-r}$. Selisih setelah $n$ suku tepat $\dfrac{a_1r^n}{1-r}$, yang dapat dibuat sekecil yang kamu mau. - $\frac12+\frac14+\frac18+\cdots=\dfrac{1/2}{1-1/2}=1$: membagi dua apa yang tersisa dari persegi satuan, berulang-ulang, memenuhi persegi itu. - $6+4+\frac83+\cdots$ punya $r=\frac23$, sehingga $S_\infty=\frac{6}{1/3}=18$. - $1-\frac12+\frac14-\cdots$ punya $r=-\frac12$, sehingga $S_\infty=\frac{1}{3/2}=\frac23$. - $1+\frac14+\frac1{16}+\cdots=\frac43$, deret yang dipakai Archimedes untuk luas segmen parabola. Untuk $|r|\ge1$ jumlah parsial tidak menetap: $r=1$ memberi $na_1$, yang membesar; $r=-1$ memberi $a_1,0,a_1,0,\ldots$; dan $|r|>1$ membesar tanpa batas, seperti $1+2+4+8+\cdots$. Rumus $\frac{a_1}{1-r}$ akan memberi $-1$ untuk deret terakhir itu, yang tidak bermakna, jadi periksa $|r|<1$ sebelum memakainya. Deret aritmetika tidak pernah konvergen, seperti ditunjukkan bagian [deret aritmetika tak hingga](https://nunada.my.id/artikel/barisan-dan-deret-aritmetika/#infinite-arithmetic-series). **Desimal berulang adalah deret geometri.** $0{,}\overline{3}=\frac3{10}+\frac3{100}+\cdots$ punya $a_1=\frac3{10}$ dan $r=\frac1{10}$, sehingga ia $\frac{3/10}{9/10}=\frac13$. Dengan cara yang sama $0{,}\overline{9}=\frac{9/10}{9/10}=1$ tepat, dan $0{,}\overline{27}=\frac{27/100}{99/100}=\frac{3}{11}$. Blok berulang berisi $m$ angka punya $r=10^{-m}$. Inilah metode di balik pengubahan desimal berulang menjadi pecahan pada artikel [bilangan real](https://nunada.my.id/artikel/bilangan-real/#rational-numbers), dan itulah sebabnya [setiap desimal berulang rasional](https://nunada.my.id/artikel/bilangan-rasional/#decimals-percent). **Paradoks Zeno.** Achilles mengejar kura-kura yang mendapat start lebih dulu. Setiap kali ia sampai di tempat kura-kura tadi, kura-kura sudah bergerak sedikit lebih jauh, sehingga ada tak berhingga banyak langkah. Tetapi waktu tiap langkah membentuk deret geometri dengan jumlah berhingga, sehingga Achilles memang menyalip kura-kura, pada saat yang pasti. **Bola memantul.** Dijatuhkan dari 10 m dan memantul kembali setinggi $\frac35$ dari tinggi sebelumnya setiap kali, sebuah bola menempuh $10+2\left(6+3{,}6+2{,}16+\cdots\right)=10+2\cdot\dfrac{6}{1-3/5}=40$ m seluruhnya. ## Di mana barisan geometri muncul: bunga, peluruhan, dan pertumbuhan? **Apa pun yang berubah dengan persentase tetap tiap periode adalah barisan geometri: kenaikan $p\%$ mengalikan dengan $r=1+\frac p{100}$ dan penurunan $p\%$ mengalikan dengan $r=1-\frac p{100}$.** Perhatikan bahwa kenaikan 5% berasio 1,05, bukan 0,05, dan penurunan 20% berasio 0,8, bukan 0,2. | Situasi | Pemodelan | Hasil | |---|---|---| | Tabungan Rp1.000.000 berbunga 5% per tahun, majemuk | $r=1{,}05$ | setelah 10 tahun $1000000\cdot1{,}05^{10}\approx1628895$, yaitu Rp1.628.895 | | Mobil senilai Rp200.000.000 kehilangan 20% nilainya tiap tahun | $r=0{,}8$ | setelah 3 tahun $200000000\cdot0{,}8^3=102400000$, yaitu Rp102.400.000 | | 200 mg kafein dengan waktu paruh 5 jam | $r=\frac12$ per 5 jam | setelah 15 jam $200\cdot\frac18=25$ mg | | Selembar kertas setebal 0,1 mm dilipat dua 10 kali | $r=2$ | $0{,}1\cdot2^{10}=102{,}4$ mm | | Rencana menabung Rp1.000.000 di akhir tiap bulan dengan bunga 1% per bulan | jumlah geometri | setelah 12 bulan $1000000\cdot\frac{1{,}01^{12}-1}{0{,}01}\approx12682503$, yaitu Rp12.682.503 | **Bunga majemuk** memberi saldo $P\,(1+i)^n$ setelah $n$ periode dengan bunga $i$ per periode. Bunga yang ditambahkan hanya pada simpanan awal memberi [barisan aritmetika](https://nunada.my.id/artikel/barisan-dan-deret-aritmetika/#word-problems). Memajemukkan lebih sering hanya membantu sedikit: faktor $\left(1+\frac1n\right)^n$ mendekati bilangan irasional $e\approx2{,}71828$, yang dijumpai Jacob Bernoulli pada 1683 saat mempelajari hal ini, seperti dikisahkan artikel [π, e, dan bilangan transenden](https://nunada.my.id/artikel/bilangan-irasional/#pi-e-transcendental). **Peluruhan tidak pernah mencapai nol.** Waktu paruh, nilai yang menyusut, atau selisih suhu yang mendingin terus dikalikan rasio di bawah 1, sehingga mengecil menuju 0 tanpa pernah menjadi 0. **Anuitas** adalah jumlah deret geometri. Tiap setoran tumbuh dengan $r=1+i$ selama banyak periode yang berbeda, sehingga totalnya $P\,\bigl(1+(1+i)+\cdots+(1+i)^{n-1}\bigr)=P\,\dfrac{(1+i)^n-1}{i}$, rumus jumlah dengan rasio $1+i$. **Melipat kertas** menunjukkan betapa cepatnya penggandaan. Selembar kertas setebal 0,1 mm yang dilipat 42 kali, yang sebenarnya tidak dapat dilakukan, akan setebal $0{,}1\cdot2^{42}$ mm, sekitar 440.000 km, lebih dari jarak ke Bulan. ## Bagaimana mengolah barisan geometri di Python dan JavaScript? **Bangun suku-sukunya dengan operator pangkat, `a1 * r ** i` di kedua bahasa, dan pakai `fractions.Fraction` di Python bila jumlahnya harus eksak.** Pangkat tumbuh atau mengecil begitu cepat sehingga float meluap menjadi tak hingga atau menjadi 0 jauh sebelum matematikanya menarik. ```python >>> a1, r, n = 3, 2, 10 >>> [a1 * r ** i for i in range(5)] # a_1 r^(i), i from 0 [3, 6, 12, 24, 48] >>> a1 * r ** (n - 1) # the n-th term 1536 >>> a1 * (r ** n - 1) // (r - 1) # the sum of n terms (exact for integers) 3069 >>> from fractions import Fraction >>> sum(Fraction(1, 2) ** i for i in range(10)) # exact, no rounding Fraction(1023, 512) >>> 2 ** 64 - 1 # the chessboard 18446744073709551615 >>> 1000 * 1.05 ** 10 # compound interest, as a float 1628.894626777442 >>> 2.0 ** 1024 # beyond the largest float: raises OverflowError ``` ```javascript const terms = (a1, r, n) => Array.from({ length: n }, (_, i) => a1 * r ** i) terms(3, 2, 5) // [3, 6, 12, 24, 48] terms(3, 2, 10).reduce((s, x) => s + x, 0) // 3069 2 ** 1024 // Infinity: beyond the largest float 0.5 ** 1075 // 0: smaller than the smallest float 2n ** 64n - 1n // 18446744073709551615n (BigInt is exact) ``` ```cpp #include #include #include using namespace std; int main() { int a1 = 3, r = 2, n = 10; int term = a1, sum = 0, rn = 1; for (int i = 0; i < n; i++) { if (i < 5) cout << term << " "; // the first five terms sum += term; term *= r; rn *= r; } cout << endl; cout << a1 * (rn / r) << endl; // the n-th term: a1 r^(n-1) cout << sum << " " << a1 * (rn - 1) / (r - 1) << endl; // the sum of n terms, by loop and by formula int num = 0; for (int i = 0; i < 10; i++) num += 1 << (9 - i); // (1/2)^0 + ... + (1/2)^9 over the denominator 512 cout << num << "/512" << endl; printf("%.0f\n", pow(2, 64) - 1); // 18446744073709551616: a double cannot hold 2^64 - 1 printf("%.4f\n", 1000 * pow(1.05, 10)); // compound interest cout << (pow(2.0, 1024) > 1.7976931348623157e308) << endl; // 1: beyond the largest double (inf) return 0; } /* output: 3 6 12 24 48 1536 3069 3069 1023/512 18446744073709551616 1628.8946 1 */ ``` Jebakannya, berurutan dari yang paling sering menggigit: | Jebakan | Yang terjadi | Yang sebaiknya dilakukan | |---|---|---| | `a1 * r ** n` untuk suku ke-n | memberi suku sesudahnya | pakai `r ** (n - 1)`, atau beri indeks dari 0 | | Rumus jumlah dengan `r == 1` | ZeroDivisionError di Python, `NaN` atau `Infinity` di JavaScript | tangani `r == 1` secara terpisah: jumlahnya `n * a1` | | `^` untuk pangkat | itu XOR, bukan pangkat | pakai `**`, seperti pada artikel [bilangan biner](https://nunada.my.id/artikel/bilangan-biner/#bitwise-operators) | | Pangkat besar sebagai float | `2.0 ** 1024` menimbulkan OverflowError di Python dan `Infinity` di JavaScript | pakai bilangan bulat, `BigInt`, atau `Fraction` | | Pangkat kecil sebagai float | `0.5 ** 1075` adalah 0 | pakai `Fraction` atau `Decimal` | | `/` dalam rumus jumlah | memberi float: `3069.0` | pakai `//` bila semuanya bilangan bulat | | Menjumlah deret tak hingga | perulangan tidak pernah berakhir | pakai `a1 / (1 - r)` bila `abs(r) < 1` | Pecahan eksak menghindari pembulatan float, seperti pada artikel [bilangan rasional](https://nunada.my.id/artikel/bilangan-rasional/#fractions-in-code). Periksa bentuk tertutup dengan perulangan pendek sebelum mengandalkannya. ## Dari mana asal deret geometri? **Barisan geometri muncul dalam matematika tertua, dan gagasan bahwa tak berhingga banyak suku dapat berjumlah bilangan berhingga membutuhkan berabad-abad bagi bangsa Yunani untuk menerimanya.** - **Sekitar 1550 SM.** Soal 79 Papirus Rhind mendaftar tujuh rumah, masing-masing dengan tujuh kucing, masing-masing membunuh tujuh tikus, dan seterusnya: pangkat 7 dan jumlahnya, 19607. - **Abad ke-5 SM.** Paradoks gerak Zeno, seperti Achilles dan kura-kura, membingungkan bangsa Yunani karena tampak menjumlahkan tak berhingga banyak langkah. - **Sekitar 300 SM.** Elements Euclid, Buku IX, proposisi 35, memberi jumlah suku-suku dalam progresi geometri dalam bahasa perbandingan, bukti pertama rumus jumlah berhingga. - **Sekitar 250 SM.** Archimedes, dalam Quadrature of the Parabola, menjumlahkan $1+\frac14+\frac1{16}+\cdots=\frac43$ untuk mencari luas segmen parabola, penggunaan awal deret tak hingga dengan jumlah yang ditemukan lewat argumen yang cermat. - **1683.** Jacob Bernoulli menemukan bilangan $e$ sebagai limit bunga majemuk $\left(1+\frac1n\right)^n$. Legenda terkenal bercerita tentang penemu catur yang meminta kepada raja satu butir beras pada petak pertama, dua pada petak kedua, dan seterusnya, dan meminta lebih daripada yang dapat disediakan kerajaan. Kisah ini tua, dengan versi yang diceritakan dalam sumber Arab pada abad ke-13, dan tetap menjadi cara paling berkesan untuk merasakan betapa cepat $2^{n}$ tumbuh. ## Apa kesalahan umum pada barisan geometri? **Kesalahan paling umum pada barisan geometri adalah sembilan hal berikut, masing-masing dengan pernyataan yang benar dan bilangan yang menunjukkan alasannya.** | Kesalahan | Yang benar | |---|---| | ❌ $a_n=a_1r^n$ | $a_n=a_1r^{n-1}$: untuk $n=1$ sukunya $a_1$, bukan $a_1r$. | | ❌ $3,6,9,12$ geometri | Ia menambah 3, sehingga aritmetika; barisan geometri mengalikan. | | ❌ $r=\frac{a_n}{a_{n+1}}$ | Yang kemudian per yang lebih dulu: $r=\frac{a_{n+1}}{a_n}$; untuk $64,32,16$ ia $\frac12$, bukan 2. | | ❌ Kenaikan 5% berarti $r=0{,}05$ | Ia berarti $r=1{,}05$; penurunan 20% berarti $r=0{,}8$. | | ❌ Berlipat dua selama 10 tahun menjadi 20 kali | Ia menjadi $2^{10}=1024$ kali. | | ❌ $S_n=a_1\frac{r^n-1}{r}$ | Bagi dengan $r-1$: $S_n=a_1\frac{r^n-1}{r-1}$. | | ❌ Rumusnya berlaku untuk $r=1$ | Ia membagi dengan 0; untuk $r=1$ jumlahnya $na_1$. | | ❌ $1+2+4+8+\cdots=\frac{1}{1-2}=-1$ | $|r|\ge1$: deretnya divergen dan tidak punya jumlah. | | ❌ Rata-rata geometri 2 dan 8 adalah 5 | Itu rata-rata aritmetika; rata-rata geometrinya $\sqrt{16}=4$. | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: barisan dan deret geometri sekilas - **Definisi:** $\frac{a_{n+1}}{a_n}=r$ konstan dan tidak ada suku 0; tiap suku adalah rata-rata geometri tetangganya. - **Suku ke-n:** $a_n=a_1r^{n-1}$, eksponensial dalam $n$; $|r|>1$ tumbuh, $|r|<1$ meluruh, $r<0$ bergantian. - **Dari dua suku:** $r^{q-p}=\frac{a_q}{a_p}$ (satu atau dua rasio real); $k$ sisipan di antara $a$ dan $b$: $r^{k+1}=\frac ba$. - **Jumlah n suku:** $S_n=\dfrac{a_1(1-r^n)}{1-r}$ untuk $r\neq1$, dan $na_1$ untuk $r=1$. - **Deret tak hingga:** $S_\infty=\dfrac{a_1}{1-r}$ hanya untuk $|r|<1$; desimal berulang adalah deret seperti itu. - **Perubahan persen:** kenaikan $p\%$ berarti $r=1+\frac p{100}$, penurunan berarti $r=1-\frac p{100}$; bunga majemuk adalah $P(1+i)^n$. - **Kode:** `a1 * r ** (n - 1)`; pakai bilangan bulat, `BigInt`, atau `Fraction` untuk menghindari luapan dan pembulatan float. ## Glosarium: istilah penting - **Barisan geometri**: Barisan bilangan bukan nol yang setiap sukunya adalah suku sebelumnya dikali bilangan tetap yang sama, seperti 3, 6, 12, 24. - **Rasio**: Pengali tetap r antara suku-suku bertetangga pada barisan geometri, diperoleh dengan membagi sebuah suku dengan suku sebelumnya. - **Deret geometri**: Jumlah suku-suku barisan geometri, berhingga atau tak hingga. - **Pertumbuhan eksponensial**: Pertumbuhan yang besarannya dikali faktor yang sama lebih dari 1 tiap periode, seperti pada barisan geometri dengan rasio di atas 1. - **Peluruhan eksponensial**: Penurunan yang besarannya dikali faktor yang sama antara 0 dan 1 tiap periode, sehingga mengecil menuju 0 tetapi tidak pernah mencapainya. - **Rata-rata geometri**: Untuk dua bilangan positif a dan b, bilangan yang sama dengan akar dari a kali b; tiap suku barisan geometri adalah rata-rata geometri tetangganya. - **Jumlah parsial**: Jumlah S indeks n dari n suku pertama sebuah deret. - **Deret konvergen**: Deret yang jumlah parsialnya mendekati bilangan berhingga tetap, yang disebut jumlahnya; deret geometri tak hingga konvergen tepat bila rasionya berukuran kurang dari 1. - **Deret divergen**: Deret yang jumlah parsialnya tidak mendekati bilangan berhingga, seperti 1 ditambah 2 ditambah 4 ditambah 8 dan seterusnya. - **Jumlah tak hingga**: Nilai yang didekati deret tak hingga yang konvergen, sama dengan suku pertama per 1 dikurangi rasio untuk deret geometri. - **Bunga majemuk**: Bunga yang ditambahkan ke saldo sehingga ia sendiri berbunga, yang membuat saldo menjadi barisan geometri dengan rasio 1 ditambah suku bunga. - **Waktu paruh**: Waktu yang diperlukan suatu besaran yang meluruh untuk turun menjadi setengah nilainya, sehingga dikali setengah tiap waktu paruh. - **Anuitas**: Serangkaian pembayaran sama besar pada selang teratur, yang nilai totalnya adalah jumlah geometri. - **Barisan aritmetika**: Barisan yang setiap sukunya adalah suku sebelumnya ditambah bilangan tetap yang sama, bukan dikali. ## Pertanyaan yang sering diajukan ### Apa itu barisan geometri? Barisan geometri adalah daftar bilangan bukan nol yang setiap sukunya sama dengan suku sebelumnya dikali bilangan tetap yang sama, yang disebut rasio. Misalnya 3, 6, 12, 24 berlipat dua setiap kali, sehingga rasionya 2. Rasionya dapat berupa pecahan atau negatif. ### Apa rumus suku ke-n barisan geometri? Suku ke-n adalah suku pertama dikali rasio pangkat n dikurangi 1, ditulis a indeks n sama dengan a indeks 1 kali r pangkat n dikurangi 1. Untuk 3, 6, 12 suku kesepuluh adalah 3 kali 2 pangkat 9, yaitu 1536. ### Apa rumus jumlah deret geometri? Untuk rasio r yang tidak sama dengan 1, jumlah n suku pertama adalah suku pertama kali 1 dikurangi r pangkat n, seluruhnya dibagi 1 dikurangi r. Jika r sama dengan 1 setiap suku sama dan jumlahnya n kali suku pertama. Untuk 3, 6, 12 dengan 10 suku jumlahnya 3069. ### Bagaimana mengetahui apakah suatu barisan geometri? Bagi tiap suku dengan suku sebelumnya, selalu yang kemudian per yang lebih dulu. Jika semua rasio sama dan tidak ada suku nol, barisannya geometri dan nilai itu adalah rasionya. Jika selisihnya yang sama, barisannya aritmetika. ### Apa beda barisan aritmetika dan geometri? Barisan aritmetika menambah bilangan yang sama setiap kali, seperti 2, 5, 8, 11, dan tumbuh sepanjang garis lurus. Barisan geometri mengalikan dengan bilangan yang sama setiap kali, seperti 2, 4, 8, 16, dan tumbuh atau meluruh secara eksponensial, sehingga segera meninggalkan barisan aritmetika mana pun. ### Kapan deret geometri tak hingga punya jumlah? Tepat bila rasionya berukuran kurang dari 1, antara minus 1 dan 1. Maka jumlahnya adalah suku pertama dibagi 1 dikurangi rasio. Untuk rasio berukuran 1 atau lebih jumlah parsialnya tidak menetap dan deretnya divergen. ### Bagaimana mencari jumlah tak hingga? Pertama periksa bahwa rasionya antara minus 1 dan 1. Lalu bagi suku pertama dengan 1 dikurangi rasio. Untuk 6, 4, 8 per 3 dan seterusnya rasionya 2 per 3, sehingga jumlahnya 6 dibagi sepertiga, yaitu 18. ### Bagaimana menulis desimal berulang sebagai pecahan? Perlakukan sebagai deret geometri. Blok berulang pertama di atas pangkat sepuluh adalah suku pertama, dan satu per sepuluh pangkat panjang blok adalah rasio. Untuk 0,272727 itu 27 per 100 dibagi 99 per 100, yaitu 3 per 11. ### Mengapa 0,999 berulang sama dengan 1? Itu deret geometri dengan suku pertama 9 per 10 dan rasio 1 per 10. Jumlahnya 9 per 10 dibagi 9 per 10, yaitu tepat 1. Desimal itu hanyalah nama lain untuk 1, bukan bilangan yang sedikit lebih kecil. ### Bagaimana mencari rasio dari dua suku? Bagi suku yang kemudian dengan yang lebih dulu, lalu tarik akar yang indeksnya banyak langkah di antara keduanya. Dengan suku kedua 6 dan suku kelima 48, hasil baginya 8 dan akar pangkat tiganya 2. Banyak langkah yang genap memungkinkan rasio positif dan negatif. ### Apa itu rata-rata geometri? Rata-rata geometri dua bilangan positif adalah akar dari hasil kalinya, sehingga untuk 2 dan 8 ia 4, bukan rata-rata aritmetika 5. Ia suku tengah barisan geometri, dan rata-rata yang tepat untuk faktor pertumbuhan. ### Apa kaitan bunga majemuk dengan barisan geometri? Dengan bunga majemuk saldo dikali 1 ditambah suku bunga tiap periode, sehingga saldo membentuk barisan geometri. Setelah n periode setoran P bernilai P kali 1,05 pangkat n pada bunga 5 persen. Bunga tunggal, sebaliknya, aritmetika. ### Berapa rasio untuk penurunan 20 persen? Rasionya 0,8, karena nilai yang turun 20 persen mempertahankan 80 persen dirinya. Kenaikan 20 persen berasio 1,2. Kesalahan umum adalah memakai 0,2, yang berarti penurunan 80 persen tiap periode. ### Bagaimana membuat barisan geometri di Python? Pakai list comprehension dengan operator pangkat, a1 kali r pangkat i untuk i dalam range n. Pakai kelas Fraction untuk jumlah eksak, karena float cepat meluap atau menjadi nol. Ingat bahwa tanda sisipan adalah XOR di Python, jadi tulis pangkat dengan dua tanda bintang. --- # Arithmetic Sequences and Series: Formulas, Sums and Examples Source: https://nunada.my.id/articles/arithmetic-sequences-and-series/ Updated: 2026-10-10 ## Quick answer **An arithmetic sequence is a list of numbers in which each term is the previous one plus the same fixed amount $d$, the common difference: $3,7,11,15,\ldots$ has $d=4$.** Its $n$-th term is $a_n=a_1+(n-1)d$, and the sum of the first $n$ terms, an arithmetic series, is $S_n=\frac n2(a_1+a_n)$. The sum formula comes from Gauss's trick of pairing the first and last terms, which all add to the same number. ### Key takeaways - In an arithmetic sequence the difference between neighbors is constant: $a_{n+1}-a_n=d$ for every $n$, and each term is the average of the two beside it. - The $n$-th term is $a_n=a_1+(n-1)d$, a linear function of $n$ with slope $d$, so its points lie on a straight line. - Two terms are enough to find the whole sequence: $d=\dfrac{a_q-a_p}{q-p}$, then $a_1=a_p-(p-1)d$. - The sum of the first $n$ terms is $S_n=\frac n2(a_1+a_n)=\frac n2\bigl(2a_1+(n-1)d\bigr)$; for example $1+2+\cdots+100=5050$. - To count terms from $a_1$ to a last term $\ell$, use $n=\dfrac{\ell-a_1}{d}+1$ and check that $n$ is a whole number. - An infinite arithmetic series with $d\neq0$ (or $a_1\neq0$) never settles on a total: its partial sums grow without bound. ## What is an arithmetic sequence? **An arithmetic sequence (or arithmetic progression) is a list of numbers $a_1,a_2,a_3,\ldots$ in which the difference between each term and the one before it is always the same number $d$, called the common difference.** The notation is $a_n$ for the term in position $n$, and in many school books $U_n$. That gives the rule $a_{n+1}=a_n+d$: to get the next term, add $d$. A **sequence** is the list itself; a **series** is what you get by adding its terms, which the sum section below takes up. | Sequence | Common difference | Kind | |---|---|---| | $2,5,8,11,\ldots$ | $d=3$ | increasing | | $20,15,10,5,\ldots$ | $d=-5$ | decreasing | | $\frac12,1,\frac32,2,\ldots$ | $d=\frac12$ | increasing, with fractions | | $7,7,7,7,\ldots$ | $d=0$ | constant | | $2,4,8,16,\ldots$ | differences $2,4,8$ | **not** arithmetic: each term is doubled | | $1,4,9,16,\ldots$ | differences $3,5,7$ | **not** arithmetic: the differences grow | **How to tell.** Subtract each term from the next, always later minus earlier. If every difference is the same, the sequence is arithmetic. One difference that breaks the pattern is enough to rule it out. A sequence whose terms are multiplied by the same number each time is a [geometric sequence](https://nunada.my.id/articles/geometric-sequences-and-series/#what-is-a-geometric-sequence), built from the powers in the article on [exponents](https://nunada.my.id/articles/exponents-and-radicals/#what-is-an-exponent). Two useful facts follow at once. Each term is the average of its two neighbors, $a_n=\frac{a_{n-1}+a_{n+1}}{2}$, which is why the word arithmetic is used: the arithmetic mean sits in the middle. And differences may be negative or fractions, so the [integers](https://nunada.my.id/articles/integers/#add-subtract) rules for negative numbers and the [rational numbers](https://nunada.my.id/articles/rational-numbers/#add-subtract-fractions) rules for fractions apply. **Where they appear.** Equal steps are everywhere: the heights of the steps in a staircase, seats in rows that each have 3 more than the one in front, a monthly saving that rises by a fixed amount, a taxi fare that adds a fixed charge per kilometer, a simple (not compound) interest balance. Type a list of numbers below and see whether it is arithmetic. ## How do you find the n-th term of an arithmetic sequence? **The $n$-th term of an arithmetic sequence is $a_n=a_1+(n-1)d$: start at the first term and add the difference $n-1$ times.** The reason for $n-1$ is that going from term 1 to term $n$ takes $n-1$ steps, not $n$. For $5,9,13,\ldots$ the first term is 5 and $d=4$, so $a_n=5+(n-1)\cdot4=4n+1$ and $a_{20}=5+19\cdot4=81$. **It is a linear function.** Expanding gives $a_n=dn+(a_1-d)$, which is a straight line in $n$ with slope $d$ and, for $n=0$, the intercept $a_1-d$. That is why the points of an arithmetic sequence lie on a line, and why the section on [algebraic expressions](https://nunada.my.id/articles/algebraic-expressions/#what-is-an-algebraic-expression) calls it linear: it has degree 1. A positive $d$ tilts the line up, a negative $d$ tilts it down, and $d=0$ makes it flat. **How many terms?** Solve $a_n=\ell$ for $n$: $n=\dfrac{\ell-a_1}{d}+1$. For $7,12,17,\ldots,102$ this is $\frac{102-7}{5}+1=20$. The answer must be a positive whole number, which also tells you whether a number belongs to the sequence: for 100 it is $\frac{100-7}{5}+1=19.6$, so 100 is not a term. The same count gives the number of multiples of 7 from 100 to 500: the first is $105=7\cdot15$ and the last $497=7\cdot71$, so $n=71-15+1=57$. Choose a first term, a difference and a length below, and watch the terms, the formula and the straight line. ## How do you find a sequence from two of its terms? **Two terms and their positions fix an arithmetic sequence completely: subtract them to find $d$, then step back to $a_1$.** Between term $p$ and term $q$ there are $q-p$ steps of size $d$, so $a_q-a_p=(q-p)d$ and $d=\dfrac{a_q-a_p}{q-p},\qquad a_1=a_p-(p-1)d.$ Example: $a_3=11$ and $a_7=23$. Then $d=\frac{23-11}{7-3}=\frac{12}{4}=3$ and $a_1=11-2\cdot3=5$, so the sequence is $5,8,11,14,\ldots$ with $a_n=3n+2$. Check: $a_3=11$, $a_7=23$. The usual slip is to divide by the wrong number: divide by the number of steps $q-p$ (here 4), not by $p$, $q$ or $q+p$. The two positions can be given in either order, because swapping them changes both the top and the bottom signs. **Arithmetic means.** Inserting $k$ numbers between $a$ and $b$ so that the whole list is arithmetic is the same problem with $q-p=k+1$ steps: $d=\frac{b-a}{k+1}$. Three means between 4 and 24 have $d=\frac{20}{4}=5$ and are 9, 14, 19. With one mean the answer is the plain average $\frac{a+b}{2}$. Give any two terms below and see the whole working. ## How do you find the sum of an arithmetic series? **The sum of the first $n$ terms of an arithmetic sequence is $S_n=\dfrac n2(a_1+a_n)=\dfrac n2\bigl(2a_1+(n-1)d\bigr)$: the number of terms times the average of the first and the last.** A sum of terms like this is called an arithmetic series, and $S_n$ is its $n$-th partial sum. **Gauss's trick.** Write the sum twice, once forward and once backward, and add the columns: $S_n=a_1+a_2+\cdots+a_n$ $S_n=a_n+a_{n-1}+\cdots+a_1$ In every column the sum is the same, $a_1+a_n$, because moving one place along adds $d$ to one term and takes it from the other. There are $n$ columns, so $2S_n=n(a_1+a_n)$. The story goes that Gauss, as a schoolboy, found $1+2+\cdots+100$ this way: 50 pairs of 101, which is 5050. **Examples.** - $5+9+13+\cdots$ with 20 terms: $a_{20}=81$, so $S_{20}=\frac{20}{2}(5+81)=860$. - $3+8+13+\cdots+98$: it has $\frac{98-3}{5}+1=20$ terms, so the sum is $\frac{20}{2}(3+98)=1010$. - The multiples of 7 from 105 to 497, 57 of them: $\frac{57}{2}(105+497)=17{,}157$. **Three sums worth knowing.** $1+2+\cdots+n=\frac{n(n+1)}{2}$ (the triangular numbers 1, 3, 6, 10, 15); the first $n$ odd numbers add to $n^2$, since $1+3+5+\cdots+(2n-1)=\frac n2\cdot2n$; and the first $n$ even numbers add to $n(n+1)$. **Sigma notation** writes a series compactly: $\sum_{k=1}^{n}(a_1+(k-1)d)$ means "add the terms for $k=1$ up to $k=n$". For example $\sum_{k=1}^{10}(3k+2)=5+8+\cdots+32=\frac{10}{2}(5+32)=185$. **$S_n$ is quadratic in $n$.** Expanding gives $S_n=\frac d2n^2+\bigl(a_1-\frac d2\bigr)n$, a quadratic with no constant term, which is how to recognize one. And you can run it backward: $a_n=S_n-S_{n-1}$ for $n\ge2$ (and $a_1=S_1$). If $S_n=2n^2+3n$ then $a_1=5$ and $a_n=\bigl(2n^2+3n\bigr)-\bigl(2(n-1)^2+3(n-1)\bigr)=4n+1$, which is the sequence $5,9,13,\ldots$ again. Try the pairing for your own sequence below. ## What happens to an infinite arithmetic series? **An infinite arithmetic series has no finite sum unless every term is 0: its partial sums grow without bound.** Adding more terms keeps changing the total by a non-zero amount, and with $d\neq0$ the terms themselves get larger in size, so the sum cannot settle. - If $d>0$ the partial sums $S_n=\frac d2n^2+\bigl(a_1-\frac d2\bigr)n$ eventually grow to $+\infty$. - If $d<0$ they eventually fall to $-\infty$. - If $d=0$ and $a_1\neq0$ then $S_n=na_1$ also grows without bound. Such a series is said to **diverge**. This is a sharp contrast with a [geometric series](https://nunada.my.id/articles/geometric-sequences-and-series/#infinite-geometric-series) with a common ratio of size less than 1, such as $\frac12+\frac14+\frac18+\cdots$, whose terms shrink fast enough for the sum to settle at 1. In practice that means every question about an arithmetic series asks for a finite number of terms. If a problem seems to ask for the sum of an infinite arithmetic series, it is a geometric series in disguise or the answer is "it diverges". ## How do you solve word problems with arithmetic sequences? **Read the problem for three things, the first term $a_1$, the common difference $d$ and what is asked (a term, a count, or a sum), then use the matching formula.** Check at the end that the answer is sensible and a whole number where it counts objects. | Problem | $a_1$, $d$ | Answer | |---|---|---| | A theater has 20 seats in row 1 and each row has 3 more. How many in row 15? | $20$, $3$ | $20+14\cdot3=62$ seats | | How many seats in all 15 rows? | same | $\frac{15}{2}(20+62)=615$ seats | | You save 100 dollars in month 1 and 50 more each month than the month before. How much in month 12, and in total? | $100$, $50$ | $100+11\cdot50=650$ dollars; $\frac{12}{2}(100+650)=4500$ dollars | | A salary of 40,000 dollars rises by 2,500 each year. What is it in year 8, and what is the 8-year total? | $40000$, $2500$ | $40000+7\cdot2500=57500$; $\frac82(40000+57500)=390000$ dollars | | Logs are stacked 10 in the bottom row, one fewer in each row up to 1. How many logs? | $10$, $-1$ | $10+9+\cdots+1=\frac{10}{2}(10+1)=55$ | Notice that "each row has 3 more" and "50 more each month" give $d$ directly, and that a drop gives a negative $d$. Notice too that the term in position 15 is only 14 steps from the first, the same $n-1$ as in the formula. **Simple interest** is an arithmetic sequence: a deposit of $P$ earning a fixed amount $I$ a year is worth $P,\ P+I,\ P+2I,\ldots$, so after $n$ years it is $P+nI$. Compound interest multiplies by a fixed ratio instead and gives a geometric sequence. ## How do you work with arithmetic sequences in Python and JavaScript? **In Python `range(first, stop, step)` is an arithmetic sequence of integers, and `sum` of it is an arithmetic series; in JavaScript you build the terms with `Array.from`.** The stop value of `range` is excluded, which is the usual source of off-by-one mistakes. ```python >>> list(range(3, 40, 4)) # first, stop (excluded), step [3, 7, 11, 15, 19, 23, 27, 31, 35, 39] >>> a1, d, n = 3, 4, 10 >>> a1 + (n - 1) * d # the n-th term 39 >>> n * (2 * a1 + (n - 1) * d) // 2 # the sum of the first n terms (exact) 210 >>> sum(range(1, 101)) # Gauss's sum 5050 >>> from itertools import accumulate >>> list(accumulate(range(1, 6))) # partial sums: 1, 3, 6, 10, 15 [1, 3, 6, 10, 15] >>> len(range(105, 498, 7)) # multiples of 7 from 105 to 497 57 >>> sum(range(105, 498, 7)) 17157 >>> [i * 0.1 for i in range(4)] # a float step drifts [0.0, 0.1, 0.2, 0.30000000000000004] ``` ```javascript const terms = (a1, d, n) => Array.from({ length: n }, (_, i) => a1 + i * d) terms(3, 4, 5) // [3, 7, 11, 15, 19] terms(3, 4, 5).reduce((s, x) => s + x, 0) // 55 (5 * (2 * 3 + 4 * 4)) / 2 // 55, from S = n(2a + (n-1)d)/2 Array.from({ length: 4 }, (_, i) => i * 0.1) // [0, 0.1, 0.2, 0.30000000000000004] ``` ```cpp #include #include using namespace std; int main() { int a1 = 3, d = 4, n = 10; for (int i = 0; i < n; i++) cout << a1 + i * d << " "; // the first ten terms cout << endl; cout << a1 + (n - 1) * d << endl; // the n-th term cout << n * (2 * a1 + (n - 1) * d) / 2 << endl; // the sum of n terms, exactly int gauss = 0; for (int i = 1; i <= 100; i++) gauss += i; cout << gauss << endl; // Gauss's sum int count = 0, total = 0; for (int m = 105; m <= 497; m += 7) { count++; total += m; } cout << count << " " << total << endl; // multiples of 7 from 105 to 497 for (int i = 0; i < 4; i++) printf("%.17f ", i * 0.1); // a float step drifts cout << endl; return 0; } /* output: 3 7 11 15 19 23 27 31 35 39 39 210 5050 57 17157 0.00000000000000000 0.10000000000000001 0.20000000000000001 0.30000000000000004 */ ``` The pitfalls, in order of how often they bite: | Pitfall | What happens | What to do | |---|---|---| | `range(1, 100)` for 1 to 100 | stops at 99 | the stop is excluded: `range(1, 101)` | | `a1 + n d` for the n-th term | gives the term after it | use `a1 + (n - 1) d`, or index from 0 | | A float step such as 0.1 | the terms drift: `0.30000000000000004` | multiply integers or use `Fraction`; do not add 0.1 repeatedly | | `range(0, 1, 0.1)` | TypeError in Python: range wants integers | scale to integers, or use `numpy.arange` with care | | `n * (a1 + an) / 2` in Python | gives a float | use `//` when everything is an integer: the product is always even | | Summing a long sequence in a loop | slow for huge n | use the formula, which is a constant number of operations | For exact fractional steps use `fractions.Fraction`, as in the article on [rational numbers](https://nunada.my.id/articles/rational-numbers/#fractions-in-code). Check a formula by comparing it with `sum(range(...))` on small cases before trusting it on large ones. ## Where do arithmetic sequences come from? **Arithmetic progressions are among the oldest patterns in mathematics, long before there was a notation for them.** - **c. 1550 BCE.** The Rhind Papyrus has a problem that shares 10 measures of barley among 10 men so that each gets the same amount more than the one before: an arithmetic progression with difference $\frac18$. - **5th century CE.** The Chinese Zhang Qiujian suanjing has a woman weaving cloth who weaves a fixed extra amount each day; the calculation was done on [counting rods](https://nunada.my.id/articles/chinese-numbers/#counting-rods). - **499 CE.** Aryabhata gave rules in his Aryabhatiya for the sum of an arithmetic progression and for the number of its terms. - **About 1787.** The classroom story about Gauss, aged nine or ten, is that his teacher set $1+2+\cdots+100$ to keep the class busy and Gauss answered 5050 at once, by pairing 1 with 100, 2 with 99 and so on. The story was written down long afterward and the details vary, but the idea of pairing is certainly his kind of insight, and it is the proof still given today. The word arithmetic goes back to the Greek arithmos, number. ## What are the common mistakes with arithmetic sequences? **The most common mistakes with arithmetic sequences are the nine below, each with the correct statement and a number that shows why.** | Mistake | Correct | |---|---| | ❌ $a_n=a_1+nd$ | $a_n=a_1+(n-1)d$: for $n=1$ the term is $a_1$, not $a_1+d$. | | ❌ $2,4,8,16$ is arithmetic | The differences are $2,4,8$; it is geometric. | | ❌ The number of terms is $\frac{\ell-a_1}{d}$ | Add 1: $\frac{102-7}{5}+1=20$, not 19. | | ❌ $S_n=n(a_1+a_n)$ | Halve it: $S_n=\frac n2(a_1+a_n)$; $1+2+3$ is $\frac32\cdot4=6$, not 12. | | ❌ $d=a_n-a_{n+1}$ | Later minus earlier: $d=a_{n+1}-a_n$; for $20,15,10$ it is $-5$. | | ❌ Dividing by $q$ or $p$ to find $d$ | Divide by the steps: $d=\frac{a_q-a_p}{q-p}$. | | ❌ A decreasing sequence has no sum | $20+15+10+5=50$; a negative $d$ is fine. | | ❌ An infinite arithmetic series has a total | It diverges unless every term is 0. | | ❌ "The sum of the sequence" | A sequence is the list; the sum of its terms is a series. | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: arithmetic sequences and series at a glance - **Definition:** $a_{n+1}-a_n=d$ is constant; each term is the average of its neighbors. - **n-th term:** $a_n=a_1+(n-1)d=dn+(a_1-d)$, a straight line in $n$. - **Number of terms:** $n=\dfrac{\ell-a_1}{d}+1$, which must be a positive whole number. - **From two terms:** $d=\dfrac{a_q-a_p}{q-p}$, $a_1=a_p-(p-1)d$; $k$ means between $a$ and $b$ have $d=\frac{b-a}{k+1}$. - **Sum:** $S_n=\frac n2(a_1+a_n)=\frac n2\bigl(2a_1+(n-1)d\bigr)$, quadratic in $n$; $a_n=S_n-S_{n-1}$. - **Special sums:** $1+\cdots+n=\frac{n(n+1)}2$; the first $n$ odd numbers give $n^2$. - **Infinite series:** an arithmetic series diverges. - **Code:** `range(first, stop, step)` with the stop excluded; use integers or `Fraction`, not repeated float steps. ## Glossary: key terms - **Sequence**: An ordered list of numbers, called terms, written a1, a2, a3 and so on. - **Term**: One number in a sequence; the n-th term is written a sub n. - **Arithmetic sequence**: A sequence in which the difference between each term and the one before it is always the same, such as 3, 7, 11, 15. - **Common difference**: The constant amount d added to each term of an arithmetic sequence to get the next; it can be positive, negative, zero or a fraction. - **Recursive formula**: A rule that gives each term from the one before it, such as a sub n plus 1 equals a sub n plus d. - **Explicit formula**: A rule that gives the n-th term directly from n, such as a sub n equals a sub 1 plus n minus 1 times d. - **Series**: The sum of the terms of a sequence, such as 3 plus 7 plus 11 plus 15. - **Partial sum**: The sum S sub n of the first n terms of a sequence. - **Sigma notation**: A compact way to write a sum using the Greek letter sigma, with the first and last values of the index written below and above it. - **Arithmetic mean**: The average of two numbers, half their sum; each term of an arithmetic sequence is the arithmetic mean of its neighbors. - **Triangular number**: A sum 1 plus 2 plus up to n, equal to n times n plus 1 over 2, such as 1, 3, 6, 10 and 15. - **Divergent series**: A series whose partial sums do not settle on a finite total; every infinite arithmetic series with a non-zero term is divergent. - **Geometric sequence**: A sequence in which each term is the previous one times the same fixed number, such as 2, 4, 8, 16. ## Frequently asked questions ### What is an arithmetic sequence? An arithmetic sequence is a list of numbers in which each term is the previous term plus the same fixed number, called the common difference. For example 3, 7, 11, 15 goes up by 4 each time. The difference can be negative, a fraction or zero. ### What is the formula for the n-th term of an arithmetic sequence? The n-th term is the first term plus n minus 1 times the common difference, written a sub n equals a sub 1 plus n minus 1 times d. For 5, 9, 13 the 20th term is 5 plus 19 times 4, which is 81. ### What is the formula for the sum of an arithmetic series? The sum of the first n terms is n over 2 times the first term plus the last term, or n over 2 times 2 times the first term plus n minus 1 times d. For 3 plus 8 up to 98, which has 20 terms, the sum is 10 times 101, which is 1010. ### What is the difference between a sequence and a series? A sequence is a list of numbers in order, such as 2, 5, 8, 11. A series is the sum of the terms of a sequence, such as 2 plus 5 plus 8 plus 11, which is 26. So a sequence has terms and a series has a total. ### How do you tell whether a sequence is arithmetic? Subtract each term from the next one, always later minus earlier. If all the differences are equal, the sequence is arithmetic and that value is the common difference. If even one difference is different, it is not, as in 1, 4, 9, 16 with differences 3, 5, 7. ### How do you find the number of terms? Use the last term minus the first term, divided by the common difference, plus 1. For 7, 12, 17 up to 102 that is 95 over 5 plus 1, which is 20. If the result is not a positive whole number, the last number is not a term. ### How do you find an arithmetic sequence from two terms? Divide the difference of the two terms by the difference of their positions to get d, then subtract p minus 1 steps from the earlier term to get the first term. With the third term 11 and the seventh term 23, d is 12 over 4, which is 3, and the first term is 5. ### How did Gauss add the numbers from 1 to 100? By pairing the first and the last numbers. 1 plus 100, 2 plus 99 and so on each make 101, and there are 50 such pairs, so the total is 50 times 101, which is 5050. The same pairing proves the general sum formula for any arithmetic series. ### What is the sum of the first n odd numbers? It is n squared. The odd numbers 1, 3, 5 up to 2n minus 1 form an arithmetic sequence with n terms, so the sum is n over 2 times 1 plus 2n minus 1, which is n squared. For example the first 50 odd numbers add to 2500. ### What are arithmetic means? They are the numbers inserted between two given numbers so that the whole list is arithmetic. For k means the common difference is the gap divided by k plus 1. Three means between 4 and 24 are 9, 14 and 19, and a single mean is just the average. ### Does an infinite arithmetic series have a sum? No, except in the trivial case where every term is zero. The partial sums grow without bound, upward if the difference is positive and downward if it is negative, so the series diverges. A geometric series with ratio smaller than 1 in size can have a sum. ### Is a list of square numbers an arithmetic sequence? No. The squares 1, 4, 9, 16 differ by 3, 5, 7, which are not equal, so the list is not arithmetic. The differences themselves form an arithmetic sequence with difference 2, which makes the squares a quadratic sequence, one level above arithmetic. ### How do you write a sum in sigma notation? Put the sigma sign, write the first and the last value of the index below and above it, and the formula for the term beside it. The sum of 3k plus 2 for k from 1 to 10 means 5 plus 8 and so on up to 32, which is 185. ### How do you make an arithmetic sequence in Python? Use range with a start, a stop and a step, such as range 3, 40, 4, and remember that the stop value is excluded. Sum of a range adds the terms. Avoid float steps such as 0.1, which drift, and use integers or the Fraction class instead. --- # Barisan dan Deret Aritmetika: Rumus, Jumlah, dan Contoh Source: https://nunada.my.id/artikel/barisan-dan-deret-aritmetika/ Updated: 2026-10-10 ## Jawaban singkat **Barisan aritmetika adalah daftar bilangan yang setiap sukunya sama dengan suku sebelumnya ditambah jumlah tetap $b$, yaitu beda: $3,7,11,15,\ldots$ memiliki $b=4$.** Suku ke-$n$-nya adalah $a_n=a_1+(n-1)b$, dan jumlah $n$ suku pertama, yaitu deret aritmetika, adalah $S_n=\frac n2(a_1+a_n)$. Rumus jumlah itu berasal dari trik Gauss memasangkan suku pertama dan terakhir, yang semuanya berjumlah sama. ### Poin penting - Pada barisan aritmetika selisih antartetangga konstan: $a_{n+1}-a_n=b$ untuk setiap $n$, dan setiap suku adalah rata-rata dari dua suku di sampingnya. - Suku ke-$n$ adalah $a_n=a_1+(n-1)b$, fungsi linear dari $n$ dengan kemiringan $b$, sehingga titik-titiknya terletak pada garis lurus. - Dua suku cukup untuk menemukan seluruh barisan: $b=\dfrac{a_q-a_p}{q-p}$, lalu $a_1=a_p-(p-1)b$. - Jumlah $n$ suku pertama adalah $S_n=\frac n2(a_1+a_n)=\frac n2\bigl(2a_1+(n-1)b\bigr)$; misalnya $1+2+\cdots+100=5050$. - Untuk menghitung banyak suku dari $a_1$ sampai suku terakhir $\ell$, pakai $n=\dfrac{\ell-a_1}{b}+1$ dan periksa bahwa $n$ bilangan bulat. - Deret aritmetika tak hingga dengan $b\neq0$ (atau $a_1\neq0$) tidak pernah menetap pada suatu jumlah: jumlah parsialnya membesar tanpa batas. ## Apa itu barisan aritmetika? **Barisan aritmetika (atau progresi aritmetika) adalah daftar bilangan $a_1,a_2,a_3,\ldots$ yang selisih antara tiap suku dan suku sebelumnya selalu bilangan yang sama $b$, yang disebut beda.** Notasinya $a_n$ untuk suku pada posisi $n$, dan di banyak buku sekolah $U_n$. Itu memberi aturan $a_{n+1}=a_n+b$: untuk mendapat suku berikutnya, tambahkan $b$. **Barisan** adalah daftar itu sendiri; **deret** adalah hasil menjumlahkan suku-sukunya, yang dibahas pada bagian jumlah di bawah. | Barisan | Beda | Jenis | |---|---|---| | $2,5,8,11,\ldots$ | $b=3$ | naik | | $20,15,10,5,\ldots$ | $b=-5$ | turun | | $\frac12,1,\frac32,2,\ldots$ | $b=\frac12$ | naik, dengan pecahan | | $7,7,7,7,\ldots$ | $b=0$ | konstan | | $2,4,8,16,\ldots$ | selisih $2,4,8$ | **bukan** aritmetika: tiap suku dilipatduakan | | $1,4,9,16,\ldots$ | selisih $3,5,7$ | **bukan** aritmetika: selisihnya membesar | **Cara mengetahuinya.** Kurangkan tiap suku dari suku berikutnya, selalu yang kemudian dikurangi yang lebih dulu. Jika setiap selisih sama, barisannya aritmetika. Satu selisih yang menyimpang saja cukup untuk menyingkirkannya. Barisan yang sukunya dikalikan bilangan yang sama setiap kali adalah [barisan geometri](https://nunada.my.id/artikel/barisan-dan-deret-geometri/#what-is-a-geometric-sequence), yang dibangun dari pangkat pada artikel [eksponen](https://nunada.my.id/artikel/eksponen-dan-akar/#what-is-an-exponent). Dua fakta berguna langsung mengikutinya. Setiap suku adalah rata-rata dari dua tetangganya, $a_n=\frac{a_{n-1}+a_{n+1}}{2}$, itulah sebabnya kata aritmetika dipakai: rata-rata aritmetika berada di tengah. Dan beda boleh negatif atau pecahan, sehingga aturan [bilangan bulat](https://nunada.my.id/artikel/bilangan-bulat/#add-subtract) untuk bilangan negatif dan aturan [bilangan rasional](https://nunada.my.id/artikel/bilangan-rasional/#add-subtract-fractions) untuk pecahan berlaku. **Di mana ia muncul.** Langkah yang sama ada di mana-mana: tinggi anak tangga, kursi pada baris yang masing-masing 3 lebih banyak daripada baris di depannya, tabungan bulanan yang naik dengan jumlah tetap, ongkos taksi yang menambah biaya tetap per kilometer, saldo dengan bunga tunggal (bukan majemuk). Ketik daftar bilangan di bawah dan lihat apakah ia aritmetika. ## Bagaimana mencari suku ke-n barisan aritmetika? **Suku ke-$n$ barisan aritmetika adalah $a_n=a_1+(n-1)b$: mulai dari suku pertama dan tambahkan beda sebanyak $n-1$ kali.** Alasan $n-1$ adalah bahwa dari suku 1 ke suku $n$ diperlukan $n-1$ langkah, bukan $n$. Untuk $5,9,13,\ldots$ suku pertamanya 5 dan $b=4$, sehingga $a_n=5+(n-1)\cdot4=4n+1$ dan $a_{20}=5+19\cdot4=81$. **Ia fungsi linear.** Menjabarkan memberi $a_n=dn+(a_1-b)$, yaitu garis lurus dalam $n$ dengan kemiringan $b$ dan, untuk $n=0$, perpotongan $a_1-b$. Itulah sebabnya titik-titik barisan aritmetika terletak pada garis, dan mengapa bagian [bentuk aljabar](https://nunada.my.id/artikel/bentuk-aljabar/#what-is-an-algebraic-expression) menyebutnya linear: ia berderajat 1. $b$ positif memiringkan garis ke atas, $b$ negatif memiringkannya ke bawah, dan $b=0$ membuatnya datar. **Berapa banyak suku?** Selesaikan $a_n=\ell$ untuk $n$: $n=\dfrac{\ell-a_1}{b}+1$. Untuk $7,12,17,\ldots,102$ ini $\frac{102-7}{5}+1=20$. Jawabannya harus bilangan bulat positif, yang juga memberi tahu apakah suatu bilangan termasuk dalam barisan: untuk 100 hasilnya $\frac{100-7}{5}+1=19{,}6$, sehingga 100 bukan suku. Hitungan yang sama memberi banyak kelipatan 7 dari 100 sampai 500: yang pertama $105=7\cdot15$ dan yang terakhir $497=7\cdot71$, sehingga $n=71-15+1=57$. Pilih suku pertama, beda, dan panjang di bawah, dan perhatikan suku-sukunya, rumusnya, dan garis lurusnya. ## Bagaimana menemukan barisan dari dua sukunya? **Dua suku beserta posisinya menentukan barisan aritmetika sepenuhnya: kurangkan keduanya untuk mendapat $b$, lalu mundur ke $a_1$.** Di antara suku $p$ dan suku $q$ ada $q-p$ langkah sebesar $b$, sehingga $a_q-a_p=(q-p)b$ dan $b=\dfrac{a_q-a_p}{q-p},\qquad a_1=a_p-(p-1)b.$ Contoh: $a_3=11$ dan $a_7=23$. Maka $b=\frac{23-11}{7-3}=\frac{12}{4}=3$ dan $a_1=11-2\cdot3=5$, sehingga barisannya $5,8,11,14,\ldots$ dengan $a_n=3n+2$. Periksa: $a_3=11$, $a_7=23$. Kekeliruan yang biasa adalah membagi dengan bilangan yang salah: bagi dengan banyaknya langkah $q-p$ (di sini 4), bukan dengan $p$, $q$, atau $q+p$. Kedua posisi boleh diberikan dalam urutan apa pun, karena menukarnya mengubah tanda atas dan bawah sekaligus. **Rata-rata aritmetika (sisipan).** Menyisipkan $k$ bilangan di antara $a$ dan $c$ sehingga seluruh daftarnya aritmetika adalah masalah yang sama dengan $q-p=k+1$ langkah: $b=\frac{c-a}{k+1}$. Tiga sisipan di antara 4 dan 24 punya $b=\frac{20}{4}=5$ dan berupa 9, 14, 19. Dengan satu sisipan jawabannya rata-rata biasa $\frac{a+c}{2}$. Beri dua suku apa pun di bawah dan lihat seluruh langkahnya. ## Bagaimana mencari jumlah deret aritmetika? **Jumlah $n$ suku pertama barisan aritmetika adalah $S_n=\dfrac n2(a_1+a_n)=\dfrac n2\bigl(2a_1+(n-1)b\bigr)$: banyak suku dikali rata-rata suku pertama dan suku terakhir.** Jumlah suku-suku seperti ini disebut deret aritmetika, dan $S_n$ adalah jumlah parsial ke-$n$-nya. **Trik Gauss.** Tulis jumlahnya dua kali, sekali maju dan sekali mundur, lalu jumlahkan kolomnya: $S_n=a_1+a_2+\cdots+a_n$ $S_n=a_n+a_{n-1}+\cdots+a_1$ Pada setiap kolom jumlahnya sama, $a_1+a_n$, karena bergeser satu tempat menambah $b$ pada satu suku dan mengambilnya dari yang lain. Ada $n$ kolom, sehingga $2S_n=n(a_1+a_n)$. Konon Gauss, sebagai anak sekolah, menemukan $1+2+\cdots+100$ dengan cara ini: 50 pasang 101, yaitu 5050. **Contoh.** - $5+9+13+\cdots$ dengan 20 suku: $a_{20}=81$, sehingga $S_{20}=\frac{20}{2}(5+81)=860$. - $3+8+13+\cdots+98$: banyak sukunya $\frac{98-3}{5}+1=20$, sehingga jumlahnya $\frac{20}{2}(3+98)=1010$. - Kelipatan 7 dari 105 sampai 497, sebanyak 57: $\frac{57}{2}(105+497)=17.157$. **Tiga jumlah yang layak diketahui.** $1+2+\cdots+n=\frac{n(n+1)}{2}$ (bilangan segitiga 1, 3, 6, 10, 15); $n$ bilangan ganjil pertama berjumlah $n^2$, sebab $1+3+5+\cdots+(2n-1)=\frac n2\cdot2n$; dan $n$ bilangan genap pertama berjumlah $n(n+1)$. **Notasi sigma** menulis deret secara ringkas: $\sum_{k=1}^{n}(a_1+(k-1)b)$ berarti "jumlahkan suku-suku untuk $k=1$ sampai $k=n$". Misalnya $\sum_{k=1}^{10}(3k+2)=5+8+\cdots+32=\frac{10}{2}(5+32)=185$. **$S_n$ kuadrat dalam $n$.** Menjabarkan memberi $S_n=\frac b2n^2+\bigl(a_1-\frac b2\bigr)n$, sebuah kuadrat tanpa suku konstanta, yang menjadi cara mengenalinya. Dan kamu dapat menjalankannya mundur: $a_n=S_n-S_{n-1}$ untuk $n\ge2$ (dan $a_1=S_1$). Jika $S_n=2n^2+3n$ maka $a_1=5$ dan $a_n=\bigl(2n^2+3n\bigr)-\bigl(2(n-1)^2+3(n-1)\bigr)=4n+1$, yaitu barisan $5,9,13,\ldots$ lagi. Coba pemasangan itu untuk barisanmu sendiri di bawah. ## Apa yang terjadi pada deret aritmetika tak hingga? **Deret aritmetika tak hingga tidak punya jumlah berhingga kecuali setiap sukunya 0: jumlah parsialnya membesar tanpa batas.** Menambah lebih banyak suku terus mengubah jumlah dengan nilai bukan nol, dan dengan $b\neq0$ sukunya sendiri makin besar ukurannya, sehingga jumlahnya tidak dapat menetap. - Jika $b>0$ jumlah parsial $S_n=\frac b2n^2+\bigl(a_1-\frac b2\bigr)n$ akhirnya membesar menuju $+\infty$. - Jika $b<0$ jumlah itu akhirnya turun menuju $-\infty$. - Jika $b=0$ dan $a_1\neq0$ maka $S_n=na_1$ juga membesar tanpa batas. Deret seperti itu dikatakan **divergen**. Ini kontras tajam dengan [deret geometri](https://nunada.my.id/artikel/barisan-dan-deret-geometri/#infinite-geometric-series) yang rasionya berukuran kurang dari 1, seperti $\frac12+\frac14+\frac18+\cdots$, yang sukunya mengecil cukup cepat sehingga jumlahnya menetap di 1. Dalam praktik itu berarti setiap pertanyaan tentang deret aritmetika meminta banyak suku yang berhingga. Jika suatu soal tampak meminta jumlah deret aritmetika tak hingga, itu deret geometri yang menyamar atau jawabannya "divergen". ## Bagaimana menyelesaikan soal cerita barisan aritmetika? **Bacalah soal untuk tiga hal, suku pertama $a_1$, beda $b$, dan yang ditanyakan (sebuah suku, banyaknya, atau jumlah), lalu pakai rumus yang sesuai.** Periksa di akhir bahwa jawabannya masuk akal dan bilangan bulat bila menghitung benda. | Soal | $a_1$, $b$ | Jawaban | |---|---|---| | Gedung pertunjukan punya 20 kursi di baris 1 dan tiap baris berikutnya 3 kursi lebih banyak. Berapa kursi di baris 15? | $20$, $3$ | $20+14\cdot3=62$ kursi | | Berapa kursi di seluruh 15 baris? | sama | $\frac{15}{2}(20+62)=615$ kursi | | Kamu menabung Rp100.000 pada bulan 1 dan Rp50.000 lebih banyak tiap bulan daripada bulan sebelumnya. Berapa pada bulan 12, dan totalnya? | $100000$, $50000$ | $100000+11\cdot50000=650000$, yaitu Rp650.000; $\frac{12}{2}(100000+650000)=4500000$, yaitu Rp4.500.000 | | Gaji Rp4.000.000 naik Rp250.000 tiap tahun. Berapa pada tahun ke-8, dan total 8 tahun? | $4000000$, $250000$ | $4000000+7\cdot250000=5750000$; $\frac82(4000000+5750000)=39000000$, yaitu Rp39.000.000 | | Kayu ditumpuk 10 pada baris bawah, satu lebih sedikit tiap baris sampai 1. Berapa batang kayu? | $10$, $-1$ | $10+9+\cdots+1=\frac{10}{2}(10+1)=55$ | Perhatikan bahwa "tiap baris 3 lebih banyak" dan "Rp50.000 lebih banyak tiap bulan" memberi $b$ langsung, dan penurunan memberi $b$ negatif. Perhatikan juga bahwa suku pada posisi 15 hanya 14 langkah dari yang pertama, $n-1$ yang sama seperti pada rumus. **Bunga tunggal** adalah barisan aritmetika: simpanan $P$ yang menghasilkan jumlah tetap $I$ per tahun bernilai $P,\ P+I,\ P+2I,\ldots$, sehingga setelah $n$ tahun menjadi $P+nI$. Bunga majemuk mengalikan dengan rasio tetap dan menghasilkan barisan geometri. ## Bagaimana mengolah barisan aritmetika di Python dan JavaScript? **Di Python `range(awal, berhenti, langkah)` adalah barisan aritmetika bilangan bulat, dan `sum` darinya adalah deret aritmetika; di JavaScript kamu membangun suku-sukunya dengan `Array.from`.** Nilai berhenti pada `range` tidak termasuk, yang menjadi sumber umum kekeliruan selisih satu. ```python >>> list(range(3, 40, 4)) # first, stop (excluded), step [3, 7, 11, 15, 19, 23, 27, 31, 35, 39] >>> a1, d, n = 3, 4, 10 >>> a1 + (n - 1) * d # the n-th term 39 >>> n * (2 * a1 + (n - 1) * d) // 2 # the sum of the first n terms (exact) 210 >>> sum(range(1, 101)) # Gauss's sum 5050 >>> from itertools import accumulate >>> list(accumulate(range(1, 6))) # partial sums: 1, 3, 6, 10, 15 [1, 3, 6, 10, 15] >>> len(range(105, 498, 7)) # multiples of 7 from 105 to 497 57 >>> sum(range(105, 498, 7)) 17157 >>> [i * 0.1 for i in range(4)] # a float step drifts [0.0, 0.1, 0.2, 0.30000000000000004] ``` ```javascript const terms = (a1, d, n) => Array.from({ length: n }, (_, i) => a1 + i * d) terms(3, 4, 5) // [3, 7, 11, 15, 19] terms(3, 4, 5).reduce((s, x) => s + x, 0) // 55 (5 * (2 * 3 + 4 * 4)) / 2 // 55, from S = n(2a + (n-1)d)/2 Array.from({ length: 4 }, (_, i) => i * 0.1) // [0, 0.1, 0.2, 0.30000000000000004] ``` ```cpp #include #include using namespace std; int main() { int a1 = 3, d = 4, n = 10; for (int i = 0; i < n; i++) cout << a1 + i * d << " "; // the first ten terms cout << endl; cout << a1 + (n - 1) * d << endl; // the n-th term cout << n * (2 * a1 + (n - 1) * d) / 2 << endl; // the sum of n terms, exactly int gauss = 0; for (int i = 1; i <= 100; i++) gauss += i; cout << gauss << endl; // Gauss's sum int count = 0, total = 0; for (int m = 105; m <= 497; m += 7) { count++; total += m; } cout << count << " " << total << endl; // multiples of 7 from 105 to 497 for (int i = 0; i < 4; i++) printf("%.17f ", i * 0.1); // a float step drifts cout << endl; return 0; } /* output: 3 7 11 15 19 23 27 31 35 39 39 210 5050 57 17157 0.00000000000000000 0.10000000000000001 0.20000000000000001 0.30000000000000004 */ ``` Jebakannya, berurutan dari yang paling sering menggigit: | Jebakan | Yang terjadi | Yang sebaiknya dilakukan | |---|---|---| | `range(1, 100)` untuk 1 sampai 100 | berhenti di 99 | nilai berhenti tidak termasuk: `range(1, 101)` | | `a1 + n d` untuk suku ke-n | memberi suku sesudahnya | pakai `a1 + (n - 1) d`, atau beri indeks dari 0 | | Langkah float seperti 0,1 | suku-sukunya bergeser: `0.30000000000000004` | kalikan bilangan bulat atau pakai `Fraction`; jangan menambah 0,1 berulang kali | | `range(0, 1, 0.1)` | TypeError di Python: range meminta bilangan bulat | skalakan ke bilangan bulat, atau pakai `numpy.arange` dengan hati-hati | | `n * (a1 + an) / 2` di Python | memberi float | pakai `//` bila semuanya bilangan bulat: hasil kalinya selalu genap | | Menjumlah barisan panjang dalam perulangan | lambat untuk n besar | pakai rumus, yang jumlah operasinya tetap | Untuk langkah pecahan yang eksak pakai `fractions.Fraction`, seperti pada artikel [bilangan rasional](https://nunada.my.id/artikel/bilangan-rasional/#fractions-in-code). Periksa sebuah rumus dengan membandingkannya dengan `sum(range(...))` pada kasus kecil sebelum memercayainya untuk yang besar. ## Dari mana asal barisan aritmetika? **Progresi aritmetika termasuk pola tertua dalam matematika, jauh sebelum ada notasi untuknya.** - **Sekitar 1550 SM.** Papirus Rhind memuat soal yang membagi 10 takaran jelai kepada 10 orang sehingga masing-masing mendapat jumlah yang sama lebih banyak daripada sebelumnya: progresi aritmetika dengan beda $\frac18$. - **Abad ke-5 M.** Zhang Qiujian suanjing dari China memuat soal seorang perempuan menenun kain yang menenun tambahan tetap setiap hari; hitungannya dilakukan dengan [batang hitung](https://nunada.my.id/artikel/bilangan-bahasa-china/#counting-rods). - **499 M.** Aryabhata memberi aturan dalam Aryabhatiya-nya untuk jumlah progresi aritmetika dan untuk banyak sukunya. - **Sekitar 1787.** Kisah di ruang kelas tentang Gauss, berusia sembilan atau sepuluh tahun, adalah bahwa gurunya memberi $1+2+\cdots+100$ agar kelas sibuk dan Gauss langsung menjawab 5050, dengan memasangkan 1 dengan 100, 2 dengan 99, dan seterusnya. Kisah ini ditulis lama sesudahnya dan rinciannya beragam, tetapi gagasan memasangkan itu jelas wawasan khas dirinya, dan itulah bukti yang masih diberikan sekarang. Kata aritmetika berasal dari bahasa Yunani arithmos, bilangan. ## Apa kesalahan umum pada barisan aritmetika? **Kesalahan paling umum pada barisan aritmetika adalah sembilan hal berikut, masing-masing dengan pernyataan yang benar dan bilangan yang menunjukkan alasannya.** | Kesalahan | Yang benar | |---|---| | ❌ $a_n=a_1+nd$ | $a_n=a_1+(n-1)b$: untuk $n=1$ sukunya $a_1$, bukan $a_1+b$. | | ❌ $2,4,8,16$ aritmetika | Selisihnya $2,4,8$; ia geometri. | | ❌ Banyak suku adalah $\frac{\ell-a_1}{b}$ | Tambah 1: $\frac{102-7}{5}+1=20$, bukan 19. | | ❌ $S_n=n(a_1+a_n)$ | Bagi dua: $S_n=\frac n2(a_1+a_n)$; $1+2+3$ adalah $\frac32\cdot4=6$, bukan 12. | | ❌ $b=a_n-a_{n+1}$ | Yang kemudian dikurangi yang lebih dulu: $b=a_{n+1}-a_n$; untuk $20,15,10$ ia $-5$. | | ❌ Membagi dengan $q$ atau $p$ untuk mencari $b$ | Bagi dengan banyak langkah: $b=\frac{a_q-a_p}{q-p}$. | | ❌ Barisan menurun tidak punya jumlah | $20+15+10+5=50$; $b$ negatif tidak masalah. | | ❌ Deret aritmetika tak hingga punya jumlah | Ia divergen kecuali setiap sukunya 0. | | ❌ "Jumlah barisan" | Barisan adalah daftarnya; jumlah sukunya adalah deret. | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: barisan dan deret aritmetika sekilas - **Definisi:** $a_{n+1}-a_n=b$ konstan; setiap suku adalah rata-rata tetangganya. - **Suku ke-n:** $a_n=a_1+(n-1)b=dn+(a_1-b)$, garis lurus dalam $n$. - **Banyak suku:** $n=\dfrac{\ell-a_1}{b}+1$, yang harus bilangan bulat positif. - **Dari dua suku:** $b=\dfrac{a_q-a_p}{q-p}$, $a_1=a_p-(p-1)b$; $k$ sisipan di antara $a$ dan $c$ punya $b=\frac{c-a}{k+1}$. - **Jumlah:** $S_n=\frac n2(a_1+a_n)=\frac n2\bigl(2a_1+(n-1)b\bigr)$, kuadrat dalam $n$; $a_n=S_n-S_{n-1}$. - **Jumlah khusus:** $1+\cdots+n=\frac{n(n+1)}2$; $n$ bilangan ganjil pertama memberi $n^2$. - **Deret tak hingga:** deret aritmetika divergen. - **Kode:** `range(awal, berhenti, langkah)` dengan nilai berhenti tidak termasuk; pakai bilangan bulat atau `Fraction`, bukan langkah float berulang. ## Glosarium: istilah penting - **Barisan**: Daftar bilangan berurutan, yang disebut suku, ditulis a1, a2, a3 dan seterusnya. - **Suku**: Satu bilangan dalam barisan; suku ke-n ditulis a indeks n. - **Barisan aritmetika**: Barisan yang selisih antara tiap suku dan suku sebelumnya selalu sama, seperti 3, 7, 11, 15. - **Beda**: Jumlah tetap b yang ditambahkan pada tiap suku barisan aritmetika untuk mendapat suku berikutnya; ia dapat positif, negatif, nol, atau pecahan. - **Rumus rekursif**: Aturan yang memberi tiap suku dari suku sebelumnya, seperti a indeks n tambah 1 sama dengan a indeks n ditambah b. - **Rumus eksplisit**: Aturan yang memberi suku ke-n langsung dari n, seperti a indeks n sama dengan a indeks 1 ditambah n dikurangi 1 kali b. - **Deret**: Jumlah suku-suku sebuah barisan, seperti 3 ditambah 7 ditambah 11 ditambah 15. - **Jumlah parsial**: Jumlah S indeks n dari n suku pertama sebuah barisan. - **Notasi sigma**: Cara ringkas menulis jumlah memakai huruf Yunani sigma, dengan nilai pertama dan terakhir indeks ditulis di bawah dan di atasnya. - **Rata-rata aritmetika**: Rata-rata dua bilangan, setengah jumlahnya; setiap suku barisan aritmetika adalah rata-rata aritmetika dari tetangganya. - **Bilangan segitiga**: Jumlah 1 ditambah 2 sampai n, sama dengan n kali n tambah 1 per 2, seperti 1, 3, 6, 10, dan 15. - **Deret divergen**: Deret yang jumlah parsialnya tidak menetap pada jumlah berhingga; setiap deret aritmetika tak hingga dengan suku bukan nol divergen. - **Barisan geometri**: Barisan yang setiap sukunya adalah suku sebelumnya dikali bilangan tetap yang sama, seperti 2, 4, 8, 16. ## Pertanyaan yang sering diajukan ### Apa itu barisan aritmetika? Barisan aritmetika adalah daftar bilangan yang setiap sukunya sama dengan suku sebelumnya ditambah bilangan tetap yang sama, yang disebut beda. Misalnya 3, 7, 11, 15 naik 4 setiap kali. Bedanya dapat negatif, pecahan, atau nol. ### Apa rumus suku ke-n barisan aritmetika? Suku ke-n adalah suku pertama ditambah n dikurangi 1 kali beda, ditulis a indeks n sama dengan a indeks 1 ditambah n dikurangi 1 kali b. Untuk 5, 9, 13 suku ke-20 adalah 5 ditambah 19 kali 4, yaitu 81. ### Apa rumus jumlah deret aritmetika? Jumlah n suku pertama adalah n per 2 kali suku pertama ditambah suku terakhir, atau n per 2 kali 2 kali suku pertama ditambah n dikurangi 1 kali b. Untuk 3 ditambah 8 sampai 98, yang punya 20 suku, jumlahnya 10 kali 101, yaitu 1010. ### Apa beda barisan dan deret? Barisan adalah daftar bilangan berurutan, seperti 2, 5, 8, 11. Deret adalah jumlah suku-suku sebuah barisan, seperti 2 ditambah 5 ditambah 8 ditambah 11, yaitu 26. Jadi barisan punya suku dan deret punya jumlah. ### Bagaimana mengetahui apakah suatu barisan aritmetika? Kurangkan tiap suku dari suku berikutnya, selalu yang kemudian dikurangi yang lebih dulu. Jika semua selisih sama, barisannya aritmetika dan nilai itu adalah bedanya. Jika satu selisih saja berbeda, ia bukan, seperti pada 1, 4, 9, 16 dengan selisih 3, 5, 7. ### Bagaimana mencari banyak suku? Pakai suku terakhir dikurangi suku pertama, dibagi beda, ditambah 1. Untuk 7, 12, 17 sampai 102 itu 95 per 5 ditambah 1, yaitu 20. Jika hasilnya bukan bilangan bulat positif, bilangan terakhir itu bukan suku. ### Bagaimana menemukan barisan aritmetika dari dua suku? Bagi selisih kedua suku dengan selisih posisinya untuk mendapat b, lalu kurangkan p dikurangi 1 langkah dari suku yang lebih awal untuk mendapat suku pertama. Dengan suku ketiga 11 dan suku ketujuh 23, b adalah 12 per 4, yaitu 3, dan suku pertamanya 5. ### Bagaimana Gauss menjumlahkan bilangan 1 sampai 100? Dengan memasangkan bilangan pertama dan terakhir. 1 ditambah 100, 2 ditambah 99 dan seterusnya masing-masing 101, dan ada 50 pasangan seperti itu, sehingga jumlahnya 50 kali 101, yaitu 5050. Pemasangan yang sama membuktikan rumus jumlah umum untuk deret aritmetika mana pun. ### Berapa jumlah n bilangan ganjil pertama? Jumlahnya n kuadrat. Bilangan ganjil 1, 3, 5 sampai 2n dikurangi 1 membentuk barisan aritmetika dengan n suku, sehingga jumlahnya n per 2 kali 1 ditambah 2n dikurangi 1, yaitu n kuadrat. Misalnya 50 bilangan ganjil pertama berjumlah 2500. ### Apa itu rata-rata aritmetika dalam barisan? Itu bilangan-bilangan yang disisipkan di antara dua bilangan yang diberikan sehingga seluruh daftarnya aritmetika. Untuk k sisipan beda adalah selisih dibagi k ditambah 1. Tiga sisipan di antara 4 dan 24 adalah 9, 14, dan 19, dan satu sisipan hanyalah rata-ratanya. ### Apakah deret aritmetika tak hingga punya jumlah? Tidak, kecuali pada kasus sepele ketika setiap sukunya nol. Jumlah parsialnya membesar tanpa batas, ke atas bila beda positif dan ke bawah bila negatif, sehingga deretnya divergen. Deret geometri dengan rasio berukuran kurang dari 1 dapat punya jumlah. ### Apakah daftar bilangan kuadrat merupakan barisan aritmetika? Bukan. Bilangan kuadrat 1, 4, 9, 16 berselisih 3, 5, 7 yang tidak sama, sehingga daftarnya bukan aritmetika. Selisihnya sendiri membentuk barisan aritmetika dengan beda 2, yang menjadikan bilangan kuadrat barisan kuadratik, satu tingkat di atas aritmetika. ### Bagaimana menulis jumlah dengan notasi sigma? Taruh tanda sigma, tulis nilai pertama dan terakhir indeks di bawah dan di atasnya, dan rumus suku di sampingnya. Jumlah 3k ditambah 2 untuk k dari 1 sampai 10 berarti 5 ditambah 8 dan seterusnya sampai 32, yaitu 185. ### Bagaimana membuat barisan aritmetika di Python? Pakai range dengan awal, batas berhenti, dan langkah, seperti range 3, 40, 4, dan ingat bahwa nilai berhenti tidak termasuk. Sum dari sebuah range menjumlahkan suku-sukunya. Hindari langkah float seperti 0,1, yang bergeser, dan pakai bilangan bulat atau kelas Fraction. --- # Binary Numbers: How Computers Count, Convert and Calculate Source: https://nunada.my.id/articles/binary-numbers/ Updated: 2026-10-31 ## Quick answer **A binary number is a number written in base 2, with only the digits 0 and 1, where each place is worth twice the place to its right: $1011_2=8+2+1=11$.** Computers use it because a switch has two states, and every number, letter and image is stored as a string of these bits. To convert, add the powers of 2 under the 1s, or divide by 2 repeatedly and read the remainders from the bottom up. ### Key takeaways - Binary is place value in base 2: the places are worth $1,2,4,8,16,\ldots$, and a digit is a bit, 0 or 1. - $n$ bits hold $2^n$ values, from 0 to $2^n-1$; a byte is 8 bits and holds 256 values. - Hexadecimal is shorthand for binary: one hex digit is exactly four bits, so `FF` is $11111111_2=255$. - In binary $1+1=10$: add column by column, carrying 1; multiplying is shifting and adding, and doubling is adding a 0 at the end. - Negative integers use two's complement: invert the bits and add 1, so $-5$ is $11111011$ in 8 bits and the top bit is worth $-2^{n-1}$. - A fraction terminates in binary only if its denominator is a power of 2, so $0.1$ repeats ($0.0\overline{0011}_2$) and a float can only store it approximately. ## What is a binary number? **A binary number is written in base 2: it uses only the two digits 0 and 1, called bits (from binary digit), and each place is worth twice the place to its right.** Ordinary decimal numbers work the same way with ten digits and places worth 1, 10, 100, 1000. In both, the value of a digit depends on where it stands, which is the idea of [place value](https://nunada.my.id/articles/chinese-numbers/#counting-rods) found in every positional system. The place values in binary are the powers of 2, counted from the right starting at $2^0$ (see [exponents](https://nunada.my.id/articles/exponents-and-radicals/#what-is-an-exponent)): | Place | $2^7$ | $2^6$ | $2^5$ | $2^4$ | $2^3$ | $2^2$ | $2^1$ | $2^0$ | |---|---|---|---|---|---|---|---|---| | Value | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | | Bit | 0 | 1 | 0 | 1 | 1 | 0 | 1 | 0 | The number in the table is $01011010_2=64+16+8+2=90$. A subscript 2 says the base, because $10_2$ is two but $10$ is ten. Counting in binary is counting in decimal with only two digits. When the last digit reaches 1 the next count carries into the next place, as 9 becomes 10 in decimal: | Decimal | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | |---|---|---|---|---|---|---|---|---| | Binary | 0 | 1 | 10 | 11 | 100 | 101 | 110 | 111 | | Decimal | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | |---|---|---|---|---|---|---|---|---| | Binary | 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110 | 1111 | **Why computers use binary.** A transistor is either conducting or not, a magnetic spot points one way or the other, a pit on a disc is there or not. Two states are easy to tell apart even when the signal is noisy, so a machine can copy and process them without error; ten voltage levels would be far harder. Everything else, numbers, text, pictures and sound, is first turned into numbers and then into bits. The last bit also tells you something simple: a binary number is even when it ends in 0, as in the [even and odd numbers](https://nunada.my.id/articles/integers/#divisibility) of the integers article. ## How do you convert between binary, decimal and hexadecimal? **To turn binary into decimal, add the place values of the 1s; to turn decimal into binary, divide by 2 again and again and read the remainders from the bottom up.** Both use only the powers of 2. **Binary to decimal.** $1011010_2$ has 1s in the places worth 64, 16, 8 and 2, so it is $64+16+8+2=90$. **Decimal to binary.** Divide by 2, write down the remainder, and carry on with the quotient until it reaches 0. For 90: | Division | Quotient | Remainder | |---|---|---| | $90\div2$ | 45 | 0 | | $45\div2$ | 22 | 1 | | $22\div2$ | 11 | 0 | | $11\div2$ | 5 | 1 | | $5\div2$ | 2 | 1 | | $2\div2$ | 1 | 0 | | $1\div2$ | 0 | 1 | Read the remainders upward: $1011010_2$. This is the same division with remainder as in the [integers article](https://nunada.my.id/articles/integers/#remainders), and the last remainder is the leftmost digit because it is the highest place. **Octal and hexadecimal.** Binary strings are long, so programmers group the bits. Three bits make one **octal** digit (base 8, digits 0 to 7) and four bits make one **hexadecimal** digit (base 16, digits 0 to 9 and then A to F for 10 to 15): | Binary | 0000 | 0001 | 0010 | 0011 | 0100 | 0101 | 0110 | 0111 | |---|---|---|---|---|---|---|---|---| | Hex | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | | Binary | 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110 | 1111 | |---|---|---|---|---|---|---|---|---| | Hex | 8 | 9 | A | B | C | D | E | F | Group from the right: $01011010_2$ is $0101\;1010$, which is $5A_{16}$, and $5\cdot16+10=90$. A byte is always exactly two hex digits, which is why `FF` is $11111111_2=255$. Hexadecimal is how colors are written on the web: `#FF8800` is red 255, green $\text{88}_{16}=136$ and blue 0, an orange. Octal survives in Unix file permissions, where `755` is $111\;101\;101$, read, write and execute for the owner and read and execute for everyone else. Type a number below in any base and see it in all four. ## How do you add, subtract and multiply in binary? **Binary arithmetic uses the same column methods as decimal, with only four sums to remember: $0+0=0$, $0+1=1$, $1+0=1$ and $1+1=10$, which means write 0 and carry 1.** Adding three 1s in a column gives $11_2$: write 1 and carry 1. **Addition.** Work from the right and carry to the left. For $1011_2+110_2$: Column by column, from the right: $1+0=1$; $1+1=10$, write 0 and carry 1; $0+1+1=10$, write 0 and carry 1; $1+0+1=10$, write 0 and carry 1; the carry becomes the leading 1. The result is $10001_2$, and as a check $11+6=17$. **Subtraction.** When a column cannot take its digit away, borrow 1 from the column on the left, which is worth 2 in the column you are working on. For $1011_2-110_2$ the answer is $101_2$, and $11-6=5$. Computers rarely subtract this way: they add the two's complement, in the section on negative numbers. **Multiplication.** Each bit of the lower number gives either 0 or a copy of the upper number shifted left, and the copies are added. $101_2\times11_2$ is $101+1010=1111_2$, and $5\cdot3=15$. There is no multiplication table to learn, only shifting and adding, which is why hardware multipliers are simple. **Doubling and halving.** Appending a 0 doubles a binary number ($101_2=5$, $1010_2=10$), as appending a 0 multiplies a decimal number by ten. Dropping the last bit halves it and discards the remainder. This is the idea behind the bit shifts below. Try your own sums; the working is shown as a column layout. ## How many values can bits hold, and what is a byte? **$n$ bits can hold $2^n$ different values, the numbers from 0 to $2^n-1$, because each extra bit doubles the number of patterns.** A **byte** is 8 bits and so holds $2^8=256$ values, 0 to 255. Three bits give $2^3=8$ patterns, the eight corners of a cube ([see the cube](https://nunada.my.id/articles/cube/#what-is-a-cube)). | Bits | Values | Range as unsigned | Common name | |---|---|---|---| | 1 | 2 | 0 to 1 | a bit | | 4 | 16 | 0 to 15 | a nibble, one hex digit | | 8 | 256 | 0 to 255 | a byte | | 16 | 65,536 | 0 to 65,535 | a short | | 32 | 4,294,967,296 | 0 to 4,294,967,295 | an int in many languages | | 64 | 18,446,744,073,709,551,616 | 0 to 18,446,744,073,709,551,615 | a long | **Sizes.** A kilobyte (kB) is 1000 bytes in the SI system, but memory comes in powers of 2, so in 1998 the IEC named the binary units: a **kibibyte** (KiB) is $2^{10}=1024$ bytes, a mebibyte (MiB) is $2^{20}=1{,}048{,}576$ bytes and a gibibyte (GiB) is $2^{30}$ bytes. A disc sold as 500 GB (powers of 1000) shows up as about 465 GiB in an operating system that counts in powers of 1024, which is the usual source of "missing" space. **Text.** A character is stored as a number. ASCII, from 1963, assigns the codes 0 to 127 to English letters, digits, punctuation and control codes, and fits in 7 bits. The letter A is 65, which is $01000001_2$, and a is 97, which is $01100001_2$. The two differ in exactly one bit, the one worth 32, so changing the case of an ASCII letter is flipping that bit. Unicode extends the idea to all writing systems, and UTF-8 stores each code point in 1 to 4 bytes. Click the bits of a byte below and watch the number, its two readings and the character change. ## How are negative numbers stored in binary? **Computers store negative integers in two's complement: the leftmost bit counts as $-2^{n-1}$ instead of $+2^{n-1}$, so the same addition circuit works for positive and negative numbers.** To negate a number, invert every bit and add 1. For 8 bits, to get $-5$: start with $5=00000101$, invert to $11111010$, and add 1 to get $11111011$. Read it with the top bit worth $-128$: $-128+64+32+16+8+2+1=-5$. | 8-bit pattern | Unsigned | Signed | |---|---|---| | 00000000 | 0 | 0 | | 00000001 | 1 | 1 | | 01111111 | 127 | 127 | | 10000000 | 128 | −128 | | 11111110 | 254 | −2 | | 11111111 | 255 | −1 | With $n$ bits the signed range is $-2^{n-1}$ to $2^{n-1}-1$, so 8 bits hold −128 to 127 and 32 bits hold −2,147,483,648 to 2,147,483,647. There is one more negative number than positive because 0 uses one of the non-negative patterns. **Why this scheme.** Older ideas, such as a separate sign bit, give two zeros (+0 and −0) and need special rules for adding. In two's complement there is one zero, and subtraction is addition: $5+(-5)=00000101+11111011=100000000$, and the ninth bit is discarded, leaving 0. A hardware adder needs no sign logic. **Overflow.** A result that does not fit wraps around. In 8 bits $127+1=01111111+00000001=10000000$, which reads as −128. Fixed-size integers in C and Java wrap like this (see the [integers in code](https://nunada.my.id/articles/integers/#integers-in-code) section), while Python integers grow as large as memory allows, so Python only shows the wrapping when you mask the bits yourself. Try the ×2, +1 and NOT buttons on the bit editor above to see the wrap. ## What are bitwise operators and shifts? **Bitwise operators work on each bit of a number separately: AND keeps a 1 only where both bits are 1, OR gives 1 where either bit is 1, XOR gives 1 where the bits differ, and NOT flips every bit.** Shifts slide all the bits left or right. | Bits | AND | OR | XOR | |---|---|---|---| | 0, 0 | 0 | 0 | 0 | | 0, 1 | 0 | 1 | 1 | | 1, 0 | 0 | 1 | 1 | | 1, 1 | 1 | 1 | 0 | For example $1100_2$ AND $1010_2$ is $1000_2$, so $12\,\&\,10=8$; OR gives $1110_2=14$ and XOR gives $0110_2=6$. **What they are for.** - **Masks.** `x & 0xFF` keeps the lowest byte, and `x & 1` is 1 exactly when $x$ is odd. - **Flags.** Several yes-or-no settings fit in one number, one bit each: set a flag with OR, clear it with AND and NOT, toggle it with XOR. Unix file permissions are three such flags per group. - **Shifts.** Shifting left by $k$ multiplies by $2^k$ and shifting right by $k$ divides by $2^k$, dropping the remainder, which is the doubling and halving seen earlier. Bits pushed past the end are lost. - **Tricks.** $x\,\&\,(x-1)$ is 0 exactly when $x$ is a power of 2 (or 0), and $x$ XOR $x$ is always 0. Mixing operators with ordinary arithmetic needs care about the order of operations, as with negative numbers in the [integers article](https://nunada.my.id/articles/integers/#order-of-operations): put brackets round bitwise expressions. Try the operators on two bytes below. ## How are fractions written in binary? **After the binary point the places are worth $\frac12,\frac14,\frac18,\ldots$, so a fraction terminates in binary only when its denominator, in lowest terms, is a power of 2.** For example $0.101_2=\frac12+\frac18=\frac58=0.625$. The reason is the rule for decimals applied to base 2. A fraction in lowest terms terminates in base $b$ exactly when every prime factor of its denominator divides $b$: in base 10 the primes 2 and 5, as in the [fractions to decimals](https://nunada.my.id/articles/rational-numbers/#decimals-percent) section, and in base 2 only the prime 2. So: | Fraction | Binary | Terminates? | |---|---|---| | $\frac12$ | $0.1$ | yes | | $\frac38$ | $0.011$ | yes | | $\frac{5}{4}$ | $1.01$ | yes | | $\frac13$ | $0.\overline{01}$ | no: repeats | | $\frac1{10}$ | $0.0\overline{0011}$ | no: repeats | | $\frac15$ | $0.\overline{0011}$ | no: repeats | To find the digits, multiply the fractional part by 2: the whole part is the next bit, and the rest is carried on. $0.1\to0.2\to0.4\to0.8\to1.6$ gives bit 0, 0, 0, 1 and continues with 0.6, 1.2, 0.4, so the block 0011 repeats for ever. **Why this matters for programs.** A floating-point number stores a fixed number of significant bits, 53 in the common 64-bit format (IEEE 754 binary64), as a sign, an exponent and a fraction. So only fractions with a power of 2 as denominator, such as 0.5, 0.25, 0.75 and 0.125, are held exactly. Numbers such as 0.1, 0.2 and 0.3 are cut off in the middle of their repeating block, and the nearest stored value is used instead. That is why `0.1 + 0.2` is `0.30000000000000004`, described in the [real numbers article](https://nunada.my.id/articles/real-numbers/#real-numbers-in-code). The cure is to compare with a tolerance, or to count in whole units such as cents. Type any number below and see its expansion in binary, octal or hexadecimal. ## How do you work with binary numbers in Python and JavaScript? **Both languages write binary literals with `0b`, convert with `bin` and `int(text, 2)` in Python or `toString(2)` and `parseInt(text, 2)` in JavaScript, and share the bitwise operators `&`, `|`, `^`, `~`, `<<` and `>>`.** They differ on integer size: Python integers have no limit, while JavaScript's bitwise operators silently work on 32-bit signed integers. ```python >>> bin(10), bin(255), hex(255), oct(64) ('0b1010', '0b11111111', '0xff', '0o100') >>> int('1011010', 2), int('ff', 16), 0b1011010 (90, 255, 90) >>> f'{90:08b}', f'{255:#x}', format(5, '04b') # padded binary, hex, width ('01011010', '0xff', '0101') >>> (255).bit_length() 8 >>> 0b1100 & 0b1010, 0b1100 | 0b1010, 0b1100 ^ 0b1010 (8, 14, 6) >>> 1 << 4, 100 >> 2 # times 16, divide by 4 (16, 25) >>> ~5 # NOT: -x - 1 -6 >>> bin(-5) # a sign, not two's complement '-0b101' >>> (-5) & 0xFF # the low 8 bits of -5 251 >>> 2 ** 64 # no overflow 18446744073709551616 >>> (0.1).hex() # the stored binary value of 0.1 '0x1.999999999999ap-4' ``` ```javascript (10).toString(2) // '1010' (255).toString(16) // 'ff' parseInt('1011010', 2) // 90 0b1011010 // 90 5 & 3, 5 | 3, 5 ^ 3 // 1, 7, 6 ~5 // -6 1 << 31 // -2147483648: bitwise operators use 32-bit signed integers (1 << 31) >>> 0 // 2147483648: >>> reads the 32 bits as unsigned -5 >>> 0 // 4294967291 (-5 >>> 0).toString(2) // '11111111111111111111111111111011': two's complement in 32 bits 2 ** 32 >> 0 // 0: the high bits are discarded 2n ** 64n // 18446744073709551616n (BigInt has no 32-bit limit) ``` ```cpp #include #include using namespace std; void printBinary(int n, int width) { // the lowest `width` bits, high bit first for (int i = width - 1; i >= 0; i--) cout << ((n >> i) & 1); cout << endl; } int parseBinary(const char* s) { // "1011010" -> 90 int value = 0; for (int i = 0; s[i] != 0; i++) value = value * 2 + (s[i] - '0'); return value; } int main() { printBinary(90, 8); printBinary(255, 8); printf("%x %o\n", 255, 64); // hexadecimal and octal cout << parseBinary("1011010") << endl; cout << (12 & 10) << " " << (12 | 10) << " " << (12 ^ 10) << endl; // AND, OR, XOR cout << (1 << 4) << " " << (100 >> 2) << endl; // times 16, divide by 4 cout << ~5 << endl; // NOT: -x - 1 printBinary(-5, 8); // the low 8 bits of -5 (two's complement) cout << ((-5) & 0xFF) << endl; return 0; } /* output: 01011010 11111111 ff 100 90 8 14 6 16 25 -6 11111011 251 */ ``` The pitfalls, in order of how often they bite: | Pitfall | What happens | What to do | |---|---|---| | `~5` | gives −6, not −5 | NOT is −x − 1; negate with `-x` | | `bin(-5)` or `(-5).toString(2)` | a minus sign and the bits of 5 | mask with `& 0xFF` (Python) or use `>>> 0` (JavaScript) to see two's complement | | Bitwise operators in JavaScript | work on 32 bits: `2 ** 32 >> 0` is 0 | use `BigInt` for larger values | | `1 << 31` in JavaScript | negative | add `>>> 0` when you want unsigned | | Shift count too large | JavaScript uses the count modulo 32: `1 << 32` is 1 | keep the count below the width | | Precedence | `x & 1 == 0` means `x & (1 == 0)` in many languages | add brackets: `(x & 1) == 0` | | Binary fractions | `0.1 + 0.2 != 0.3` | compare with a tolerance | Use `int(text, 2)` or `parseInt(text, 2)` to read binary typed by a person, and format with `f'{n:08b}'` or `n.toString(2).padStart(8, '0')` to line the bits up. ## Where does binary come from? **Binary arithmetic is much older than computers: Indian, Egyptian and European thinkers used it long before electronics made it essential.** - **c. 200 BCE.** Pingala, in a Sanskrit work on poetic meter, described patterns of short and long syllables that amount to binary numbers. - **Egypt.** The Rhind Papyrus multiplies by repeated doubling and adding, which is multiplication by the binary digits of one number. - **1703.** Leibniz published Explication de l'arithmétique binaire. He saw in the hexagrams of the I Ching, which are six-line patterns of broken and unbroken lines, the numbers 0 to 63 in binary. - **1854.** George Boole's Laws of Thought made logic an algebra of true and false, 1 and 0. - **1937.** Claude Shannon showed in his master's thesis that relay switches can carry out Boolean logic, the link between algebra and circuits. In 1948 he made the word bit, suggested by John Tukey, the unit of information. - **1963.** ASCII gave letters and symbols standard 7-bit codes. One theme runs through all of them: two symbols are enough to write any number, and any decision between two options can be recorded as a single bit. ## What are the common mistakes with binary numbers? **The most common mistakes with binary numbers are the nine below, each with the correct statement and a number that shows why.** | Mistake | Correct | |---|---| | ❌ $1+1=2$ in binary | There is no digit 2 in binary: $1+1=10_2$. | | ❌ $10_2$ is ten | $10_2$ is two; ten is $1010_2$. | | ❌ A byte is 4 bits | A byte is 8 bits; 4 bits are a nibble. | | ❌ A byte holds 255 values | It holds 256 values, 0 to 255. | | ❌ `~5` is −5 | $\sim5=-6$: NOT is $-x-1$. | | ❌ Binary cannot show negative numbers | Two's complement does: $11111011_2=-5$ in 8 bits. | | ❌ $11111111_2$ is always 255 | Unsigned it is 255; as signed 8-bit it is −1. | | ❌ 1 KB is always 1024 bytes | kB is 1000 bytes; KiB is 1024 bytes. | | ❌ 0.1 is stored exactly in binary | $0.1=0.0\overline{0011}_2$ repeats, so a float holds only the nearest value. | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: binary numbers at a glance - **Binary:** base 2, digits 0 and 1 (bits), places worth $1,2,4,8,\ldots$; $1011_2=11$. - **Converting:** add the powers of 2 under the 1s; divide by 2 and read the remainders upward; four bits make one hex digit, three one octal digit. - **Arithmetic:** $1+1=10$ with a carry; multiply by shifting and adding; appending 0 doubles. - **Size:** $n$ bits hold $2^n$ values, a byte is 8 bits (256 values); KiB is 1024 bytes, kB is 1000. - **Negatives:** two's complement, the top bit is $-2^{n-1}$; negate by inverting and adding 1; overflow wraps. - **Bitwise:** AND masks, OR sets, XOR flips; $x\ll k$ is $x\cdot2^k$; $x\,\&\,1$ tests odd. - **Fractions:** places $\frac12,\frac14,\ldots$; terminates only for denominators that are powers of 2, so 0.1 repeats and floats approximate it. - **Code:** `bin`, `int(s, 2)`, `toString(2)`; JavaScript bitwise operators are 32-bit; `~x` is `-x - 1`. ## Glossary: key terms - **Bit**: A binary digit, 0 or 1, the smallest unit of information; the word is short for binary digit. - **Byte**: A group of 8 bits, which can hold 256 different values, 0 to 255 when read as unsigned. - **Binary number**: A number written in base 2 with only the digits 0 and 1, each place worth a power of 2. - **Place value**: The principle that a digit is worth its face value times the power of the base for the place it stands in. - **Hexadecimal**: Base 16, with digits 0 to 9 and A to F; one hex digit is exactly four bits, so a byte is two hex digits. - **Octal**: Base 8, with digits 0 to 7; one octal digit is exactly three bits. - **Nibble**: A group of four bits, which is one hexadecimal digit. - **Most significant bit**: The leftmost bit of a binary number, the one in the highest place; in two’s complement it is the sign bit. - **Two’s complement**: The usual way to store negative integers, where the leftmost bit is worth minus 2 to the power n minus 1 and a number is negated by inverting its bits and adding 1. - **Overflow**: The wrapping around that happens when a result does not fit in the fixed number of bits, as 127 plus 1 becomes minus 128 in 8 bits. - **Bitwise operator**: An operator such as AND, OR, XOR or NOT that works on each bit of its operands separately. - **Bit shift**: An operation that slides all the bits left or right; shifting left by k multiplies by 2 to the power k. - **Bit mask**: A number whose 1 bits select which bits of another number to keep, change or test, used with AND, OR and XOR. - **Kibibyte**: The binary unit equal to 1024 bytes, written KiB, to tell it from the kilobyte of 1000 bytes. - **ASCII**: A 1963 standard that gives English letters, digits, punctuation and control characters the codes 0 to 127. - **Floating-point number**: A number stored as a sign, an exponent and a fixed number of significant bits, so most fractions are held only approximately. ## Frequently asked questions ### What is a binary number? A binary number is a number written in base 2, using only the digits 0 and 1. Each place is worth twice the place to its right, so 1011 in binary is 8 plus 2 plus 1, which is 11. Each digit is called a bit. ### Why do computers use binary? Electronic parts such as transistors have two reliable states, on and off, and two states are easy to tell apart even with noise. Machines can therefore copy and process binary signals without errors. Every number, letter and image is first turned into bits. ### How do you convert binary to decimal? Write the place values 1, 2, 4, 8 and so on from the right, and add the ones that sit under a 1. For 1011010 these are 64, 16, 8 and 2, which add up to 90. Each place is a power of 2. ### How do you convert decimal to binary? Divide the number by 2 repeatedly, writing down each remainder, until the quotient is 0. Then read the remainders from the last to the first. For 45 the remainders read upward are 101101, and 32 plus 8 plus 4 plus 1 is 45. ### What is hexadecimal and why is it used? Hexadecimal is base 16, with digits 0 to 9 and A to F. One hex digit is exactly four bits, so a byte is two hex digits and long binary strings become short. Web colors such as FF8800 and memory addresses are written in hexadecimal. ### What is the difference between a bit and a byte? A bit is a single binary digit, 0 or 1. A byte is a group of 8 bits, which can hold 256 different values from 0 to 255. Four bits are called a nibble, and one hexadecimal digit is a nibble. ### How many values can n bits store? Exactly 2 to the power n, because each extra bit doubles the number of patterns. As unsigned numbers they run from 0 to 2 to the power n minus 1. So 8 bits store 256 values, 16 bits store 65,536 and 32 bits store about 4.3 billion. ### How are negative numbers stored in binary? Almost all computers use two’s complement. The leftmost bit is worth minus 2 to the power n minus 1, so in 8 bits 10000000 is minus 128 and 11111111 is minus 1. To negate a number, invert every bit and add 1, which makes subtraction an ordinary addition. ### What is integer overflow? It is what happens when a result does not fit in the fixed number of bits. The value wraps around: in 8-bit signed arithmetic 127 plus 1 gives minus 128. In C and Java this is a real hazard, while Python integers grow as large as memory allows. ### What is 1 plus 1 in binary? It is 10 in binary, which is read one-zero and means two. There is no digit 2 in base 2, so the sum is written as 0 with a carry of 1 into the next place, just as 5 plus 5 is written as 0 with a carry in decimal. ### What do AND, OR and XOR do to bits? They combine two numbers bit by bit. AND gives 1 only where both bits are 1, OR gives 1 where at least one is 1, and XOR gives 1 where the bits differ. NOT flips every bit. They are used for masks, flags and quick tests such as whether a number is odd. ### What does shifting bits do? Shifting left by k places multiplies a number by 2 to the power k, and shifting right by k places divides by 2 to the power k and drops the remainder. It works like adding or removing zeros in decimal. Bits pushed past the end of the number are lost. ### Why is 0.1 not stored exactly in binary? A fraction terminates in binary only if its denominator is a power of 2. One tenth has the factor 5, so its binary expansion 0.000110011 and so on repeats for ever. A float keeps only 53 significant bits, so it stores the nearest value, and 0.1 plus 0.2 is slightly more than 0.3. ### How do you work with binary in Python? Write literals with the prefix 0b, convert a number with bin, hex and format, and read text with int and a base such as 2. The operators are the ampersand, the bar, the caret, the tilde and the two shifts. Python integers have no fixed size, so the tilde of 5 is minus 6. --- # Bilangan Biner: Konversi, Operasi, Bit, dan Komplemen Dua Source: https://nunada.my.id/artikel/bilangan-biner/ Updated: 2026-10-31 ## Jawaban singkat **Bilangan biner adalah bilangan yang ditulis dalam basis 2, hanya dengan angka 0 dan 1, tempat tiap angka bernilai dua kali tempat di kanannya: $1011_2=8+2+1=11$.** Komputer memakainya karena sebuah saklar punya dua keadaan, dan setiap bilangan, huruf, dan gambar disimpan sebagai untaian bit ini. Untuk mengubah, jumlahkan pangkat 2 di bawah angka 1, atau bagi 2 berulang kali lalu baca sisanya dari bawah ke atas. ### Poin penting - Biner adalah nilai tempat dalam basis 2: tempatnya bernilai $1,2,4,8,16,\ldots$, dan satu angka adalah satu bit, 0 atau 1. - $n$ bit memuat $2^n$ nilai, dari 0 sampai $2^n-1$; satu byte adalah 8 bit dan memuat 256 nilai. - Heksadesimal adalah singkatan biner: satu angka heksadesimal tepat empat bit, sehingga `FF` adalah $11111111_2=255$. - Dalam biner $1+1=10$: jumlahkan kolom demi kolom dengan membawa 1; mengalikan adalah menggeser dan menjumlahkan, dan menggandakan adalah menambah angka 0 di ujung. - Bilangan bulat negatif memakai komplemen dua: balik bit-bitnya dan tambah 1, sehingga $-5$ adalah $11111011$ dalam 8 bit dan bit paling kiri bernilai $-2^{n-1}$. - Pecahan berakhir dalam biner hanya bila penyebutnya pangkat 2, sehingga $0{,}1$ berulang ($0{,}0\overline{0011}_2$) dan float hanya dapat menyimpannya secara hampiran. ## Apa itu bilangan biner? **Bilangan biner ditulis dalam basis 2: ia hanya memakai dua angka 0 dan 1, yang disebut bit (dari binary digit), dan tiap tempat bernilai dua kali tempat di kanannya.** Bilangan desimal biasa bekerja dengan cara yang sama dengan sepuluh angka dan tempat bernilai 1, 10, 100, 1000. Pada keduanya, nilai sebuah angka bergantung pada tempatnya, yaitu gagasan [nilai tempat](https://nunada.my.id/artikel/bilangan-bahasa-china/#counting-rods) yang ada di setiap sistem posisi. Nilai tempat dalam biner adalah pangkat 2, dihitung dari kanan mulai $2^0$ (lihat [eksponen](https://nunada.my.id/artikel/eksponen-dan-akar/#what-is-an-exponent)): | Tempat | $2^7$ | $2^6$ | $2^5$ | $2^4$ | $2^3$ | $2^2$ | $2^1$ | $2^0$ | |---|---|---|---|---|---|---|---|---| | Nilai | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | | Bit | 0 | 1 | 0 | 1 | 1 | 0 | 1 | 0 | Bilangan pada tabel itu adalah $01011010_2=64+16+8+2=90$. Angka subskrip 2 menyatakan basisnya, sebab $10_2$ adalah dua tetapi $10$ adalah sepuluh. Menghitung dalam biner sama dengan menghitung dalam desimal dengan hanya dua angka. Ketika angka terakhir mencapai 1, hitungan berikutnya membawa ke tempat selanjutnya, seperti 9 menjadi 10 dalam desimal: | Desimal | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | |---|---|---|---|---|---|---|---|---| | Biner | 0 | 1 | 10 | 11 | 100 | 101 | 110 | 111 | | Desimal | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | |---|---|---|---|---|---|---|---|---| | Biner | 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110 | 1111 | **Mengapa komputer memakai biner.** Transistor menghantar atau tidak, bintik magnetik menghadap ke satu arah atau yang lain, lubang pada cakram ada atau tidak. Dua keadaan mudah dibedakan bahkan ketika sinyalnya berderau, sehingga mesin dapat menyalin dan mengolahnya tanpa galat; sepuluh tingkat tegangan jauh lebih sulit. Segala yang lain, bilangan, teks, gambar, dan suara, lebih dulu diubah menjadi bilangan lalu menjadi bit. Bit terakhir juga memberi tahu hal sederhana: bilangan biner genap bila berakhir 0, seperti pada [bilangan genap dan ganjil](https://nunada.my.id/artikel/bilangan-bulat/#divisibility) di artikel bilangan bulat. ## Bagaimana mengubah antara biner, desimal, dan heksadesimal? **Untuk mengubah biner menjadi desimal, jumlahkan nilai tempat angka 1; untuk mengubah desimal menjadi biner, bagi 2 berulang kali dan baca sisanya dari bawah ke atas.** Keduanya hanya memakai pangkat 2. **Biner ke desimal.** $1011010_2$ punya angka 1 di tempat bernilai 64, 16, 8, dan 2, sehingga ia $64+16+8+2=90$. **Desimal ke biner.** Bagi 2, tulis sisanya, dan lanjutkan dengan hasil baginya sampai mencapai 0. Untuk 90: | Pembagian | Hasil bagi | Sisa | |---|---|---| | $90\div2$ | 45 | 0 | | $45\div2$ | 22 | 1 | | $22\div2$ | 11 | 0 | | $11\div2$ | 5 | 1 | | $5\div2$ | 2 | 1 | | $2\div2$ | 1 | 0 | | $1\div2$ | 0 | 1 | Baca sisanya ke atas: $1011010_2$. Ini pembagian bersisa yang sama dengan pada [artikel bilangan bulat](https://nunada.my.id/artikel/bilangan-bulat/#remainders), dan sisa terakhir adalah angka paling kiri karena ia tempat tertinggi. **Oktal dan heksadesimal.** Untai biner panjang, sehingga pemrogram mengelompokkan bit. Tiga bit membentuk satu angka **oktal** (basis 8, angka 0 sampai 7) dan empat bit membentuk satu angka **heksadesimal** (basis 16, angka 0 sampai 9 lalu A sampai F untuk 10 sampai 15): | Biner | 0000 | 0001 | 0010 | 0011 | 0100 | 0101 | 0110 | 0111 | |---|---|---|---|---|---|---|---|---| | Heks | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | | Biner | 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110 | 1111 | |---|---|---|---|---|---|---|---|---| | Heks | 8 | 9 | A | B | C | D | E | F | Kelompokkan dari kanan: $01011010_2$ adalah $0101\;1010$, yaitu $5A_{16}$, dan $5\cdot16+10=90$. Satu byte selalu tepat dua angka heksadesimal, itulah sebabnya `FF` adalah $11111111_2=255$. Heksadesimal adalah cara menulis warna di web: `#FF8800` adalah merah 255, hijau $\text{88}_{16}=136$, dan biru 0, sebuah oranye. Oktal masih bertahan pada izin berkas Unix, tempat `755` adalah $111\;101\;101$, baca, tulis, dan eksekusi untuk pemilik serta baca dan eksekusi untuk semua yang lain. Ketik bilangan di bawah dalam basis apa pun dan lihat dalam keempatnya. ## Bagaimana menjumlah, mengurang, dan mengalikan dalam biner? **Aritmetika biner memakai metode kolom yang sama dengan desimal, dengan hanya empat jumlah yang perlu diingat: $0+0=0$, $0+1=1$, $1+0=1$, dan $1+1=10$, yang berarti tulis 0 dan bawa 1.** Menjumlahkan tiga angka 1 dalam satu kolom menghasilkan $11_2$: tulis 1 dan bawa 1. **Penjumlahan.** Kerjakan dari kanan dan bawa ke kiri. Untuk $1011_2+110_2$: Kolom demi kolom, dari kanan: $1+0=1$; $1+1=10$, tulis 0 dan bawa 1; $0+1+1=10$, tulis 0 dan bawa 1; $1+0+1=10$, tulis 0 dan bawa 1; bawaan menjadi angka 1 di depan. Hasilnya $10001_2$, dan sebagai pemeriksaan $11+6=17$. **Pengurangan.** Bila sebuah kolom tidak dapat dikurangi angkanya, pinjam 1 dari kolom di kiri, yang bernilai 2 pada kolom yang sedang kamu kerjakan. Untuk $1011_2-110_2$ jawabannya $101_2$, dan $11-6=5$. Komputer jarang mengurangi dengan cara ini: ia menjumlahkan komplemen dua, pada bagian bilangan negatif. **Perkalian.** Setiap bit pada bilangan bawah memberi 0 atau salinan bilangan atas yang digeser ke kiri, dan salinannya dijumlahkan. $101_2\times11_2$ adalah $101+1010=1111_2$, dan $5\cdot3=15$. Tidak ada tabel perkalian yang perlu dipelajari, hanya menggeser dan menjumlahkan, itulah sebabnya pengali perangkat keras sederhana. **Menggandakan dan membagi dua.** Menambah angka 0 di ujung menggandakan bilangan biner ($101_2=5$, $1010_2=10$), seperti menambah 0 mengalikan bilangan desimal dengan sepuluh. Membuang bit terakhir membaginya dua dan membuang sisanya. Inilah gagasan di balik geseran bit di bawah. Coba penjumlahan buatanmu sendiri; langkahnya ditampilkan sebagai susunan kolom. ## Berapa nilai yang dapat dimuat bit, dan apa itu byte? **$n$ bit dapat memuat $2^n$ nilai berbeda, yaitu bilangan dari 0 sampai $2^n-1$, karena tiap bit tambahan menggandakan banyak pola.** Satu **byte** adalah 8 bit sehingga memuat $2^8=256$ nilai, 0 sampai 255. Tiga bit memberi $2^3=8$ pola, delapan titik sudut sebuah kubus ([lihat kubus](https://nunada.my.id/artikel/kubus/#what-is-a-cube)). | Bit | Nilai | Rentang tanpa tanda | Nama umum | |---|---|---|---| | 1 | 2 | 0 sampai 1 | sebuah bit | | 4 | 16 | 0 sampai 15 | sebuah nibble, satu angka heksadesimal | | 8 | 256 | 0 sampai 255 | sebuah byte | | 16 | 65.536 | 0 sampai 65.535 | sebuah short | | 32 | 4.294.967.296 | 0 sampai 4.294.967.295 | int di banyak bahasa | | 64 | 18.446.744.073.709.551.616 | 0 sampai 18.446.744.073.709.551.615 | sebuah long | **Ukuran.** Satu kilobita (kB) adalah 1000 byte dalam sistem SI, tetapi memori berukuran pangkat 2, sehingga pada 1998 IEC menamai satuan biner: satu **kibibyte** (KiB) adalah $2^{10}=1024$ byte, satu mebibyte (MiB) adalah $2^{20}=1.048.576$ byte, dan satu gibibyte (GiB) adalah $2^{30}$ byte. Cakram yang dijual 500 GB (pangkat 1000) tampak sekitar 465 GiB pada sistem operasi yang menghitung dengan pangkat 1024, yang menjadi sumber umum ruang yang "hilang". **Teks.** Sebuah karakter disimpan sebagai bilangan. ASCII, dari 1963, memberi kode 0 sampai 127 untuk huruf Inggris, angka, tanda baca, dan kode kendali, dan muat dalam 7 bit. Huruf A adalah 65, yaitu $01000001_2$, dan a adalah 97, yaitu $01100001_2$. Keduanya berbeda tepat satu bit, yang bernilai 32, sehingga mengubah huruf besar-kecil huruf ASCII berarti membalik bit itu. Unicode memperluas gagasan ini ke semua sistem tulisan, dan UTF-8 menyimpan setiap titik kode dalam 1 sampai 4 byte. Klik bit-bit sebuah byte di bawah dan perhatikan bilangan, dua cara membacanya, dan karakternya berubah. ## Bagaimana bilangan negatif disimpan dalam biner? **Komputer menyimpan bilangan bulat negatif dalam komplemen dua: bit paling kiri bernilai $-2^{n-1}$ dan bukan $+2^{n-1}$, sehingga rangkaian penjumlah yang sama bekerja untuk bilangan positif dan negatif.** Untuk menegasikan sebuah bilangan, balik setiap bit lalu tambah 1. Untuk 8 bit, mendapatkan $-5$: mulai dari $5=00000101$, balik menjadi $11111010$, lalu tambah 1 menjadi $11111011$. Bacalah dengan bit teratas bernilai $-128$: $-128+64+32+16+8+2+1=-5$. | Pola 8 bit | Tanpa tanda | Bertanda | |---|---|---| | 00000000 | 0 | 0 | | 00000001 | 1 | 1 | | 01111111 | 127 | 127 | | 10000000 | 128 | −128 | | 11111110 | 254 | −2 | | 11111111 | 255 | −1 | Dengan $n$ bit rentang bertanda adalah $-2^{n-1}$ sampai $2^{n-1}-1$, sehingga 8 bit memuat −128 sampai 127 dan 32 bit memuat −2.147.483.648 sampai 2.147.483.647. Ada satu bilangan negatif lebih banyak daripada positif karena 0 memakai salah satu pola tidak negatif. **Mengapa skema ini.** Gagasan yang lebih tua, seperti bit tanda tersendiri, memberi dua nol (+0 dan −0) dan memerlukan aturan khusus untuk penjumlahan. Dalam komplemen dua hanya ada satu nol, dan pengurangan adalah penjumlahan: $5+(-5)=00000101+11111011=100000000$, dan bit kesembilan dibuang, menyisakan 0. Penjumlah perangkat keras tidak memerlukan logika tanda. **Overflow.** Hasil yang tidak muat berputar kembali. Dalam 8 bit $127+1=01111111+00000001=10000000$, yang terbaca −128. Bilangan bulat berukuran tetap di C dan Java berputar seperti ini (lihat bagian [bilangan bulat dalam kode](https://nunada.my.id/artikel/bilangan-bulat/#integers-in-code)), sedangkan bilangan bulat Python membesar selama memori cukup, sehingga Python hanya memperlihatkan perputaran bila kamu menutup bitnya sendiri. Coba tombol ×2, +1, dan NOT pada penyunting bit di atas untuk melihat perputarannya. ## Apa itu operator bitwise dan geseran? **Operator bitwise bekerja pada setiap bit sebuah bilangan secara terpisah: AND mempertahankan 1 hanya di tempat kedua bit 1, OR memberi 1 di tempat salah satu bit 1, XOR memberi 1 di tempat bitnya berbeda, dan NOT membalik setiap bit.** Geseran menggeser semua bit ke kiri atau kanan. | Bit | AND | OR | XOR | |---|---|---|---| | 0, 0 | 0 | 0 | 0 | | 0, 1 | 0 | 1 | 1 | | 1, 0 | 0 | 1 | 1 | | 1, 1 | 1 | 1 | 0 | Misalnya $1100_2$ AND $1010_2$ adalah $1000_2$, sehingga $12\,\&\,10=8$; OR memberi $1110_2=14$ dan XOR memberi $0110_2=6$. **Kegunaannya.** - **Topeng (mask).** `x & 0xFF` mempertahankan byte terendah, dan `x & 1` bernilai 1 tepat bila $x$ ganjil. - **Bendera (flag).** Beberapa pengaturan ya-atau-tidak muat dalam satu bilangan, satu bit masing-masing: nyalakan bendera dengan OR, matikan dengan AND dan NOT, balik dengan XOR. Izin berkas Unix adalah tiga bendera seperti itu per kelompok. - **Geseran.** Menggeser ke kiri sebanyak $k$ mengalikan dengan $2^k$ dan menggeser ke kanan sebanyak $k$ membagi dengan $2^k$, membuang sisanya, yaitu penggandaan dan pembagian dua yang terlihat tadi. Bit yang melewati ujung hilang. - **Trik.** $x\,\&\,(x-1)$ bernilai 0 tepat bila $x$ pangkat 2 (atau 0), dan $x$ XOR $x$ selalu 0. Mencampur operator dengan aritmetika biasa memerlukan kehati-hatian soal urutan operasi, seperti pada bilangan negatif di [artikel bilangan bulat](https://nunada.my.id/artikel/bilangan-bulat/#order-of-operations): beri kurung pada ekspresi bitwise. Coba operatornya pada dua byte di bawah. ## Bagaimana pecahan ditulis dalam biner? **Setelah koma biner, tempatnya bernilai $\frac12,\frac14,\frac18,\ldots$, sehingga pecahan berakhir dalam biner hanya bila penyebutnya, dalam bentuk paling sederhana, adalah pangkat 2.** Misalnya $0{,}101_2=\frac12+\frac18=\frac58=0{,}625$. Alasannya adalah aturan desimal yang diterapkan pada basis 2. Pecahan paling sederhana berakhir dalam basis $b$ tepat bila setiap faktor prima penyebutnya membagi $b$: pada basis 10 bilangan prima 2 dan 5, seperti pada bagian [pecahan ke desimal](https://nunada.my.id/artikel/bilangan-rasional/#decimals-percent), dan pada basis 2 hanya bilangan prima 2. Jadi: | Pecahan | Biner | Berakhir? | |---|---|---| | $\frac12$ | $0{,}1$ | ya | | $\frac38$ | $0{,}011$ | ya | | $\frac{5}{4}$ | $1{,}01$ | ya | | $\frac13$ | $0{,}\overline{01}$ | tidak: berulang | | $\frac1{10}$ | $0{,}0\overline{0011}$ | tidak: berulang | | $\frac15$ | $0{,}\overline{0011}$ | tidak: berulang | Untuk mencari angkanya, kalikan bagian pecahan dengan 2: bagian bulatnya adalah bit berikutnya, dan sisanya dilanjutkan. $0{,}1\to0{,}2\to0{,}4\to0{,}8\to1{,}6$ memberi bit 0, 0, 0, 1 dan berlanjut dengan 0,6, 1,2, 0,4, sehingga blok 0011 berulang selamanya. **Mengapa ini penting bagi program.** Bilangan floating point menyimpan sejumlah tetap bit signifikan, 53 pada format 64 bit yang umum (IEEE 754 binary64), sebagai tanda, eksponen, dan bagian pecahan. Jadi hanya pecahan berpenyebut pangkat 2, seperti 0,5, 0,25, 0,75, dan 0,125, yang disimpan dengan tepat. Bilangan seperti 0,1, 0,2, dan 0,3 terpotong di tengah blok yang berulang, dan nilai tersimpan terdekat dipakai sebagai gantinya. Itulah sebabnya `0.1 + 0.2` adalah `0.30000000000000004`, seperti dijelaskan di [artikel bilangan real](https://nunada.my.id/artikel/bilangan-real/#real-numbers-in-code). Obatnya adalah membandingkan dengan toleransi, atau menghitung dalam satuan utuh seperti sen. Ketik bilangan apa pun di bawah dan lihat ekspansinya dalam biner, oktal, atau heksadesimal. ## Bagaimana mengolah bilangan biner di Python dan JavaScript? **Kedua bahasa menulis literal biner dengan `0b`, mengubah dengan `bin` dan `int(teks, 2)` di Python atau `toString(2)` dan `parseInt(teks, 2)` di JavaScript, dan memakai operator bitwise yang sama `&`, `|`, `^`, `~`, `<<`, dan `>>`.** Keduanya berbeda soal ukuran bilangan bulat: bilangan bulat Python tidak terbatas, sedangkan operator bitwise JavaScript diam-diam bekerja pada bilangan bulat bertanda 32 bit. ```python >>> bin(10), bin(255), hex(255), oct(64) ('0b1010', '0b11111111', '0xff', '0o100') >>> int('1011010', 2), int('ff', 16), 0b1011010 (90, 255, 90) >>> f'{90:08b}', f'{255:#x}', format(5, '04b') # padded binary, hex, width ('01011010', '0xff', '0101') >>> (255).bit_length() 8 >>> 0b1100 & 0b1010, 0b1100 | 0b1010, 0b1100 ^ 0b1010 (8, 14, 6) >>> 1 << 4, 100 >> 2 # times 16, divide by 4 (16, 25) >>> ~5 # NOT: -x - 1 -6 >>> bin(-5) # a sign, not two's complement '-0b101' >>> (-5) & 0xFF # the low 8 bits of -5 251 >>> 2 ** 64 # no overflow 18446744073709551616 >>> (0.1).hex() # the stored binary value of 0.1 '0x1.999999999999ap-4' ``` ```javascript (10).toString(2) // '1010' (255).toString(16) // 'ff' parseInt('1011010', 2) // 90 0b1011010 // 90 5 & 3, 5 | 3, 5 ^ 3 // 1, 7, 6 ~5 // -6 1 << 31 // -2147483648: bitwise operators use 32-bit signed integers (1 << 31) >>> 0 // 2147483648: >>> reads the 32 bits as unsigned -5 >>> 0 // 4294967291 (-5 >>> 0).toString(2) // '11111111111111111111111111111011': two's complement in 32 bits 2 ** 32 >> 0 // 0: the high bits are discarded 2n ** 64n // 18446744073709551616n (BigInt has no 32-bit limit) ``` ```cpp #include #include using namespace std; void printBinary(int n, int width) { // the lowest `width` bits, high bit first for (int i = width - 1; i >= 0; i--) cout << ((n >> i) & 1); cout << endl; } int parseBinary(const char* s) { // "1011010" -> 90 int value = 0; for (int i = 0; s[i] != 0; i++) value = value * 2 + (s[i] - '0'); return value; } int main() { printBinary(90, 8); printBinary(255, 8); printf("%x %o\n", 255, 64); // hexadecimal and octal cout << parseBinary("1011010") << endl; cout << (12 & 10) << " " << (12 | 10) << " " << (12 ^ 10) << endl; // AND, OR, XOR cout << (1 << 4) << " " << (100 >> 2) << endl; // times 16, divide by 4 cout << ~5 << endl; // NOT: -x - 1 printBinary(-5, 8); // the low 8 bits of -5 (two's complement) cout << ((-5) & 0xFF) << endl; return 0; } /* output: 01011010 11111111 ff 100 90 8 14 6 16 25 -6 11111011 251 */ ``` Jebakannya, berurutan dari yang paling sering menggigit: | Jebakan | Yang terjadi | Yang sebaiknya dilakukan | |---|---|---| | `~5` | memberi −6, bukan −5 | NOT adalah −x − 1; negasikan dengan `-x` | | `bin(-5)` atau `(-5).toString(2)` | tanda minus dan bit-bit 5 | tutup dengan `& 0xFF` (Python) atau pakai `>>> 0` (JavaScript) untuk melihat komplemen dua | | Operator bitwise di JavaScript | bekerja pada 32 bit: `2 ** 32 >> 0` adalah 0 | pakai `BigInt` untuk nilai lebih besar | | `1 << 31` di JavaScript | negatif | tambah `>>> 0` bila ingin tanpa tanda | | Banyak geseran terlalu besar | JavaScript memakai banyaknya modulo 32: `1 << 32` adalah 1 | jaga banyaknya di bawah lebar bit | | Prioritas | `x & 1 == 0` berarti `x & (1 == 0)` di banyak bahasa | beri kurung: `(x & 1) == 0` | | Pecahan biner | `0.1 + 0.2 != 0.3` | bandingkan dengan toleransi | Pakai `int(teks, 2)` atau `parseInt(teks, 2)` untuk membaca biner yang diketik orang, dan format dengan `f'{n:08b}'` atau `n.toString(2).padStart(8, '0')` untuk merapikan bit-bitnya. ## Dari mana asal biner? **Aritmetika biner jauh lebih tua daripada komputer: pemikir India, Mesir, dan Eropa memakainya jauh sebelum elektronik menjadikannya penting.** - **Sekitar 200 SM.** Pingala, dalam karya Sanskerta tentang matra puisi, menjelaskan pola suku kata pendek dan panjang yang setara dengan bilangan biner. - **Mesir.** Papirus Rhind mengalikan dengan penggandaan dan penjumlahan berulang, yaitu perkalian dengan angka biner dari salah satu bilangan. - **1703.** Leibniz menerbitkan Explication de l'arithmétique binaire. Ia melihat pada heksagram I Ching, yaitu pola enam garis putus dan tak putus, bilangan 0 sampai 63 dalam biner. - **1854.** Laws of Thought karya George Boole menjadikan logika aljabar benar dan salah, 1 dan 0. - **1937.** Claude Shannon menunjukkan dalam tesis masternya bahwa saklar relai dapat melakukan logika Boole, penghubung antara aljabar dan rangkaian. Pada 1948 ia menjadikan kata bit, yang disarankan John Tukey, sebagai satuan informasi. - **1963.** ASCII memberi huruf dan simbol kode standar 7 bit. Satu benang merah mengalir melalui semuanya: dua simbol cukup untuk menulis bilangan apa pun, dan setiap keputusan antara dua pilihan dapat dicatat sebagai satu bit. ## Apa kesalahan umum pada bilangan biner? **Kesalahan paling umum pada bilangan biner adalah sembilan hal berikut, masing-masing dengan pernyataan yang benar dan bilangan yang menunjukkan alasannya.** | Kesalahan | Yang benar | |---|---| | ❌ $1+1=2$ dalam biner | Tidak ada angka 2 dalam biner: $1+1=10_2$. | | ❌ $10_2$ adalah sepuluh | $10_2$ adalah dua; sepuluh adalah $1010_2$. | | ❌ Satu byte adalah 4 bit | Satu byte adalah 8 bit; 4 bit adalah satu nibble. | | ❌ Satu byte memuat 255 nilai | Ia memuat 256 nilai, 0 sampai 255. | | ❌ `~5` adalah −5 | $\sim5=-6$: NOT adalah $-x-1$. | | ❌ Biner tidak dapat menunjukkan bilangan negatif | Komplemen dua dapat: $11111011_2=-5$ dalam 8 bit. | | ❌ $11111111_2$ selalu 255 | Tanpa tanda ia 255; sebagai 8 bit bertanda ia −1. | | ❌ 1 KB selalu 1024 byte | kB adalah 1000 byte; KiB adalah 1024 byte. | | ❌ 0,1 disimpan dengan tepat dalam biner | $0{,}1=0{,}0\overline{0011}_2$ berulang, sehingga float hanya menyimpan nilai terdekat. | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: bilangan biner sekilas - **Biner:** basis 2, angka 0 dan 1 (bit), tempat bernilai $1,2,4,8,\ldots$; $1011_2=11$. - **Mengubah:** jumlahkan pangkat 2 di bawah angka 1; bagi 2 dan baca sisanya ke atas; empat bit membentuk satu angka heksadesimal, tiga bit satu angka oktal. - **Aritmetika:** $1+1=10$ dengan bawaan; kalikan dengan menggeser dan menjumlahkan; menambah 0 menggandakan. - **Ukuran:** $n$ bit memuat $2^n$ nilai, satu byte 8 bit (256 nilai); KiB adalah 1024 byte, kB adalah 1000. - **Negatif:** komplemen dua, bit teratas bernilai $-2^{n-1}$; negasikan dengan membalik dan menambah 1; overflow berputar. - **Bitwise:** AND menutup, OR menyalakan, XOR membalik; $x\ll k$ adalah $x\cdot2^k$; $x\,\&\,1$ menguji ganjil. - **Pecahan:** tempat $\frac12,\frac14,\ldots$; berakhir hanya untuk penyebut pangkat 2, sehingga 0,1 berulang dan float menghampirinya. - **Kode:** `bin`, `int(s, 2)`, `toString(2)`; operator bitwise JavaScript 32 bit; `~x` adalah `-x - 1`. ## Glosarium: istilah penting - **Bit**: Angka biner, 0 atau 1, satuan informasi terkecil; kata itu singkatan dari binary digit. - **Byte**: Sekelompok 8 bit, yang dapat memuat 256 nilai berbeda, 0 sampai 255 bila dibaca tanpa tanda. - **Bilangan biner**: Bilangan yang ditulis dalam basis 2 dengan hanya angka 0 dan 1, tiap tempat bernilai pangkat 2. - **Nilai tempat**: Prinsip bahwa sebuah angka bernilai nilai tampaknya dikali pangkat basis untuk tempat ia berada. - **Heksadesimal**: Basis 16, dengan angka 0 sampai 9 dan A sampai F; satu angka heksadesimal tepat empat bit, sehingga satu byte adalah dua angka heksadesimal. - **Oktal**: Basis 8, dengan angka 0 sampai 7; satu angka oktal tepat tiga bit. - **Nibble**: Sekelompok empat bit, yaitu satu angka heksadesimal. - **Bit paling bermakna**: Bit paling kiri sebuah bilangan biner, yang ada di tempat tertinggi; dalam komplemen dua ia adalah bit tanda. - **Komplemen dua**: Cara umum menyimpan bilangan bulat negatif, tempat bit paling kiri bernilai minus 2 pangkat n dikurangi 1 dan sebuah bilangan dinegasikan dengan membalik bitnya dan menambah 1. - **Overflow**: Perputaran yang terjadi ketika hasil tidak muat dalam banyak bit yang tetap, seperti 127 ditambah 1 menjadi minus 128 dalam 8 bit. - **Operator bitwise**: Operator seperti AND, OR, XOR, atau NOT yang bekerja pada setiap bit operannya secara terpisah. - **Geseran bit**: Operasi yang menggeser semua bit ke kiri atau kanan; menggeser ke kiri sebanyak k mengalikan dengan 2 pangkat k. - **Topeng bit**: Bilangan yang bit 1-nya memilih bit mana dari bilangan lain yang dipertahankan, diubah, atau diuji, dipakai dengan AND, OR, dan XOR. - **Kibibyte**: Satuan biner yang sama dengan 1024 byte, ditulis KiB, untuk membedakannya dari kilobita sebesar 1000 byte. - **ASCII**: Standar 1963 yang memberi huruf Inggris, angka, tanda baca, dan karakter kendali kode 0 sampai 127. - **Bilangan floating point**: Bilangan yang disimpan sebagai tanda, eksponen, dan sejumlah tetap bit signifikan, sehingga sebagian besar pecahan hanya disimpan secara hampiran. ## Pertanyaan yang sering diajukan ### Apa itu bilangan biner? Bilangan biner adalah bilangan yang ditulis dalam basis 2, hanya memakai angka 0 dan 1. Tiap tempat bernilai dua kali tempat di kanannya, sehingga 1011 dalam biner adalah 8 ditambah 2 ditambah 1, yaitu 11. Tiap angka disebut bit. ### Mengapa komputer memakai biner? Komponen elektronik seperti transistor punya dua keadaan yang andal, menyala dan mati, dan dua keadaan mudah dibedakan bahkan dengan derau. Mesin karena itu dapat menyalin dan mengolah sinyal biner tanpa galat. Setiap bilangan, huruf, dan gambar lebih dulu diubah menjadi bit. ### Bagaimana mengubah biner ke desimal? Tulis nilai tempat 1, 2, 4, 8 dan seterusnya dari kanan, lalu jumlahkan yang berada di bawah angka 1. Untuk 1011010 itu adalah 64, 16, 8, dan 2, yang berjumlah 90. Setiap tempat adalah pangkat 2. ### Bagaimana mengubah desimal ke biner? Bagi bilangan itu dengan 2 berulang kali, menulis tiap sisa, sampai hasil baginya 0. Lalu baca sisanya dari yang terakhir ke yang pertama. Untuk 45 sisa yang dibaca ke atas adalah 101101, dan 32 ditambah 8 ditambah 4 ditambah 1 adalah 45. ### Apa itu heksadesimal dan mengapa dipakai? Heksadesimal adalah basis 16, dengan angka 0 sampai 9 dan A sampai F. Satu angka heksadesimal tepat empat bit, sehingga satu byte adalah dua angka heksadesimal dan untai biner yang panjang menjadi pendek. Warna web seperti FF8800 dan alamat memori ditulis dalam heksadesimal. ### Apa beda bit dan byte? Bit adalah satu angka biner, 0 atau 1. Byte adalah sekelompok 8 bit, yang dapat memuat 256 nilai berbeda dari 0 sampai 255. Empat bit disebut nibble, dan satu angka heksadesimal adalah satu nibble. ### Berapa nilai yang dapat disimpan n bit? Tepat 2 pangkat n, karena tiap bit tambahan menggandakan banyak pola. Sebagai bilangan tanpa tanda, nilainya berjalan dari 0 sampai 2 pangkat n dikurangi 1. Jadi 8 bit menyimpan 256 nilai, 16 bit menyimpan 65.536, dan 32 bit menyimpan sekitar 4,3 miliar. ### Bagaimana bilangan negatif disimpan dalam biner? Hampir semua komputer memakai komplemen dua. Bit paling kiri bernilai minus 2 pangkat n dikurangi 1, sehingga dalam 8 bit 10000000 adalah minus 128 dan 11111111 adalah minus 1. Untuk menegasikan bilangan, balik setiap bit dan tambah 1, yang membuat pengurangan menjadi penjumlahan biasa. ### Apa itu overflow bilangan bulat? Itu yang terjadi ketika hasil tidak muat dalam banyak bit yang tetap. Nilainya berputar: dalam aritmetika bertanda 8 bit 127 ditambah 1 menghasilkan minus 128. Di C dan Java ini bahaya nyata, sedangkan bilangan bulat Python membesar selama memori cukup. ### Berapa 1 ditambah 1 dalam biner? Hasilnya 10 dalam biner, yang dibaca satu-nol dan berarti dua. Tidak ada angka 2 dalam basis 2, sehingga jumlahnya ditulis 0 dengan bawaan 1 ke tempat berikutnya, seperti 5 ditambah 5 ditulis 0 dengan bawaan dalam desimal. ### Apa yang dilakukan AND, OR, dan XOR pada bit? Ketiganya menggabungkan dua bilangan bit demi bit. AND memberi 1 hanya di tempat kedua bit 1, OR memberi 1 di tempat sekurangnya satu bit 1, dan XOR memberi 1 di tempat bitnya berbeda. NOT membalik setiap bit. Dipakai untuk topeng, bendera, dan uji cepat seperti apakah bilangan ganjil. ### Apa yang dilakukan menggeser bit? Menggeser ke kiri sebanyak k tempat mengalikan bilangan dengan 2 pangkat k, dan menggeser ke kanan sebanyak k tempat membagi dengan 2 pangkat k dan membuang sisanya. Cara kerjanya seperti menambah atau menghapus nol dalam desimal. Bit yang melewati ujung bilangan hilang. ### Mengapa 0,1 tidak disimpan dengan tepat dalam biner? Pecahan berakhir dalam biner hanya bila penyebutnya pangkat 2. Sepersepuluh punya faktor 5, sehingga ekspansi binernya 0,000110011 dan seterusnya berulang selamanya. Float hanya menyimpan 53 bit signifikan, sehingga menyimpan nilai terdekat, dan 0,1 ditambah 0,2 sedikit lebih dari 0,3. ### Bagaimana memakai biner di Python? Tulis literal dengan awalan 0b, ubah bilangan dengan bin, hex, dan format, dan baca teks dengan int dan basis seperti 2. Operatornya adalah ampersand, garis tegak, tanda sisipan, tilde, dan dua geseran. Bilangan bulat Python tidak punya ukuran tetap, sehingga tilde dari 5 adalah minus 6. --- # Irrational Numbers: Definition, Examples, Proofs and Approximations Source: https://nunada.my.id/articles/irrational-numbers/ Updated: 2026-10-10 ## Quick answer **An irrational number is a real number that cannot be written as a fraction of two integers; its decimal expansion is infinite and never periodic.** The best-known examples are $\sqrt2=1.41421\ldots$, $\pi=3.14159\ldots$ and $e=2.71828\ldots$. A square root of a whole number is irrational unless the number is a perfect square, so $\sqrt{16}=4$ is rational and $\sqrt{15}$ is not. ### Key takeaways - A real number is either rational or irrational, never both; irrational means no integers $p,q$ with $q\neq0$ give $\frac pq$. - The $k$-th root of a positive integer is either an integer or irrational: it is an integer exactly when every exponent in the prime factorization is a multiple of $k$. - Rational plus irrational is irrational, and so is a non-zero rational times an irrational; the sum or product of two irrationals can be rational, as in $\sqrt2\cdot\sqrt2=2$. - $\pi$ and $e$ are not only irrational but transcendental: they are not roots of any non-zero polynomial with integer coefficients, which is why a circle cannot be squared. - A number is irrational exactly when its continued fraction never stops; its convergents, such as $\frac{22}{7}$ and $\frac{355}{113}$ for $\pi$, approximate it ever better but never equal it. - Almost every real number is irrational, yet between any two rational numbers there is an irrational one, and between any two irrational numbers there is a rational one. ## What is an irrational number? **An irrational number is a real number that is not rational: no two integers $p$ and $q\neq0$ make $\frac pq$ equal to it.** The real numbers split cleanly into the two families, as the article on [real numbers](https://nunada.my.id/articles/real-numbers/#irrational-numbers) explains, so a number is rational or irrational and never both. Because every [rational number](https://nunada.my.id/articles/rational-numbers/#decimals-percent) has a decimal expansion that terminates or eventually repeats periodically, the same fact can be turned round: **a real number is irrational exactly when its decimal expansion is infinite and never periodic.** The digits go on for ever and no block of them ever repeats from some point on. | Number | Value | Why irrational | |---|---|---| | $\sqrt2$ | $1.41421356\ldots$ | 2 is not a perfect square | | $\sqrt3$, $\sqrt5$, $\sqrt6$, $\sqrt7$ | $1.7320\ldots$, $2.2360\ldots$, … | not perfect squares | | $\sqrt[3]{2}$ | $1.25992\ldots$ | 2 is not a perfect cube | | $\pi$ | $3.14159265\ldots$ | Lambert, 1761 | | $e$ | $2.71828182\ldots$ | Euler, 1737 | | $\varphi=\frac{1+\sqrt5}{2}$ | $1.61803398\ldots$ | $\sqrt5$ is irrational | | $\log_{10}2$ | $0.30102999\ldots$ | no power of 2 is a power of 10 | Three things are not irrational, although they are often mistaken for it. A root sign does not decide it: $\sqrt{16}=4$ and $\sqrt[3]{27}=3$ are whole numbers. A long decimal does not decide it: $\frac1{97}$ has a block of 96 repeating digits. And a decimal that goes on for ever is not enough: $0.333\ldots=\frac13$. The word "irrational" comes from ratio, the same root as in rational numbers: an irrational number is one that is not a ratio of integers. It does not mean "unreasonable". Irrational numbers are exact, well-behaved numbers; it is only their decimal expansions that cannot be written down in full. ## Why is √2 irrational? **$\sqrt2$ is irrational because assuming $\sqrt2=\frac ab$ forces a number to have both an even and an odd count of factors of 2, which is impossible.** It is the oldest proof by contradiction, and the version below uses the unique [prime factorization](https://nunada.my.id/articles/integers/#primes) of every integer. Suppose $\sqrt2=\frac ab$ with $a$ and $b$ positive integers. Squaring gives $a^2=2b^2$. Now count how many times the prime 2 divides each side. If 2 divides $a$ exactly $m$ times, then it divides $a^2$ exactly $2m$ times, an **even** number. If it divides $b$ exactly $n$ times, then it divides $2b^2$ exactly $2n+1$ times, an **odd** number. The two sides are the same integer, so they have the same factorization, and no number of factors of 2 is both even and odd. The assumption was false: no such $a$ and $b$ exist. The more familiar version of the same proof, which cancels common factors until $a$ and $b$ are coprime and finds both even, is written out with an exercise in the [real numbers article](https://nunada.my.id/articles/real-numbers/#irrational-numbers). The count of 2s is shorter, and it proves more: - Replace 2 by any integer $n$ and the same argument works whenever some prime divides $n$ an **odd** number of times. So $\sqrt3$, $\sqrt5$, $\sqrt6$, $\sqrt{12}$ are all irrational. - Replace the square root by a $k$-th root and "even" by "a multiple of $k$": $\sqrt[3]{2}$ is irrational because 3 does not divide 1. **Geometry says the same thing.** The diagonal of a unit square (see the [diagonals of a square](https://nunada.my.id/articles/quadrilaterals/#properties)) has length $\sqrt2$ by the [Pythagorean theorem](https://nunada.my.id/articles/pythagorean-theorem/#what-is-the-theorem), and the square's side and diagonal are incommensurable: no unit of length, however small, fits a whole number of times into both. The Pythagoreans, who held that everything is a ratio of whole numbers, met this fact in the fifth century BCE, and Plato's Theaetetus says Theodorus of Cyrene showed the irrationality of the roots of 3, 5 and so on up to 17. Tradition names Hippasus as the Pythagorean who revealed it, although the stories are late and not reliable. Euclid's Elements, Book X, classifies the irrational lengths that compass and straightedge can make. ## How can you tell whether a root is irrational? **The $k$-th root of a positive integer is either a whole number or irrational, and it is a whole number exactly when every exponent in the prime factorization of the integer is a multiple of $k$.** There is no third case: a root of an integer is never a fraction that is not a whole number. To decide, factorize and look at the exponents: | Root | Factorization | Exponents divisible by $k$? | Verdict | |---|---|---|---| | $\sqrt{49}$ | $7^2$ | yes | $7$, rational | | $\sqrt{72}$ | $2^3\cdot3^2$ | no: 3 | $6\sqrt2$, irrational | | $\sqrt[3]{54}$ | $2\cdot3^3$ | no: 1 | $3\sqrt[3]{2}$, irrational | | $\sqrt[4]{81}$ | $3^4$ | yes | $3$, rational | | $\sqrt{1\,000\,000}$ | $2^6\cdot5^6$ | yes | $1000$, rational | Taking out every complete group of $k$ equal primes also **simplifies the radical**: $\sqrt{72}=\sqrt{2^2\cdot2\cdot3^2}=2\cdot3\cdot\sqrt2=6\sqrt2$. The way this is done step by step is in the section on [simplifying radicals](https://nunada.my.id/articles/exponents-and-radicals/#simplify-radicals), and the number left under the root is what stays irrational. Two facts help. A fraction of integers works the same way, since $\sqrt{\frac pq}=\frac{\sqrt p}{\sqrt q}$, so $\sqrt{\frac49}=\frac23$ is rational but $\sqrt{\frac12}=\frac{\sqrt2}{2}$ is not. And a root of a number that is not an integer can still be rational (for example $\sqrt{\frac94}=\frac32$), so the rule above is about integers. Try your own numbers, including large ones. The tool factorizes up to a trillion and prints 30 decimals. ## What happens when you add or multiply irrational numbers? **A rational number plus an irrational number is irrational, and so is a non-zero rational times an irrational; but the sum, difference, product or quotient of two irrational numbers can be rational or irrational.** The irrational numbers are therefore not closed under any of the four operations. | Operation | Result | Example | |---|---|---| | rational + irrational | always irrational | $1+\sqrt2$ | | non-zero rational × irrational | always irrational | $\frac12\sqrt3$ | | irrational + irrational | either | $\sqrt2+\sqrt3$ is irrational; $\sqrt2+(-\sqrt2)=0$ | | irrational × irrational | either | $\sqrt2\cdot\sqrt3=\sqrt6$ is irrational; $\sqrt2\cdot\sqrt2=2$ | | irrational ÷ irrational | either | $\frac{\sqrt6}{\sqrt2}=\sqrt3$ is irrational; $\frac{\sqrt8}{\sqrt2}=2$ | **Why rational plus irrational is irrational.** Suppose $r+x=s$ with $r$ and $s$ rational and $x$ irrational. Then $x=s-r$ is a difference of rational numbers, which is rational: a contradiction. The same argument with division proves the product rule, since $x=\frac sr$ would be rational. **Two irrational numbers can combine into a rational one.** The pair $1+\sqrt2$ and $1-\sqrt2$ are conjugates, and their product is rational because the roots cancel, as in the [difference of squares](https://nunada.my.id/articles/algebraic-expressions/#expand): $(1+\sqrt2)(1-\sqrt2)=1-2=-1$. This is the idea behind [rationalizing a denominator](https://nunada.my.id/articles/exponents-and-radicals/#rationalise). **Exact arithmetic with $a+b\sqrt m$.** Numbers of the form $a+b\sqrt m$, with $a$ and $b$ rational and $\sqrt m$ irrational, can be added, subtracted, multiplied and divided exactly and the answer is again of that form. The number is rational exactly when $b=0$. The tool below does this arithmetic with exact fractions; try the examples, then your own. A simple example of a power of irrationals being rational is $\left(\sqrt2^{\sqrt2}\right)^{\sqrt2}$. If $\sqrt2^{\sqrt2}$ is rational we have an irrational power of an irrational that is rational; if it is irrational, raising it to $\sqrt2$ gives $\sqrt2^{2}=2$. Either way such a pair exists, although this argument does not say which case holds. In fact $\sqrt2^{\sqrt2}$ is irrational and even transcendental. ## What are π and e, and what does transcendental mean? **$\pi$ and $e$ are irrational and also transcendental, which means that neither is a root of any non-zero polynomial with integer coefficients.** A number that is such a root is called **algebraic**. The number $\pi$ is the ratio of the circumference of a circle to its diameter, as in the article on [circles](https://nunada.my.id/articles/circles/#pi-circumference). | Kind | Meaning | Examples | |---|---|---| | Rational | $\frac pq$ with integers; the root of $qx-p=0$ | $\frac34$, $-7$ | | Algebraic irrational | root of an integer polynomial, but not rational | $\sqrt2$ (of $x^2-2$), $\varphi$ (of $x^2-x-1$), $1+\sqrt2$ (of $x^2-2x-1$) | | Transcendental | root of no non-zero integer polynomial | $\pi$, $e$, Liouville's constant | Every rational number is algebraic, so the algebraic numbers contain the rationals and some irrationals; the transcendental numbers are all irrational. Sums, products and roots of algebraic numbers are algebraic again, which is why $\sqrt2+\sqrt3$ and $\sqrt{1+\sqrt2}$ are algebraic. **The history, in order.** - 1737: Euler proved that $e$ is irrational (published 1744). - 1761: Lambert showed that $\pi$ is irrational (published 1768). - 1844: Liouville gave the first numbers proved to be transcendental, such as $0.110001000000000000000001\ldots$, with a 1 in every place whose position is a factorial ($1!,2!,3!,4!,\ldots$). - 1873: Hermite proved that $e$ is transcendental. - 1874: Cantor showed that the algebraic numbers can be listed one after another, so almost every real number is transcendental. - 1882: Lindemann proved that $\pi$ is transcendental. **Squaring the circle.** The old problem asks for a square equal in area to a given circle using only compass and straightedge. Lengths that can be constructed are always algebraic. Lindemann's theorem makes $\pi$, and so $\sqrt\pi$, transcendental, and so the construction is impossible. The phrase "to square the circle" has meant "to attempt the impossible" ever since. **What is still not known.** It is easy to prove that at least one of $\pi+e$ and $\pi e$ is irrational, but nobody knows which, or whether both are. Whether $\pi+e$ is irrational at all is still an open question. ## How well can fractions approximate an irrational number? **Every irrational number can be approximated as closely as you like by fractions, and the best ones come from its continued fraction: $x=a_0+\dfrac{1}{a_1+\dfrac{1}{a_2+\cdots}}$.** To build it, take the integer part $a_0$, invert what is left over, and repeat. A rational number gives a continued fraction that stops; an irrational number gives one that goes on for ever, which is another way to say that it is irrational. The fractions you get by stopping early are the **convergents** $\frac{p_k}{q_k}$, found by $p_k=a_kp_{k-1}+p_{k-2}$ and the same rule for $q_k$. For $\pi=[3;7,15,1,292,\ldots]$: | $k$ | Convergent | Decimal | Error | |---|---|---|---| | 0 | $\frac31$ | $3$ | $1.4\times10^{-1}$ | | 1 | $\frac{22}{7}$ | $3.142857$ | $1.3\times10^{-3}$ | | 2 | $\frac{333}{106}$ | $3.141509$ | $8.3\times10^{-5}$ | | 3 | $\frac{355}{113}$ | $3.14159292$ | $2.7\times10^{-7}$ | | 4 | $\frac{103993}{33102}$ | $3.14159265301$ | $5.8\times10^{-10}$ | $\frac{22}{7}$ is the classroom approximation. $\frac{355}{113}$ was found by Zu Chongzhi in the fifth century and is accurate to six decimals with a denominator of only three digits: the big partial quotient 292 that follows is why it is so good. For $\sqrt2=[1;2,2,2,\ldots]$ the convergents $\frac32,\frac75,\frac{17}{12},\frac{41}{29}$ satisfy $p^2-2q^2=\pm1$. For $e=[2;1,2,1,1,4,1,1,6,\ldots]$ there is a pattern, and for $\pi$ there is none that anyone knows. **The golden ratio is the hardest to approximate.** $\varphi=[1;1,1,1,\ldots]$, and its convergents $\frac11,\frac21,\frac32,\frac53,\frac85,\frac{13}{8},\ldots$ are ratios of consecutive Fibonacci numbers. Every partial quotient is the smallest possible, so the fractions approach it more slowly than they approach any other number. It is the root of $x^2-x-1=0$, which the section on [factoring](https://nunada.my.id/articles/algebraic-expressions/#factor) shows has no whole-number factors. **Rational numbers cannot be reached.** Dirichlet proved that for every irrational $x$ there are infinitely many fractions with $\left|x-\frac pq\right|<\frac1{q^2}$. For a rational $x$ there are only finitely many, so the error of a convergent is not just small: it is never zero. Choose a constant and the number of terms below. ## Can the digits of an irrational number follow a pattern? **Yes: the digits of an irrational number can follow a pattern, as long as the pattern never becomes periodic.** What matters is not whether you can see a pattern but whether a block of digits repeats from some point on. - $0.101001000100001\ldots$, with one more 0 each time, has an obvious pattern and is irrational: no block can repeat, because the runs of zeros keep getting longer. - Champernowne's number $0.123456789101112131415\ldots$, which writes the integers one after another, is irrational, and in 1933 Champernowne proved that every finite string of digits appears in it equally often. - Liouville's constant, with 1s at the factorial places, is irrational for the same reason as the first example. The opposite also holds. A decimal with no visible pattern can be rational: $\frac1{97}=0.\overline{010309278350515463917525773195876288659793814432989690721649484536082474226804123711340206185567}$ repeats only after 96 digits. Looking at a few hundred digits proves nothing in either direction. Irrationality is established by a proof about the number, never by its digits, which are only ever finitely many. **Normal numbers.** A real number is normal in base 10 if every string of $k$ digits appears with frequency $10^{-k}$. Almost every real number is normal, but for the famous constants nobody has proved it: $\pi$, $e$ and $\sqrt2$ look normal in the billions of digits computed, and that is all anyone can say. The digits can be produced on demand (the [digits of pi](https://nunada.my.id/articles/real-numbers/#irrational-numbers) have been computed to trillions of places), but there is no rule that predicts the millionth digit without computing the digits before it, at least none that is known. For the repeating side of the story, see how [fractions turn into decimals](https://nunada.my.id/articles/rational-numbers/#decimals-percent), and why $\frac1{97}$ must repeat within 96 steps. ## How many irrational numbers are there? **There are far more irrational numbers than rational ones: the rationals can be listed one after another, the irrationals cannot, so almost every real number is irrational.** Cantor proved in 1874 that the real numbers are uncountable, and since the rationals are countable, the rest, the irrationals, must be uncountable. If you could pick a real number at random, the probability that it is rational would be 0. Yet the two kinds are tightly mixed. Between any two different real numbers there is both a rational and an irrational number, which is the density described in the article on [the number line](https://nunada.my.id/articles/real-numbers/#number-line-density). - **An irrational between two rationals $a>> import math >>> math.pi 3.141592653589793 >>> math.sqrt(2) ** 2 # rounding, not a bug 2.0000000000000004 >>> math.pi.as_integer_ratio() # a float is always a fraction (884279719003555, 281474976710656) >>> from fractions import Fraction >>> Fraction(math.pi).limit_denominator(1000) # a good fraction: 355/113 Fraction(355, 113) >>> from decimal import Decimal, getcontext >>> getcontext().prec = 50 # 50 significant digits >>> Decimal(2).sqrt() Decimal('1.4142135623730950488016887242096980785696718753769') >>> math.isqrt(2 * 10**40) # exact digits of the square root of 2 141421356237309504880 >>> import sympy # keep it exact as a formula >>> sympy.sqrt(8) 2*sqrt(2) >>> sympy.sqrt(2) ** 2 2 ``` ```javascript Math.PI // 3.141592653589793 Math.SQRT2 // 1.4142135623730951 Math.sqrt(2) ** 2 // 2.0000000000000004 Math.sqrt(2) * Math.sqrt(8) // 4.000000000000001, although the exact value is 4 Math.abs(Math.sqrt(2) ** 2 - 2) < 1e-12 // true: compare with a tolerance ``` ```cpp #include #include #include using namespace std; const double PI = acos(-1.0); int main() { printf("%.15f\n", PI); // 3.141592653589793 printf("%.16f\n", sqrt(2) * sqrt(2)); // rounding, not a bug printf("%.15f\n", sqrt(2) * sqrt(8)); // 4.000000000000001, although the exact value is 4 printf("%d\n", fabs(sqrt(2) * sqrt(2) - 2) < 1e-12); // compare with a tolerance int bestP = 0, bestQ = 1; // the best fraction p/q for pi with q <= 1000 for (int q = 1; q <= 1000; q++) { int p = (int)floor(PI * q + 0.5); if (fabs(PI - (double)p / q) < fabs(PI - (double)bestP / bestQ)) { bestP = p; bestQ = q; } } cout << bestP << "/" << bestQ << endl; // 355/113 printf("%.10f %.10f\n", 22.0 / 7 - PI, (double)bestP / bestQ - PI); // the errors of 22/7 and 355/113 return 0; } /* output: 3.141592653589793 2.0000000000000004 4.000000000000001 1 355/113 0.0012644893 0.0000002668 */ ``` The pitfalls, in order of how often they bite: | Pitfall | What happens | What to do | |---|---|---| | `==` on results of roots | `Math.sqrt(2) ** 2 == 2` is false | compare with a tolerance, `math.isclose` in Python | | Believing the digits shown | `math.pi` stops after about 16 digits | use `decimal` or a library for more | | Testing irrationality numerically | every float is rational, so a program can only guess | prove it, or factor the integer under the root | | `22 / 7` as `π` | 3.142857… differs from π in the third decimal | use `math.pi`, or 355/113 if you need a fraction | | `sqrt` of a perfect square | `math.sqrt(16)` gives `4.0`, a float | use `math.isqrt` when you want a whole number | | Mixing exact and float values | `sympy.sqrt(2) * 1.0` turns exact into approximate | keep symbols exact until the end | Use `Decimal` or `sympy` for exactness, floats for speed, and never use a float to decide whether a number is irrational. ## What are the common mistakes about irrational numbers? **The most common mistakes about irrational numbers are the nine below, each with the correct statement and a number that shows why.** | Mistake | Correct | |---|---| | ❌ $\pi=\frac{22}{7}$ | $\frac{22}{7}=3.142857\ldots$ is an approximation; $\pi=3.14159\ldots$ is not a fraction at all. | | ❌ $\pi=3.14$ | $3.14$ is $\pi$ rounded to two decimals, a rational number. | | ❌ Every square root is irrational | $\sqrt{16}=4$ and $\sqrt{\frac14}=\frac12$ are rational. | | ❌ The sum of two irrationals is irrational | $\sqrt2+(-\sqrt2)=0$. | | ❌ The product of two irrationals is irrational | $\sqrt2\cdot\sqrt2=2$. | | ❌ A decimal with no visible pattern is irrational | $\frac1{97}$ repeats only after 96 digits. | | ❌ A decimal with a visible pattern is rational | $0.101001000\ldots$ has a pattern and is irrational. | | ❌ $0.\overline{9}$ is irrational because it never ends | $0.\overline{9}=1$ exactly. | | ❌ The calculator shows $\pi$, so $\pi$ terminates | A calculator shows the first 10 to 16 digits of a number whose digits never end. | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: irrational numbers at a glance - **Definition:** a real number that is not a fraction of integers; its decimal expansion is infinite and never periodic. Rational and irrational never overlap. - **Roots:** the $k$-th root of an integer is an integer or irrational; it is an integer exactly when every prime exponent is a multiple of $k$. - **$\sqrt2$:** $a^2=2b^2$ gives an even and an odd count of factors of 2. - **Arithmetic:** rational plus irrational is irrational; non-zero rational times irrational is irrational; two irrationals can give a rational, as in $(1+\sqrt2)(1-\sqrt2)=-1$. - **$\pi$ and $e$:** irrational (Lambert, Euler) and transcendental (Lindemann, Hermite), so the circle cannot be squared. - **Approximation:** a continued fraction that never stops; $\frac{22}{7}$ and $\frac{355}{113}$ are convergents of $\pi$; $\varphi$ is the hardest to approximate. - **Digits:** a pattern is fine if it never becomes periodic; a digit table can never prove irrationality. - **Size:** almost every real number is irrational, yet each interval contains both kinds. - **Code:** a float is always a fraction; keep roots exact with `sympy` or compute digits with `Decimal`. ## Glossary: key terms - **Irrational number**: A real number that cannot be written as a fraction of two integers; its decimal expansion is infinite and never periodic. - **Rational number**: A number that can be written as a fraction of two integers with a non-zero denominator; its decimal expansion terminates or eventually repeats periodically. - **Decimal expansion**: The full list of digits of a number after the decimal point, however long. - **Perfect square**: A whole number that is the square of a whole number, such as 16 or 49; the square root of any other positive integer is irrational. - **Proof by contradiction**: A proof that assumes the opposite of the claim and derives something impossible, as in the proof that the square root of 2 is irrational. - **Incommensurable**: Two lengths with no common unit that fits a whole number of times into both, such as the side and the diagonal of a square. - **Conjugate**: For a plus b times the square root of m, the number a minus b times the square root of m; their product is rational. - **Algebraic number**: A number that is a root of a non-zero polynomial with integer coefficients, such as the square root of 2, which is a root of x squared minus 2. - **Transcendental number**: A real number that is not algebraic, such as pi and e; every transcendental number is irrational. - **Continued fraction**: An expression of a number as an integer plus one over an integer plus one over another integer, and so on; it stops exactly when the number is rational. - **Convergent**: A fraction obtained by stopping a continued fraction early, such as 22 over 7 and 355 over 113 for pi; it is the best approximation for its denominator size. - **Golden ratio**: The number 1 plus the square root of 5, all over 2, about 1.618, which is a root of x squared minus x minus 1 and the hardest number to approximate by fractions. - **Normal number**: A number in whose decimal expansion every string of k digits appears with frequency one in 10 to the power k. - **Uncountable set**: An infinite set whose members cannot be listed one after another, such as the real numbers and the irrational numbers. ## Frequently asked questions ### What is an irrational number? An irrational number is a real number that cannot be written as a fraction of two integers. Its decimal expansion is infinite and never periodic, as in the square root of 2, pi and e. Every real number is either rational or irrational. ### What are some examples of irrational numbers? The square root of 2, the square root of 3, the cube root of 2, pi, e and the golden ratio are irrational. Square roots of whole numbers that are not perfect squares are always irrational, while the square root of 16 is 4, which is rational. ### Why is the square root of 2 irrational? If the square root of 2 equaled a over b, then a squared would equal 2 times b squared. The prime 2 would then divide the left side an even number of times and the right side an odd number of times, which is impossible for the same integer. ### Is pi irrational? Yes. Lambert proved in 1761 that pi is irrational, and Lindemann proved in 1882 that it is even transcendental. So pi is not equal to 22 over 7 or to 3.14, which are only approximations, and its digits never become periodic. ### Is the square root of 16 irrational? No. The square root of 16 is exactly 4, a whole number, so it is rational. A square root of a whole number is irrational only when the number is not a perfect square. Perfect squares such as 1, 4, 9, 16 and 25 have whole number roots. ### Can the sum of two irrational numbers be rational? Yes. The square root of 2 plus minus the square root of 2 is 0, and 1 plus the square root of 2 added to 1 minus the square root of 2 is 2. Both sums are rational. The product of two irrational numbers can be rational too. ### Is a rational number plus an irrational number always irrational? Yes. If a rational number r plus an irrational number x gave a rational number s, then x would equal s minus r, a difference of rationals, which is rational. That contradicts x being irrational, so the sum must be irrational. ### How do you tell whether a root is irrational? Factorize the whole number under the root into primes. The k-th root is a whole number exactly when every exponent is a multiple of k, and otherwise it is irrational. For 72, which is 2 cubed times 3 squared, the exponent 3 is odd, so the square root is irrational. ### What is the difference between algebraic and transcendental numbers? An algebraic number is a root of a non-zero polynomial with integer coefficients, such as the square root of 2, a root of x squared minus 2. A transcendental number is not a root of any such polynomial. Pi and e are transcendental, and so are almost all real numbers. ### Why can the circle not be squared? Squaring the circle needs a length of square root of pi using only compass and straightedge. Constructible lengths are always algebraic, but Lindemann proved in 1882 that pi is transcendental. So the construction is impossible, however cleverly you try. ### Are all non-terminating decimals irrational? No. A decimal that never terminates but eventually repeats periodically is rational, such as 0.333 and so on, which is one third. Only a decimal expansion that is infinite and never periodic is irrational. Even 0.999 and so on repeating is exactly 1. ### How many irrational numbers are there? Infinitely many, and far more than rational numbers. The rational numbers can be listed one after another, but Cantor proved in 1874 that the real numbers cannot, so the irrational numbers are uncountable and almost every real number is irrational. ### How are irrational numbers stored in a computer? They are not stored exactly. A floating-point number is always a fraction with a power of 2 as denominator, so a float such as math.pi is only a nearby rational number. For exact work use a symbolic library such as sympy, or compute as many digits as needed with decimal. ### What is the golden ratio? The golden ratio is 1 plus the square root of 5, all over 2, about 1.618. It is irrational, it solves x squared minus x minus 1 equals 0, and the ratios of consecutive Fibonacci numbers approach it, more slowly than they approach any other number. --- # Bilangan Irasional: Pengertian, Contoh, Bukti, dan Hampiran Source: https://nunada.my.id/artikel/bilangan-irasional/ Updated: 2026-10-10 ## Jawaban singkat **Bilangan irasional adalah bilangan real yang tidak dapat ditulis sebagai pecahan dua bilangan bulat; ekspansi desimalnya tak berhingga dan tidak pernah periodik.** Contoh yang paling dikenal adalah $\sqrt2=1{,}41421\ldots$, $\pi=3{,}14159\ldots$, dan $e=2{,}71828\ldots$. Akar kuadrat bilangan bulat bersifat irasional kecuali bilangan itu kuadrat sempurna, sehingga $\sqrt{16}=4$ rasional dan $\sqrt{15}$ tidak. ### Poin penting - Bilangan real rasional atau irasional, tidak pernah keduanya; irasional berarti tidak ada bilangan bulat $p,q$ dengan $q\neq0$ yang membuat $\frac pq$ sama dengannya. - Akar pangkat $k$ dari bilangan bulat positif adalah bilangan bulat atau irasional: ia bilangan bulat tepat bila setiap eksponen dalam faktorisasi primanya kelipatan $k$. - Rasional ditambah irasional adalah irasional, begitu pula rasional bukan nol dikali irasional; jumlah atau hasil kali dua bilangan irasional dapat rasional, seperti $\sqrt2\cdot\sqrt2=2$. - $\pi$ dan $e$ tidak hanya irasional tetapi transenden: keduanya bukan akar polinomial tak nol mana pun dengan koefisien bulat, itulah sebabnya lingkaran tidak dapat dikuadratkan. - Sebuah bilangan irasional tepat bila pecahan berantainya tidak pernah berhenti; konvergennya, seperti $\frac{22}{7}$ dan $\frac{355}{113}$ untuk $\pi$, menghampirinya makin baik tetapi tidak pernah sama dengannya. - Hampir setiap bilangan real irasional, namun di antara dua bilangan rasional mana pun ada bilangan irasional, dan di antara dua bilangan irasional mana pun ada bilangan rasional. ## Apa itu bilangan irasional? **Bilangan irasional adalah bilangan real yang tidak rasional: tidak ada dua bilangan bulat $p$ dan $q\neq0$ yang membuat $\frac pq$ sama dengannya.** Bilangan real terbagi bersih menjadi dua keluarga itu, seperti dijelaskan artikel [bilangan real](https://nunada.my.id/artikel/bilangan-real/#irrational-numbers), sehingga sebuah bilangan rasional atau irasional dan tidak pernah keduanya. Karena setiap [bilangan rasional](https://nunada.my.id/artikel/bilangan-rasional/#decimals-percent) punya ekspansi desimal yang berakhir atau akhirnya berulang secara periodik, fakta yang sama dapat dibalik: **bilangan real irasional tepat bila ekspansi desimalnya tak berhingga dan tidak pernah periodik.** Angkanya berlanjut tanpa akhir dan tidak ada blok angka yang berulang mulai dari suatu titik. | Bilangan | Nilai | Mengapa irasional | |---|---|---| | $\sqrt2$ | $1{,}41421356\ldots$ | 2 bukan kuadrat sempurna | | $\sqrt3$, $\sqrt5$, $\sqrt6$, $\sqrt7$ | $1{,}7320\ldots$, $2{,}2360\ldots$, … | bukan kuadrat sempurna | | $\sqrt[3]{2}$ | $1{,}25992\ldots$ | 2 bukan kubik sempurna | | $\pi$ | $3{,}14159265\ldots$ | Lambert, 1761 | | $e$ | $2{,}71828182\ldots$ | Euler, 1737 | | $\varphi=\frac{1+\sqrt5}{2}$ | $1{,}61803398\ldots$ | $\sqrt5$ irasional | | $\log_{10}2$ | $0{,}30102999\ldots$ | tidak ada pangkat 2 yang sama dengan pangkat 10 | Tiga hal bukan irasional, walaupun sering disangka demikian. Tanda akar tidak menentukannya: $\sqrt{16}=4$ dan $\sqrt[3]{27}=3$ adalah bilangan bulat. Desimal yang panjang tidak menentukannya: $\frac1{97}$ punya blok 96 angka yang berulang. Dan desimal yang berlanjut tanpa akhir saja belum cukup: $0{,}333\ldots=\frac13$. Kata "irasional" berasal dari rasio, akar kata yang sama dengan bilangan rasional: bilangan irasional adalah bilangan yang bukan perbandingan bilangan bulat. Ia tidak berarti "tidak masuk akal". Bilangan irasional adalah bilangan yang eksak dan berperilaku baik; hanya ekspansi desimalnya yang tidak dapat ditulis seluruhnya. ## Mengapa √2 irasional? **$\sqrt2$ irasional karena mengandaikan $\sqrt2=\frac ab$ memaksa sebuah bilangan punya banyak faktor 2 yang genap sekaligus ganjil, dan itu mustahil.** Ini bukti dengan kontradiksi yang tertua, dan versi di bawah memakai [faktorisasi prima](https://nunada.my.id/artikel/bilangan-bulat/#primes) yang tunggal dari setiap bilangan bulat. Misalkan $\sqrt2=\frac ab$ dengan $a$ dan $b$ bilangan bulat positif. Mengkuadratkan memberi $a^2=2b^2$. Sekarang hitung berapa kali bilangan prima 2 membagi tiap ruas. Jika 2 membagi $a$ tepat $m$ kali, maka ia membagi $a^2$ tepat $2m$ kali, bilangan **genap**. Jika ia membagi $b$ tepat $n$ kali, maka ia membagi $2b^2$ tepat $2n+1$ kali, bilangan **ganjil**. Kedua ruas adalah bilangan bulat yang sama, sehingga faktorisasinya sama, dan tidak ada banyak faktor 2 yang genap sekaligus ganjil. Pengandaiannya salah: tidak ada $a$ dan $b$ seperti itu. Versi yang lebih akrab dari bukti yang sama, yang mencoret faktor sama sampai $a$ dan $b$ saling prima lalu mendapati keduanya genap, dituliskan lengkap beserta latihannya di [artikel bilangan real](https://nunada.my.id/artikel/bilangan-real/#irrational-numbers). Menghitung faktor 2 lebih singkat, dan membuktikan lebih banyak: - Ganti 2 dengan bilangan bulat $n$ mana pun dan argumen yang sama berlaku bila ada bilangan prima yang membagi $n$ sebanyak **ganjil** kali. Jadi $\sqrt3$, $\sqrt5$, $\sqrt6$, $\sqrt{12}$ semuanya irasional. - Ganti akar kuadrat dengan akar pangkat $k$ dan "genap" dengan "kelipatan $k$": $\sqrt[3]{2}$ irasional karena 3 tidak membagi 1. **Geometri mengatakan hal yang sama.** Diagonal persegi satuan (lihat [diagonal persegi](https://nunada.my.id/artikel/segiempat/#properties)) panjangnya $\sqrt2$ menurut [teorema Pythagoras](https://nunada.my.id/artikel/teorema-pythagoras/#what-is-the-theorem), dan sisi serta diagonal persegi itu tak sepadan: tidak ada satuan panjang, sekecil apa pun, yang muat bilangan bulat kali pada keduanya. Kaum Pythagoras, yang berpendapat bahwa segala sesuatu adalah perbandingan bilangan bulat, menjumpai fakta ini pada abad ke-5 SM, dan Theaetetus karya Plato menyebut bahwa Theodorus dari Kirene menunjukkan keirasionalan akar 3, 5, dan seterusnya sampai 17. Tradisi menyebut Hippasus sebagai orang Pythagoras yang membocorkannya, walaupun kisahnya muncul belakangan dan tidak dapat diandalkan. Elements karya Euclid, Buku X, menggolongkan panjang-panjang irasional yang dapat dibuat dengan jangka dan penggaris. ## Bagaimana mengetahui apakah suatu akar irasional? **Akar pangkat $k$ dari bilangan bulat positif adalah bilangan bulat atau irasional, dan ia bilangan bulat tepat bila setiap eksponen dalam faktorisasi prima bilangan itu kelipatan $k$.** Tidak ada kemungkinan ketiga: akar dari bilangan bulat tidak pernah pecahan yang bukan bilangan bulat. Untuk memutuskan, faktorkan dan lihat eksponennya: | Akar | Faktorisasi | Eksponen habis dibagi $k$? | Kesimpulan | |---|---|---|---| | $\sqrt{49}$ | $7^2$ | ya | $7$, rasional | | $\sqrt{72}$ | $2^3\cdot3^2$ | tidak: 3 | $6\sqrt2$, irasional | | $\sqrt[3]{54}$ | $2\cdot3^3$ | tidak: 1 | $3\sqrt[3]{2}$, irasional | | $\sqrt[4]{81}$ | $3^4$ | ya | $3$, rasional | | $\sqrt{1000000}$ | $2^6\cdot5^6$ | ya | $1000$, rasional | Mengeluarkan setiap kelompok lengkap berisi $k$ bilangan prima yang sama juga **menyederhanakan bentuk akar**: $\sqrt{72}=\sqrt{2^2\cdot2\cdot3^2}=2\cdot3\cdot\sqrt2=6\sqrt2$. Cara melakukannya langkah demi langkah ada pada bagian [menyederhanakan bentuk akar](https://nunada.my.id/artikel/eksponen-dan-akar/#simplify-radicals), dan bilangan yang tersisa di bawah akar itulah yang tetap irasional. Dua fakta membantu. Pecahan bilangan bulat bekerja sama, sebab $\sqrt{\frac pq}=\frac{\sqrt p}{\sqrt q}$, sehingga $\sqrt{\frac49}=\frac23$ rasional tetapi $\sqrt{\frac12}=\frac{\sqrt2}{2}$ tidak. Dan akar dari bilangan yang bukan bilangan bulat masih dapat rasional (misalnya $\sqrt{\frac94}=\frac32$), jadi aturan di atas berlaku untuk bilangan bulat. Coba bilanganmu sendiri, termasuk yang besar. Alat ini memfaktorkan sampai satu triliun dan menampilkan 30 desimal. ## Apa yang terjadi bila bilangan irasional dijumlahkan atau dikalikan? **Bilangan rasional ditambah bilangan irasional adalah irasional, begitu pula rasional bukan nol dikali irasional; tetapi jumlah, selisih, hasil kali, atau hasil bagi dua bilangan irasional dapat rasional atau irasional.** Jadi bilangan irasional tidak tertutup terhadap satu pun dari keempat operasi. | Operasi | Hasil | Contoh | |---|---|---| | rasional + irasional | selalu irasional | $1+\sqrt2$ | | rasional bukan nol × irasional | selalu irasional | $\frac12\sqrt3$ | | irasional + irasional | salah satunya | $\sqrt2+\sqrt3$ irasional; $\sqrt2+(-\sqrt2)=0$ | | irasional × irasional | salah satunya | $\sqrt2\cdot\sqrt3=\sqrt6$ irasional; $\sqrt2\cdot\sqrt2=2$ | | irasional ÷ irasional | salah satunya | $\frac{\sqrt6}{\sqrt2}=\sqrt3$ irasional; $\frac{\sqrt8}{\sqrt2}=2$ | **Mengapa rasional ditambah irasional adalah irasional.** Misalkan $r+x=s$ dengan $r$ dan $s$ rasional dan $x$ irasional. Maka $x=s-r$ adalah selisih bilangan rasional, yang rasional: sebuah kontradiksi. Argumen yang sama dengan pembagian membuktikan aturan hasil kali, sebab $x=\frac sr$ akan rasional. **Dua bilangan irasional dapat bergabung menjadi bilangan rasional.** Pasangan $1+\sqrt2$ dan $1-\sqrt2$ adalah sekawan, dan hasil kalinya rasional karena akarnya saling meniadakan, seperti pada [selisih dua kuadrat](https://nunada.my.id/artikel/bentuk-aljabar/#expand): $(1+\sqrt2)(1-\sqrt2)=1-2=-1$. Inilah gagasan di balik [merasionalkan penyebut](https://nunada.my.id/artikel/eksponen-dan-akar/#rationalise). **Aritmetika eksak dengan $a+b\sqrt m$.** Bilangan berbentuk $a+b\sqrt m$, dengan $a$ dan $b$ rasional dan $\sqrt m$ irasional, dapat dijumlahkan, dikurangkan, dikalikan, dan dibagi secara eksak dan jawabannya berbentuk yang sama. Bilangan itu rasional tepat bila $b=0$. Alat di bawah melakukan aritmetika ini dengan pecahan eksak; coba contohnya, lalu bilanganmu sendiri. Contoh sederhana pangkat bilangan irasional yang rasional adalah $\left(\sqrt2^{\sqrt2}\right)^{\sqrt2}$. Jika $\sqrt2^{\sqrt2}$ rasional, kita punya irasional pangkat irasional yang rasional; jika ia irasional, memangkatkannya dengan $\sqrt2$ memberi $\sqrt2^{2}=2$. Bagaimanapun pasangan seperti itu ada, walaupun argumen ini tidak menyebut kasus mana yang berlaku. Sebenarnya $\sqrt2^{\sqrt2}$ irasional dan bahkan transenden. ## Apa itu π dan e, dan apa arti transenden? **$\pi$ dan $e$ irasional dan juga transenden, yang berarti keduanya bukan akar polinomial tak nol mana pun dengan koefisien bulat.** Bilangan yang merupakan akar seperti itu disebut **aljabar**. Bilangan $\pi$ adalah perbandingan keliling lingkaran terhadap diameternya, seperti pada artikel [lingkaran](https://nunada.my.id/artikel/lingkaran/#pi-circumference). | Jenis | Arti | Contoh | |---|---|---| | Rasional | $\frac pq$ dengan bilangan bulat; akar dari $qx-p=0$ | $\frac34$, $-7$ | | Irasional aljabar | akar polinomial bulat, tetapi tidak rasional | $\sqrt2$ (dari $x^2-2$), $\varphi$ (dari $x^2-x-1$), $1+\sqrt2$ (dari $x^2-2x-1$) | | Transenden | akar dari tidak ada polinomial bulat tak nol | $\pi$, $e$, konstanta Liouville | Setiap bilangan rasional bersifat aljabar, sehingga bilangan aljabar memuat bilangan rasional dan sebagian bilangan irasional; bilangan transenden semuanya irasional. Jumlah, hasil kali, dan akar bilangan aljabar bersifat aljabar lagi, itulah sebabnya $\sqrt2+\sqrt3$ dan $\sqrt{1+\sqrt2}$ aljabar. **Sejarahnya, berurutan.** - 1737: Euler membuktikan bahwa $e$ irasional (terbit 1744). - 1761: Lambert menunjukkan bahwa $\pi$ irasional (terbit 1768). - 1844: Liouville memberi bilangan pertama yang terbukti transenden, seperti $0{,}110001000000000000000001\ldots$, dengan angka 1 di setiap tempat yang posisinya faktorial ($1!,2!,3!,4!,\ldots$). - 1873: Hermite membuktikan bahwa $e$ transenden. - 1874: Cantor menunjukkan bahwa bilangan aljabar dapat didaftar satu per satu, sehingga hampir setiap bilangan real transenden. - 1882: Lindemann membuktikan bahwa $\pi$ transenden. **Mengkuadratkan lingkaran.** Masalah lama ini meminta persegi yang luasnya sama dengan sebuah lingkaran memakai hanya jangka dan penggaris. Panjang yang dapat dikonstruksi selalu aljabar. Teorema Lindemann membuat $\pi$, dan juga $\sqrt\pi$, transenden, sehingga konstruksi itu mustahil. Ungkapan "mengkuadratkan lingkaran" sejak itu berarti "mencoba yang mustahil". **Yang masih belum diketahui.** Mudah dibuktikan bahwa sekurang-kurangnya satu dari $\pi+e$ dan $\pi e$ irasional, tetapi tidak ada yang tahu yang mana, atau apakah keduanya. Apakah $\pi+e$ irasional sama sekali masih merupakan pertanyaan terbuka. ## Seberapa baik pecahan dapat menghampiri bilangan irasional? **Setiap bilangan irasional dapat dihampiri sedekat yang kamu mau oleh pecahan, dan hampiran terbaiknya berasal dari pecahan berantainya: $x=a_0+\dfrac{1}{a_1+\dfrac{1}{a_2+\cdots}}$.** Untuk membangunnya, ambil bagian bulat $a_0$, balik sisanya, dan ulangi. Bilangan rasional menghasilkan pecahan berantai yang berhenti; bilangan irasional menghasilkan yang berlanjut tanpa akhir, yang merupakan cara lain mengatakan bahwa ia irasional. Pecahan yang kamu dapat dengan berhenti lebih awal adalah **konvergen** $\frac{p_k}{q_k}$, diperoleh dengan $p_k=a_kp_{k-1}+p_{k-2}$ dan aturan yang sama untuk $q_k$. Untuk $\pi=[3;7,15,1,292,\ldots]$: | $k$ | Konvergen | Desimal | Galat | |---|---|---|---| | 0 | $\frac31$ | $3$ | $1{,}4\times10^{-1}$ | | 1 | $\frac{22}{7}$ | $3{,}142857$ | $1{,}3\times10^{-3}$ | | 2 | $\frac{333}{106}$ | $3{,}141509$ | $8{,}3\times10^{-5}$ | | 3 | $\frac{355}{113}$ | $3{,}14159292$ | $2{,}7\times10^{-7}$ | | 4 | $\frac{103993}{33102}$ | $3{,}14159265301$ | $5{,}8\times10^{-10}$ | $\frac{22}{7}$ adalah hampiran yang diajarkan di kelas. $\frac{355}{113}$ ditemukan oleh Zu Chongzhi pada abad ke-5 dan akurat sampai enam desimal dengan penyebut yang hanya tiga angka: hasil bagi parsial 292 yang menyusul itulah yang membuatnya begitu baik. Untuk $\sqrt2=[1;2,2,2,\ldots]$ konvergen $\frac32,\frac75,\frac{17}{12},\frac{41}{29}$ memenuhi $p^2-2q^2=\pm1$. Untuk $e=[2;1,2,1,1,4,1,1,6,\ldots]$ ada pola, dan untuk $\pi$ tidak ada pola yang diketahui siapa pun. **Rasio emas adalah yang paling sulit dihampiri.** $\varphi=[1;1,1,1,\ldots]$, dan konvergennya $\frac11,\frac21,\frac32,\frac53,\frac85,\frac{13}{8},\ldots$ adalah perbandingan bilangan Fibonacci berurutan. Setiap hasil bagi parsial yang paling kecil mungkin, sehingga pecahannya mendekatinya lebih lambat daripada mendekati bilangan lain mana pun. Ia akar dari $x^2-x-1=0$, yang menurut bagian [pemfaktoran](https://nunada.my.id/artikel/bentuk-aljabar/#factor) tidak punya faktor bilangan bulat. **Bilangan rasional tidak dapat dicapai.** Dirichlet membuktikan bahwa untuk setiap $x$ irasional ada tak berhingga banyak pecahan dengan $\left|x-\frac pq\right|<\frac1{q^2}$. Untuk $x$ rasional hanya ada berhingga banyak, sehingga galat sebuah konvergen bukan hanya kecil: ia tidak pernah nol. Pilih sebuah konstanta dan banyak suku di bawah. ## Dapatkah angka bilangan irasional mengikuti suatu pola? **Ya: angka bilangan irasional dapat mengikuti suatu pola, asalkan pola itu tidak pernah menjadi periodik.** Yang penting bukan apakah kamu dapat melihat pola, melainkan apakah suatu blok angka berulang mulai dari suatu titik. - $0{,}101001000100001\ldots$, dengan satu angka 0 lebih banyak setiap kali, punya pola yang jelas dan irasional: tidak ada blok yang dapat berulang, karena deretan nol terus memanjang. - Bilangan Champernowne $0{,}123456789101112131415\ldots$, yang menuliskan bilangan bulat satu demi satu, irasional, dan pada 1933 Champernowne membuktikan bahwa setiap untai angka berhingga muncul di dalamnya sama seringnya. - Konstanta Liouville, dengan angka 1 di tempat-tempat faktorial, irasional karena alasan yang sama dengan contoh pertama. Kebalikannya juga berlaku. Desimal tanpa pola yang terlihat dapat rasional: $\frac1{97}=0{,}\overline{010309278350515463917525773195876288659793814432989690721649484536082474226804123711340206185567}$ baru berulang setelah 96 angka. Melihat beberapa ratus angka tidak membuktikan apa pun ke kedua arah. Keirasionalan dibuktikan dengan bukti tentang bilangannya, tidak pernah dengan angkanya, yang selalu hanya berhingga banyaknya. **Bilangan normal.** Bilangan real normal di basis 10 bila setiap untai $k$ angka muncul dengan frekuensi $10^{-k}$. Hampir setiap bilangan real normal, tetapi untuk konstanta terkenal belum ada yang membuktikannya: $\pi$, $e$, dan $\sqrt2$ tampak normal pada miliaran angka yang sudah dihitung, dan hanya itu yang dapat dikatakan. Angkanya dapat dihasilkan sesuai permintaan ([angka-angka pi](https://nunada.my.id/artikel/bilangan-real/#irrational-numbers) sudah dihitung sampai triliunan tempat), tetapi tidak ada aturan yang meramalkan angka ke-sejuta tanpa menghitung angka sebelumnya, setidaknya tidak ada yang diketahui. Untuk sisi yang berulang dari cerita ini, lihat bagaimana [pecahan menjadi desimal](https://nunada.my.id/artikel/bilangan-rasional/#decimals-percent), dan mengapa $\frac1{97}$ harus berulang dalam 96 langkah. ## Berapa banyak bilangan irasional? **Bilangan irasional jauh lebih banyak daripada bilangan rasional: bilangan rasional dapat didaftar satu per satu, yang irasional tidak, sehingga hampir setiap bilangan real irasional.** Cantor membuktikan pada 1874 bahwa bilangan real tak terhitung, dan karena bilangan rasional terhitung, sisanya, bilangan irasional, pasti tak terhitung. Jika kamu dapat memilih bilangan real secara acak, peluang bahwa ia rasional adalah 0. Namun kedua jenis itu bercampur rapat. Di antara dua bilangan real berbeda mana pun ada bilangan rasional sekaligus irasional, yaitu kerapatan yang dijelaskan pada artikel tentang [garis bilangan](https://nunada.my.id/artikel/bilangan-real/#number-line-density). - **Bilangan irasional di antara dua bilangan rasional $a>> import math >>> math.pi 3.141592653589793 >>> math.sqrt(2) ** 2 # rounding, not a bug 2.0000000000000004 >>> math.pi.as_integer_ratio() # a float is always a fraction (884279719003555, 281474976710656) >>> from fractions import Fraction >>> Fraction(math.pi).limit_denominator(1000) # a good fraction: 355/113 Fraction(355, 113) >>> from decimal import Decimal, getcontext >>> getcontext().prec = 50 # 50 significant digits >>> Decimal(2).sqrt() Decimal('1.4142135623730950488016887242096980785696718753769') >>> math.isqrt(2 * 10**40) # exact digits of the square root of 2 141421356237309504880 >>> import sympy # keep it exact as a formula >>> sympy.sqrt(8) 2*sqrt(2) >>> sympy.sqrt(2) ** 2 2 ``` ```javascript Math.PI // 3.141592653589793 Math.SQRT2 // 1.4142135623730951 Math.sqrt(2) ** 2 // 2.0000000000000004 Math.sqrt(2) * Math.sqrt(8) // 4.000000000000001, although the exact value is 4 Math.abs(Math.sqrt(2) ** 2 - 2) < 1e-12 // true: compare with a tolerance ``` ```cpp #include #include #include using namespace std; const double PI = acos(-1.0); int main() { printf("%.15f\n", PI); // 3.141592653589793 printf("%.16f\n", sqrt(2) * sqrt(2)); // rounding, not a bug printf("%.15f\n", sqrt(2) * sqrt(8)); // 4.000000000000001, although the exact value is 4 printf("%d\n", fabs(sqrt(2) * sqrt(2) - 2) < 1e-12); // compare with a tolerance int bestP = 0, bestQ = 1; // the best fraction p/q for pi with q <= 1000 for (int q = 1; q <= 1000; q++) { int p = (int)floor(PI * q + 0.5); if (fabs(PI - (double)p / q) < fabs(PI - (double)bestP / bestQ)) { bestP = p; bestQ = q; } } cout << bestP << "/" << bestQ << endl; // 355/113 printf("%.10f %.10f\n", 22.0 / 7 - PI, (double)bestP / bestQ - PI); // the errors of 22/7 and 355/113 return 0; } /* output: 3.141592653589793 2.0000000000000004 4.000000000000001 1 355/113 0.0012644893 0.0000002668 */ ``` Jebakannya, berurutan dari yang paling sering menggigit: | Jebakan | Yang terjadi | Yang sebaiknya dilakukan | |---|---|---| | `==` pada hasil akar | `Math.sqrt(2) ** 2 == 2` salah | bandingkan dengan toleransi, `math.isclose` di Python | | Memercayai angka yang ditampilkan | `math.pi` berhenti setelah sekitar 16 angka | pakai `decimal` atau pustaka untuk lebih banyak | | Menguji keirasionalan secara numerik | setiap float rasional, jadi program hanya dapat menebak | buktikan, atau faktorkan bilangan bulat di bawah akar | | `22 / 7` sebagai `π` | 3,142857… berbeda dari π pada desimal ketiga | pakai `math.pi`, atau 355/113 bila perlu pecahan | | `sqrt` dari kuadrat sempurna | `math.sqrt(16)` memberi `4.0`, sebuah float | pakai `math.isqrt` bila ingin bilangan bulat | | Mencampur nilai eksak dan float | `sympy.sqrt(2) * 1.0` mengubah eksak menjadi hampiran | jaga simbol tetap eksak sampai akhir | Pakai `Decimal` atau `sympy` untuk ketepatan, float untuk kecepatan, dan jangan pernah memakai float untuk memutuskan apakah suatu bilangan irasional. ## Apa kesalahan umum tentang bilangan irasional? **Kesalahan paling umum tentang bilangan irasional adalah sembilan hal berikut, masing-masing dengan pernyataan yang benar dan bilangan yang menunjukkan alasannya.** | Kesalahan | Yang benar | |---|---| | ❌ $\pi=\frac{22}{7}$ | $\frac{22}{7}=3{,}142857\ldots$ adalah hampiran; $\pi=3{,}14159\ldots$ sama sekali bukan pecahan. | | ❌ $\pi=3{,}14$ | $3{,}14$ adalah $\pi$ yang dibulatkan ke dua desimal, sebuah bilangan rasional. | | ❌ Setiap akar kuadrat irasional | $\sqrt{16}=4$ dan $\sqrt{\frac14}=\frac12$ rasional. | | ❌ Jumlah dua bilangan irasional irasional | $\sqrt2+(-\sqrt2)=0$. | | ❌ Hasil kali dua bilangan irasional irasional | $\sqrt2\cdot\sqrt2=2$. | | ❌ Desimal tanpa pola yang terlihat irasional | $\frac1{97}$ baru berulang setelah 96 angka. | | ❌ Desimal dengan pola yang terlihat rasional | $0{,}101001000\ldots$ punya pola dan irasional. | | ❌ $0{,}\overline{9}$ irasional karena tidak pernah berakhir | $0{,}\overline{9}=1$ tepat. | | ❌ Kalkulator menampilkan $\pi$, jadi $\pi$ berakhir | Kalkulator menampilkan 10 sampai 16 angka pertama dari bilangan yang angkanya tidak pernah berakhir. | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: bilangan irasional sekilas - **Definisi:** bilangan real yang bukan pecahan bilangan bulat; ekspansi desimalnya tak berhingga dan tidak pernah periodik. Rasional dan irasional tidak pernah tumpang tindih. - **Akar:** akar pangkat $k$ dari bilangan bulat adalah bilangan bulat atau irasional; ia bilangan bulat tepat bila setiap eksponen prima kelipatan $k$. - **$\sqrt2$:** $a^2=2b^2$ memberi banyak faktor 2 yang genap dan ganjil sekaligus. - **Aritmetika:** rasional ditambah irasional adalah irasional; rasional bukan nol dikali irasional adalah irasional; dua bilangan irasional dapat menghasilkan rasional, seperti $(1+\sqrt2)(1-\sqrt2)=-1$. - **$\pi$ dan $e$:** irasional (Lambert, Euler) dan transenden (Lindemann, Hermite), sehingga lingkaran tidak dapat dikuadratkan. - **Hampiran:** pecahan berantai yang tidak pernah berhenti; $\frac{22}{7}$ dan $\frac{355}{113}$ adalah konvergen $\pi$; $\varphi$ paling sulit dihampiri. - **Angka:** pola tidak masalah asal tidak pernah periodik; tabel angka tidak pernah dapat membuktikan keirasionalan. - **Ukuran:** hampir setiap bilangan real irasional, namun setiap selang memuat kedua jenis. - **Kode:** float selalu berupa pecahan; jaga akar tetap eksak dengan `sympy` atau hitung angkanya dengan `Decimal`. ## Glosarium: istilah penting - **Bilangan irasional**: Bilangan real yang tidak dapat ditulis sebagai pecahan dua bilangan bulat; ekspansi desimalnya tak berhingga dan tidak pernah periodik. - **Bilangan rasional**: Bilangan yang dapat ditulis sebagai pecahan dua bilangan bulat dengan penyebut bukan nol; ekspansi desimalnya berakhir atau akhirnya berulang secara periodik. - **Ekspansi desimal**: Daftar lengkap angka sebuah bilangan di belakang koma desimal, sepanjang apa pun. - **Kuadrat sempurna**: Bilangan bulat yang merupakan kuadrat dari bilangan bulat, seperti 16 atau 49; akar kuadrat bilangan bulat positif lain irasional. - **Bukti dengan kontradiksi**: Bukti yang mengandaikan kebalikan dari klaim lalu menurunkan sesuatu yang mustahil, seperti pada bukti bahwa akar kuadrat 2 irasional. - **Tak sepadan**: Dua panjang tanpa satuan bersama yang muat bilangan bulat kali pada keduanya, seperti sisi dan diagonal sebuah persegi. - **Bentuk sekawan**: Untuk a ditambah b kali akar m, bilangan a dikurangi b kali akar m; hasil kali keduanya rasional. - **Bilangan aljabar**: Bilangan yang merupakan akar polinomial tak nol dengan koefisien bulat, seperti akar 2, yang merupakan akar dari x kuadrat dikurangi 2. - **Bilangan transenden**: Bilangan real yang bukan aljabar, seperti pi dan e; setiap bilangan transenden irasional. - **Pecahan berantai**: Pernyataan sebuah bilangan sebagai bilangan bulat ditambah satu per bilangan bulat ditambah satu per bilangan bulat lain, dan seterusnya; ia berhenti tepat bila bilangannya rasional. - **Konvergen**: Pecahan yang diperoleh dengan menghentikan pecahan berantai lebih awal, seperti 22 per 7 dan 355 per 113 untuk pi; ia hampiran terbaik untuk ukuran penyebutnya. - **Rasio emas**: Bilangan 1 ditambah akar 5, seluruhnya dibagi 2, sekitar 1,618, yang merupakan akar dari x kuadrat dikurangi x dikurangi 1 dan bilangan yang paling sulit dihampiri pecahan. - **Bilangan normal**: Bilangan yang dalam ekspansi desimalnya setiap untai k angka muncul dengan frekuensi satu per 10 pangkat k. - **Himpunan tak terhitung**: Himpunan tak berhingga yang anggotanya tidak dapat didaftar satu per satu, seperti bilangan real dan bilangan irasional. ## Pertanyaan yang sering diajukan ### Apa itu bilangan irasional? Bilangan irasional adalah bilangan real yang tidak dapat ditulis sebagai pecahan dua bilangan bulat. Ekspansi desimalnya tak berhingga dan tidak pernah periodik, seperti pada akar 2, pi, dan e. Setiap bilangan real rasional atau irasional. ### Apa saja contoh bilangan irasional? Akar 2, akar 3, akar pangkat tiga 2, pi, e, dan rasio emas adalah irasional. Akar kuadrat bilangan bulat yang bukan kuadrat sempurna selalu irasional, sedangkan akar kuadrat 16 adalah 4, yang rasional. ### Mengapa akar 2 irasional? Jika akar 2 sama dengan a per b, maka a kuadrat sama dengan 2 kali b kuadrat. Bilangan prima 2 kemudian membagi ruas kiri genap kali dan ruas kanan ganjil kali, yang mustahil untuk bilangan bulat yang sama. ### Apakah pi irasional? Ya. Lambert membuktikan pada 1761 bahwa pi irasional, dan Lindemann membuktikan pada 1882 bahwa ia bahkan transenden. Jadi pi tidak sama dengan 22 per 7 atau 3,14, yang hanyalah hampiran, dan angkanya tidak pernah menjadi periodik. ### Apakah akar 16 irasional? Bukan. Akar 16 tepat 4, sebuah bilangan bulat, sehingga rasional. Akar kuadrat bilangan bulat irasional hanya bila bilangan itu bukan kuadrat sempurna. Kuadrat sempurna seperti 1, 4, 9, 16, dan 25 punya akar bilangan bulat. ### Dapatkah jumlah dua bilangan irasional menjadi rasional? Ya. Akar 2 ditambah minus akar 2 adalah 0, dan 1 ditambah akar 2 dijumlahkan dengan 1 dikurangi akar 2 adalah 2. Kedua jumlah itu rasional. Hasil kali dua bilangan irasional juga dapat rasional. ### Apakah rasional ditambah irasional selalu irasional? Ya. Jika bilangan rasional r ditambah bilangan irasional x menghasilkan bilangan rasional s, maka x sama dengan s dikurangi r, selisih bilangan rasional, yang rasional. Itu bertentangan dengan x irasional, jadi jumlahnya pasti irasional. ### Bagaimana mengetahui apakah suatu akar irasional? Faktorkan bilangan bulat di bawah akar menjadi bilangan prima. Akar pangkat k adalah bilangan bulat tepat bila setiap eksponen kelipatan k, dan jika tidak ia irasional. Untuk 72, yaitu 2 pangkat tiga kali 3 kuadrat, eksponen 3 ganjil, sehingga akar kuadratnya irasional. ### Apa beda bilangan aljabar dan transenden? Bilangan aljabar adalah akar polinomial tak nol dengan koefisien bulat, seperti akar 2, akar dari x kuadrat dikurangi 2. Bilangan transenden bukan akar polinomial seperti itu. Pi dan e transenden, begitu pula hampir semua bilangan real. ### Mengapa lingkaran tidak dapat dikuadratkan? Mengkuadratkan lingkaran memerlukan panjang akar pi dengan hanya jangka dan penggaris. Panjang yang dapat dikonstruksi selalu aljabar, tetapi Lindemann membuktikan pada 1882 bahwa pi transenden. Jadi konstruksi itu mustahil, secerdik apa pun mencobanya. ### Apakah semua desimal tak berakhir irasional? Tidak. Desimal yang tidak pernah berakhir tetapi akhirnya berulang secara periodik rasional, seperti 0,333 dan seterusnya, yaitu sepertiga. Hanya ekspansi desimal yang tak berhingga dan tidak pernah periodik yang irasional. Bahkan 0,999 dan seterusnya berulang tepat 1. ### Berapa banyak bilangan irasional? Tak berhingga banyaknya, dan jauh lebih banyak daripada bilangan rasional. Bilangan rasional dapat didaftar satu per satu, tetapi Cantor membuktikan pada 1874 bahwa bilangan real tidak dapat, sehingga bilangan irasional tak terhitung dan hampir setiap bilangan real irasional. ### Bagaimana bilangan irasional disimpan di komputer? Bilangan irasional tidak disimpan secara eksak. Bilangan floating point selalu berupa pecahan berpenyebut pangkat 2, sehingga float seperti math.pi hanyalah bilangan rasional di dekatnya. Untuk kerja eksak pakai pustaka simbolik seperti sympy, atau hitung angka sebanyak perlu dengan decimal. ### Apa itu rasio emas? Rasio emas adalah 1 ditambah akar 5, seluruhnya dibagi 2, sekitar 1,618. Ia irasional, ia menyelesaikan x kuadrat dikurangi x dikurangi 1 sama dengan 0, dan perbandingan bilangan Fibonacci berurutan mendekatinya, lebih lambat daripada mendekati bilangan lain mana pun. --- # Rational Numbers: Fractions, Operations, Decimals and Percent Source: https://nunada.my.id/articles/rational-numbers/ Updated: 2026-10-10 ## Quick answer **A rational number is any number that can be written as a fraction $\dfrac{p}{q}$ of two integers with $q\neq0$, such as $\dfrac34$, $-\dfrac72$ or $5=\dfrac51$.** Many fractions name the same number ($\frac68=\frac34$), so you compare, add and multiply them after bringing them to a common form. The decimal expansion of a rational number either terminates ($\frac38=0.375$) or eventually repeats periodically ($\frac13=0.\overline{3}$). ### Key takeaways - A rational number is a ratio of integers; every integer is rational ($n=\frac n1$), and so is every fraction, terminating decimal and repeating decimal. - $\frac ab=\frac cd$ exactly when $ad=bc$; dividing the top and the bottom by their GCD gives the unique lowest-terms form. - To compare positive fractions, cross-multiply: $\frac ab<\frac cd$ exactly when $ad\frac14$. - **Benchmarks:** compare each with 0, $\frac12$ and 1. $\frac49<\frac12<\frac47$. - **Negative fractions:** compare the sizes and reverse, as with integers. $\frac12<\frac23$ so $-\frac12>-\frac23$. To order a list, put them on a number line or give them a common denominator. Between any two different rational numbers lies another: their average $\dfrac{1}{2}\left(\frac ab+\frac cd\right)$. So there is no "next" fraction after $\frac12$, and the rational numbers fill the line without gaps you could ever point to, though $\sqrt2$ shows that the line still holds more: see the [number line and density](https://nunada.my.id/articles/real-numbers/#number-line-density) in the article on real numbers. Compare any two below. ## How do you add and subtract fractions? **To add or subtract fractions, rewrite them over a common denominator, then add or subtract the numerators and keep the denominator: $\frac ac+\frac bc=\frac{a+b}{c}$.** You can only add parts that are the same size. The best common denominator is the [least common multiple](https://nunada.my.id/articles/integers/#gcd-lcm) of the two denominators. For $\frac23+\frac34$ it is 12: $\dfrac23+\dfrac34=\dfrac{8}{12}+\dfrac{9}{12}=\dfrac{17}{12}=1\dfrac{5}{12}$. For a subtraction, $\dfrac56-\dfrac14=\dfrac{10}{12}-\dfrac{3}{12}=\dfrac{7}{12}$. If you use $b\cdot d$ instead of the least common multiple the answer is the same, but the numbers are larger and the result needs simplifying afterward. **Never add the denominators.** $\frac12+\frac13$ is not $\frac25$: the denominators name the size of the pieces, and halves and thirds are different sizes. The right answer is $\frac36+\frac26=\frac56$. A check is that $\frac25=0.4$ is less than $\frac12$, but a sum of two positive numbers is larger than each of them. **Mixed numbers.** Either add the whole parts and the fraction parts separately, or turn both into improper fractions first. For $2\frac13+1\frac12$: $2+1=3$ and $\frac13+\frac12=\frac56$, so $3\frac56$. **Negative fractions** follow the sign rules of the integers: $\frac12-\frac34=\frac24-\frac34=-\frac14$. Try your own pair below; it shows each line of the working. ## How do you multiply and divide fractions? **To multiply fractions, multiply the numerators and multiply the denominators: $\frac ab\cdot\frac cd=\frac{ac}{bd}$; to divide, multiply by the reciprocal of the divisor: $\frac ab\div\frac cd=\frac ab\cdot\frac dc$.** No common denominator is needed for either. Multiplying: $\dfrac34\cdot\dfrac23=\dfrac{6}{12}=\dfrac12$. It is quicker to cancel first, because a factor on the top of one fraction can cancel with a factor on the bottom of the other: the 3 on the top cancels with the 3 on the bottom, and the 2 on the top with half of the 4, so $\frac34\cdot\frac23=\frac{1\cdot1}{2\cdot1}=\frac12$. The word "of" means times: $\frac25$ of 30 is $\frac25\cdot30=12$. **Why dividing is multiplying by the reciprocal.** Dividing asks how many fit. How many halves fit in 3? $3\div\frac12=6$, which is $3\cdot2$. In general dividing by $\frac cd$ is the same as multiplying by $\frac dc$, because multiplying by a number and then by its reciprocal gets you back where you started. Example: $\dfrac34\div\dfrac9{10}=\dfrac34\cdot\dfrac{10}{9}=\dfrac{30}{36}=\dfrac56$. The **reciprocal** of $\frac cd$ is $\frac dc$, and the reciprocal of an integer $n$ is $\frac1n$. Zero has no reciprocal, so you cannot divide by 0, and dividing by the fraction $\frac03$ is just as forbidden. **Signs** follow the integers: same signs give a positive answer, different signs a negative one, so $\left(-\frac12\right)\cdot\left(-\frac23\right)=\frac13$. Negative exponents are reciprocals as well, since $2^{-3}=\frac18$, as the section on [zero, negative and fractional exponents](https://nunada.my.id/articles/exponents-and-radicals/#zero-negative-fractional) shows. Try the calculator above with the other two operations. ## How do you convert between mixed numbers and improper fractions? **To turn an improper fraction into a mixed number, divide the top by the bottom: the quotient is the whole part and the remainder is the new numerator over the same denominator; to go back, multiply the whole part by the denominator and add the numerator.** The only tool is division with remainder, the same one used in the [integers article](https://nunada.my.id/articles/integers/#remainders). | Direction | Steps | Example | |---|---|---| | improper → mixed | $17\div5=3$ remainder $2$ | $\frac{17}{5}=3\frac25$ | | mixed → improper | $3\cdot5+2=17$, keep the denominator | $3\frac25=\frac{17}{5}$ | | negative improper → mixed | convert the size, then put the sign in front | $-\frac72=-3\frac12$ | In $-3\frac12$ the minus applies to the whole number: it means $-\left(3+\frac12\right)=-3.5$, not $-3+\frac12$. Mixed numbers are fine for reading a quantity, such as $2\frac12$ cups, but improper fractions are easier to calculate with, so convert before you multiply or divide. ## How do fractions become decimals and percentages? **To turn a fraction into a decimal, divide the top by the bottom; the decimal terminates exactly when the denominator, in lowest terms, has no prime factor other than 2 and 5, and otherwise it eventually repeats periodically.** Ten is $2\cdot5$, so only denominators built from 2s and 5s fit into a power of ten. | Fraction | Decimal | Why | |---|---|---| | $\frac38$ | $0.375$ | $8=2^3$, terminates after 3 digits | | $\frac{7}{20}$ | $0.35$ | $20=2^2\cdot5$, terminates after 2 digits | | $\frac13$ | $0.\overline{3}$ | 3 is neither 2 nor 5 | | $\frac{5}{12}$ | $0.41\overline{6}$ | $12=2^2\cdot3$: 2 digits, then 6 repeats | | $\frac17$ | $0.\overline{142857}$ | a block of 6 digits repeats | Two numbers describe the repeat. The digits before it number $\max(x,y)$ when the denominator is $2^x\cdot5^y\cdot q$ with $q$ coprime to 10 (that is why $\frac5{12}$ has 2). The block is as long as the number of 10s you need to multiply to get a remainder of 1 modulo $q$: 1 for $\frac13$, 6 for $\frac17$ and for $\frac1{13}$, 16 for $\frac1{17}$, 96 for $\frac1{97}$. It always eventually repeats because long division has fewer than $q$ possible remainders, so one must come back. The proof, and how to turn a repeating decimal back into a fraction, are in the [rational numbers section of the real numbers article](https://nunada.my.id/articles/real-numbers/#rational-numbers); the same conversion is a sum of a [geometric series](https://nunada.my.id/articles/geometric-sequences-and-series/#infinite-geometric-series). **Percent** means "per hundred": $p\%=\frac{p}{100}$. To convert a fraction, divide to get the decimal and shift the point two places: $\frac38=0.375=37.5\%$. To convert back, $25\%=\frac{25}{100}=\frac14$. Percentages apply to a base. A 200 dollar jacket with 15% off costs 85% of 200, which is $0.85\cdot200=170$ dollars. A rise of 20% followed by a fall of 20% does not return to the start, because the second percentage is of a larger number: $100\to120\to96$. Type any fraction below to see its decimal and why it looks that way. The same rule holds in other bases: in base 2 only denominators that are powers of 2 terminate, as the article on [binary numbers](https://nunada.my.id/articles/binary-numbers/#binary-fractions) shows. ## How do ratios and proportions use rational numbers? **A ratio $a:b$ compares two quantities and is the fraction $\frac ab$; a proportion says two ratios are equal, $\frac ab=\frac cd$, and is solved by cross-multiplying: $ad=bc$.** Problems that scale a recipe, convert a map distance or price a quantity are all proportions. | Situation | Setup | Answer | |---|---|---| | A recipe uses 3 cups of flour for 12 cookies. How much for 20 cookies? | $\frac{3}{12}=\frac{x}{20}$, so $12x=60$ | $x=5$ cups | | 5 kg of rice cost 20 dollars. How much do 3 kg cost? | $\frac{20}{5}=\frac{y}{3}$, so $5y=60$ | $y=12$ dollars | | A class has 30 students and $\frac25$ of them walk to school. How many walk? | $\frac25\cdot30$ | 12 students | | A map scale is 1:50000. A road is 4 cm on the map. | $4\cdot50000=200000$ cm | 2 km | Two habits prevent most mistakes. Keep the same quantity on the same level of every fraction, flour over cookies on both sides. And check that the answer is sensible: 20 cookies need more flour than 12, so 5 cups is plausible but 2 cups is not. A unit rate is the ratio per one: 20 dollars for 5 kg is 4 dollars per kilogram, and then any quantity is the unit rate times the amount. ## How do you work with fractions in Python and JavaScript? **Python has an exact fraction type, `fractions.Fraction`, that keeps numerator and denominator as integers; JavaScript has none, and its `/` always produces a binary floating-point number.** Floats store only the nearest binary value, so $\frac13$ and even $\frac1{10}$ cannot be held exactly: see the [floating-point section of the real numbers article](https://nunada.my.id/articles/real-numbers/#real-numbers-in-code). ```python >>> from fractions import Fraction >>> Fraction(6, 8) # reduced automatically Fraction(3, 4) >>> Fraction(1, 3) + Fraction(1, 6) Fraction(1, 2) >>> Fraction(3, 4) / Fraction(9, 10) Fraction(5, 6) >>> Fraction(-7, 2).numerator, Fraction(-7, 2).denominator (-7, 2) >>> float(Fraction(1, 3)) 0.3333333333333333 >>> 0.1 + 0.2 == 0.3 False >>> Fraction(1, 10) + Fraction(2, 10) == Fraction(3, 10) True >>> Fraction(0.1) # the float 0.1 is not one tenth Fraction(3602879701896397, 36028797018963968) >>> Fraction('0.1') # the text 0.1 is Fraction(1, 10) >>> Fraction(1, 0) ZeroDivisionError: Fraction(1, 0) ``` ```javascript 0.1 + 0.2 // 0.30000000000000004 3 / 4 // 0.75: JavaScript has no integer division const gcd = (a, b) => (b === 0n ? (a < 0n ? -a : a) : gcd(b, a % b)) const frac = (n, d) => { const g = gcd(n, d) return d < 0n ? [-n / g, -d / g] : [n / g, d / g] } const add = ([a, b], [c, d]) => frac(a * d + c * b, b * d) add(frac(1n, 3n), frac(1n, 6n)) // [1n, 2n] ``` ```cpp #include #include using namespace std; int gcd(int a, int b) { return b == 0 ? (a < 0 ? -a : a) : gcd(b, a % b); } void show(int n, int d) { // a fraction in lowest terms if (d == 0) { cout << "undefined: the denominator is 0" << endl; return; } if (d < 0) { n = -n; d = -d; } int g = gcd(n, d); cout << n / g << "/" << d / g << endl; } int main() { show(6, 8); // 3/4: reduced show(1 * 6 + 1 * 3, 3 * 6); // 1/3 + 1/6 = 1/2 show(3 * 10, 4 * 9); // (3/4) / (9/10) = 5/6 show(-7, 2); show(1, 0); printf("%.16f\n", 1.0 / 3); // float(1/3) cout << (0.1 + 0.2 == 0.3) << endl; // 0: the floats are not equal cout << (1 * 10 + 2 * 10 == 3 * 10) << endl; // 1: with whole numbers (tenths) they are printf("%.20f\n", 0.1); // the float 0.1 is not one tenth return 0; } /* output: 3/4 1/2 5/6 -7/2 undefined: the denominator is 0 0.3333333333333333 0 1 0.10000000000000000555 */ ``` The pitfalls, in order of how often they bite: | Pitfall | What happens | What to do | |---|---|---| | `3 / 4` in Python 3 | 0.75, a float; `3 // 4` is 0 | use `Fraction(3, 4)` for an exact value | | `Fraction(0.1)` | the exact value of the float, not 1/10 | pass a string, `Fraction('0.1')`, or two integers | | Money in floats | `0.1 + 0.2` is not `0.3` | store whole cents as integers, or use `decimal.Decimal` | | Comparing floats | `==` fails by a hair | compare with a tolerance, or compare Fractions | | `Fraction(1, 0)` | ZeroDivisionError | check the denominator first | | Fractions in JavaScript | no built-in type | keep two `BigInt`s and reduce with the GCD, as above | | Huge denominators | repeated addition can make numbers grow | reduce after every step; Fraction does it for you | Use `Fraction` when you need an exact answer from exact input, and floats when speed matters and a tiny rounding error is harmless. ## Where do fractions come from? **Fractions are among the oldest mathematics: the Egyptians used them around 1550 BCE, and our way of writing them was assembled over about three thousand years.** - **Egypt.** The Rhind Papyrus writes almost every fraction as a sum of different unit fractions (numerator 1): $\frac25=\frac13+\frac1{15}$. Only a few, such as $\frac23$, had a symbol of their own. - **India and the Arab world.** Fractions were written with one number above the other. Arab mathematicians added the dividing bar. - **Europe.** Fibonacci's Liber Abaci (1202) used the fraction bar and helped spread the Hindu-Arabic numerals in Europe. - **Decimals.** Simon Stevin's De Thiende (1585) argued for writing fractions in tenths, hundredths and thousandths, which is the decimal notation we use. Today the same numbers show up as fractions in a recipe, as decimals on a calculator, as percentages in a shop and as ratios on a map: one idea with four faces. ## What are the common mistakes with fractions? **The most common mistakes with fractions are the nine below, each with the correct statement and a number that shows why.** | Mistake | Correct | |---|---| | ❌ $\frac12+\frac13=\frac25$ | $\frac12+\frac13=\frac56$. Never add the denominators. | | ❌ $\frac{2+3}{2+4}=\frac34$ | Terms do not cancel: $\frac{5}{6}$ is already simplest. | | ❌ $\frac13<\frac14$ because $3<4$ | A larger denominator means smaller parts: $\frac13>\frac14$. | | ❌ $\frac34\div\frac9{10}=\frac{3\cdot9}{4\cdot10}$ | Flip the divisor: $\frac34\cdot\frac{10}{9}=\frac56$. | | ❌ $\frac{a}{b}\cdot\frac{c}{d}=\frac{ac}{b+d}$ | Multiply the bottoms too: $\frac{ac}{bd}$. | | ❌ $-\frac{3}{4}=\frac{-3}{-4}$ | $\frac{-3}{-4}=+\frac34$. Move one minus sign only. | | ❌ $\frac50=0$ | A denominator of 0 is not allowed: $\frac50$ is not a number. | | ❌ $3\frac12=3\cdot\frac12$ | $3\frac12=3+\frac12=\frac72$. | | ❌ $0.\overline{3}\neq\frac13$ because its expansion is infinite | $0.\overline{3}=\frac13$ exactly: a repeating decimal is a fraction. | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: rational numbers at a glance - **Rational:** $\frac pq$ with integers $p,q$ and $q\neq0$; every integer is rational; a number has many fractions, one in lowest terms. - **Equal fractions:** $\frac ab=\frac cd\iff ad=bc$; divide top and bottom by the GCD to simplify; cancel factors, never terms. - **Compare:** cross-multiply; the larger denominator makes the smaller piece; between two rationals lies their average. - **Add and subtract:** common denominator (the LCM), then combine the tops; never add the denominators. - **Multiply and divide:** tops times tops, bottoms times bottoms; divide by flipping the second fraction; zero has no reciprocal. - **Mixed numbers:** divide with remainder to convert; $-3\frac12=-\left(3+\frac12\right)$. - **Decimals:** a lowest-terms fraction terminates exactly when the denominator has only 2s and 5s; otherwise it eventually repeats periodically; $p\%=\frac p{100}$. - **Code:** use `Fraction` for exactness in Python; floats cannot hold $\frac1{10}$. ## Glossary: key terms - **Rational number**: A number that can be written as a fraction of two integers with a non-zero denominator, such as 3 over 4 or minus 7 over 2. - **Fraction**: A way of writing a number as a numerator over a denominator, which names how many equal parts are taken out of how many. - **Numerator**: The top number of a fraction, which says how many parts are taken. - **Denominator**: The bottom number of a fraction, which says how many equal parts the whole is cut into and can never be zero. - **Equivalent fractions**: Different fractions that name the same number, such as 1 over 2 and 2 over 4, found by multiplying or dividing the top and bottom by the same number. - **Lowest terms**: A fraction whose numerator and denominator share no factor except 1, found by dividing both by their greatest common divisor. - **Proper and improper fraction**: A proper fraction is smaller than 1 in size, like 3 over 4; an improper fraction is 1 or more in size, like 17 over 5. - **Mixed number**: A whole number together with a proper fraction, such as 3 and 2 over 5, which means 3 plus 2 over 5. - **Reciprocal**: The fraction turned upside down; a number times its reciprocal is 1, and zero has no reciprocal. - **Common denominator**: A denominator that two fractions are both rewritten over so that they can be added or compared; the least common multiple of the denominators is the smallest choice. - **Terminating decimal**: A decimal expansion with finitely many digits, such as 0.375; a fraction in lowest terms has one exactly when its denominator has only the prime factors 2 and 5. - **Repeating decimal**: A decimal expansion that eventually repeats periodically: from some digit onward a block of digits repeats without end, such as 0.333 and so on for 1 over 3. - **Percent**: A fraction with denominator 100, so that 25 percent means 25 over 100, which is 1 over 4. - **Ratio**: A comparison of two quantities written a to b or as the fraction a over b. ## Frequently asked questions ### What is a rational number? A rational number is any number that can be written as a fraction p over q, where p and q are integers and q is not zero. Examples are 3 over 4, minus 7 over 2, and every integer, since 5 equals 5 over 1. ### Is every integer a rational number? Yes. Any integer n can be written as n over 1, which is a fraction of two integers with a non-zero denominator. So the integers are a part of the rational numbers, and the rational numbers add the fractions between them. ### What is the difference between a fraction and a rational number? A fraction is a way of writing, a numerator over a denominator, while a rational number is the value that writing names. Many fractions, such as 1 over 2, 2 over 4 and 50 over 100, name the same rational number. ### How do you simplify a fraction? Divide the numerator and the denominator by their greatest common divisor. For 84 over 126 the greatest common divisor is 42, so the fraction simplifies to 2 over 3. You may also cancel common factors step by step, but never common terms. ### How do you compare two fractions? Cross-multiply. To compare a over b with c over d, when b and d are positive, compare a times d with c times b. For 3 over 5 and 5 over 8 that is 24 against 25, so 3 over 5 is smaller. You can also use a common denominator. ### How do you add fractions with different denominators? Rewrite both over a common denominator, preferably the least common multiple, then add the numerators and keep the denominator. For 2 over 3 plus 3 over 4 use 12: 8 over 12 plus 9 over 12 is 17 over 12. Never add the denominators. ### Why do you flip the second fraction when you divide? Because dividing by a number is the same as multiplying by its reciprocal. Dividing asks how many fit: three divided by one half is 6, which is 3 times 2. In general a over b divided by c over d equals a over b times d over c. ### How do you convert an improper fraction to a mixed number? Divide the numerator by the denominator. The quotient is the whole part and the remainder becomes the new numerator over the same denominator. For 17 over 5, 17 divided by 5 is 3 remainder 2, so it is 3 and 2 over 5. ### How do you turn a fraction into a decimal? Divide the numerator by the denominator, by long division or a calculator. For 3 over 8 that gives 0.375. If the division never terminates, the digits eventually repeat periodically, as 1 over 3 gives 0.333 and so on, written with a bar over the repeating digit. ### When does a fraction give a terminating decimal? When, in lowest terms, its denominator has no prime factor other than 2 and 5, because ten is 2 times 5. So 3 over 8 and 7 over 20 terminate, while 1 over 3, 1 over 6 and 5 over 12 repeat, since their denominators contain 3. ### Is 0.333 repeating the same as one third? Yes, exactly. A repeating decimal is a different way of writing a fraction. If x is 0.333 and so on, then 10x minus x is 3, so 9x is 3 and x is one third. Three decimal places only approximate it; the infinite repeat equals it. ### How do you convert a fraction to a percentage? Convert it to a decimal and multiply by 100, or rewrite it with denominator 100. For 3 over 8 the decimal is 0.375, so it is 37.5 percent. For 3 over 20, multiplying top and bottom by 5 gives 15 over 100, which is 15 percent. ### Why can a denominator not be zero? A fraction a over b means the number that gives a when multiplied by b. With b equal to 0, nothing times 0 gives a when a is not 0, and when a is also 0 every number would work. So division by zero has no single answer and is undefined. ### How do you use fractions exactly in Python? Use the Fraction class from the fractions module. It keeps integers for the top and bottom, reduces automatically, and adds, subtracts, multiplies and divides exactly. Pass a string such as 0.1, because Fraction of the float 0.1 holds the float’s binary error. --- # Bilangan Rasional: Pecahan, Operasi, Desimal, dan Persen Source: https://nunada.my.id/artikel/bilangan-rasional/ Updated: 2026-10-10 ## Jawaban singkat **Bilangan rasional adalah bilangan yang dapat ditulis sebagai pecahan $\dfrac{p}{q}$ dari dua bilangan bulat dengan $q\neq0$, seperti $\dfrac34$, $-\dfrac72$, atau $5=\dfrac51$.** Banyak pecahan menamai bilangan yang sama ($\frac68=\frac34$), sehingga kamu membandingkan, menjumlahkan, dan mengalikannya setelah membawanya ke bentuk yang sama. Ekspansi desimal bilangan rasional berakhir ($\frac38=0{,}375$) atau akhirnya berulang secara periodik ($\frac13=0{,}\overline{3}$). ### Poin penting - Bilangan rasional adalah perbandingan bilangan bulat; setiap bilangan bulat adalah rasional ($n=\frac n1$), begitu pula setiap pecahan, desimal berakhir, dan desimal berulang. - $\frac ab=\frac cd$ tepat bila $ad=bc$; membagi pembilang dan penyebut dengan FPB-nya menghasilkan bentuk paling sederhana yang tunggal. - Untuk membandingkan pecahan positif, kalikan silang: $\frac ab<\frac cd$ tepat bila $ad\frac14$. - **Patokan:** bandingkan masing-masing dengan 0, $\frac12$, dan 1. $\frac49<\frac12<\frac47$. - **Pecahan negatif:** bandingkan ukurannya lalu balik, seperti pada bilangan bulat. $\frac12<\frac23$ sehingga $-\frac12>-\frac23$. Untuk mengurutkan daftar, letakkan pada garis bilangan atau beri penyebut yang sama. Di antara dua bilangan rasional berbeda mana pun terdapat bilangan rasional lain: rata-ratanya $\dfrac{1}{2}\left(\frac ab+\frac cd\right)$. Jadi tidak ada pecahan "berikutnya" setelah $\frac12$, dan bilangan rasional memenuhi garis tanpa celah yang dapat kamu tunjuk, walaupun $\sqrt2$ menunjukkan bahwa garis itu masih memuat lebih banyak: lihat [garis bilangan dan kerapatan](https://nunada.my.id/artikel/bilangan-real/#number-line-density) pada artikel bilangan real. Bandingkan dua pecahan apa pun di bawah. ## Bagaimana menjumlahkan dan mengurangkan pecahan? **Untuk menjumlahkan atau mengurangkan pecahan, tulis keduanya di atas penyebut sama, lalu jumlahkan atau kurangkan pembilangnya dan pertahankan penyebutnya: $\frac ac+\frac bc=\frac{a+b}{c}$.** Kamu hanya dapat menjumlahkan bagian yang sama besar. Penyebut sama yang terbaik adalah [kelipatan persekutuan terkecil](https://nunada.my.id/artikel/bilangan-bulat/#gcd-lcm) dari kedua penyebut. Untuk $\frac23+\frac34$ nilainya 12: $\dfrac23+\dfrac34=\dfrac{8}{12}+\dfrac{9}{12}=\dfrac{17}{12}=1\dfrac{5}{12}$. Untuk pengurangan, $\dfrac56-\dfrac14=\dfrac{10}{12}-\dfrac{3}{12}=\dfrac{7}{12}$. Jika kamu memakai $b\cdot d$ sebagai ganti kelipatan persekutuan terkecil, jawabannya sama, tetapi bilangannya lebih besar dan hasilnya perlu disederhanakan sesudahnya. **Jangan pernah menjumlahkan penyebutnya.** $\frac12+\frac13$ bukan $\frac25$: penyebut menamai ukuran potongan, dan setengah serta sepertiga berukuran berbeda. Jawaban yang benar adalah $\frac36+\frac26=\frac56$. Pemeriksaannya, $\frac25=0{,}4$ kurang dari $\frac12$, padahal jumlah dua bilangan positif lebih besar daripada masing-masing. **Bilangan campuran.** Jumlahkan bagian bulat dan bagian pecahan secara terpisah, atau ubah keduanya menjadi pecahan tak wajar lebih dulu. Untuk $2\frac13+1\frac12$: $2+1=3$ dan $\frac13+\frac12=\frac56$, sehingga $3\frac56$. **Pecahan negatif** mengikuti aturan tanda bilangan bulat: $\frac12-\frac34=\frac24-\frac34=-\frac14$. Coba pasangan buatanmu sendiri di bawah; alat itu menampilkan tiap baris langkahnya. ## Bagaimana mengalikan dan membagi pecahan? **Untuk mengalikan pecahan, kalikan pembilangnya dan kalikan penyebutnya: $\frac ab\cdot\frac cd=\frac{ac}{bd}$; untuk membagi, kalikan dengan kebalikan pembagi: $\frac ab\div\frac cd=\frac ab\cdot\frac dc$.** Tidak perlu penyebut sama untuk keduanya. Perkalian: $\dfrac34\cdot\dfrac23=\dfrac{6}{12}=\dfrac12$. Lebih cepat bila mencoret lebih dulu, karena faktor di pembilang satu pecahan dapat dicoret dengan faktor di penyebut pecahan lain: angka 3 di atas dicoret dengan angka 3 di bawah, dan angka 2 di atas dengan setengah dari 4, sehingga $\frac34\cdot\frac23=\frac{1\cdot1}{2\cdot1}=\frac12$. Kata "dari" berarti kali: $\frac25$ dari 30 adalah $\frac25\cdot30=12$. **Mengapa membagi sama dengan mengalikan kebalikan.** Pembagian menanyakan berapa yang muat. Berapa setengah yang muat dalam 3? $3\div\frac12=6$, yaitu $3\cdot2$. Umumnya membagi dengan $\frac cd$ sama dengan mengalikan dengan $\frac dc$, karena mengalikan dengan sebuah bilangan lalu dengan kebalikannya mengembalikanmu ke awal. Contoh: $\dfrac34\div\dfrac9{10}=\dfrac34\cdot\dfrac{10}{9}=\dfrac{30}{36}=\dfrac56$. **Kebalikan** dari $\frac cd$ adalah $\frac dc$, dan kebalikan bilangan bulat $n$ adalah $\frac1n$. Nol tidak punya kebalikan, sehingga kamu tidak dapat membagi dengan 0, dan membagi dengan pecahan $\frac03$ sama terlarangnya. **Tanda** mengikuti bilangan bulat: tanda sama memberi jawaban positif, tanda berbeda negatif, sehingga $\left(-\frac12\right)\cdot\left(-\frac23\right)=\frac13$. Eksponen negatif juga kebalikan, sebab $2^{-3}=\frac18$, seperti ditunjukkan bagian tentang [eksponen nol, negatif, dan pecahan](https://nunada.my.id/artikel/eksponen-dan-akar/#zero-negative-fractional). Coba kalkulator di atas dengan dua operasi lainnya. ## Bagaimana mengubah bilangan campuran dan pecahan tak wajar? **Untuk mengubah pecahan tak wajar menjadi bilangan campuran, bagi pembilang dengan penyebut: hasil bagi adalah bagian bulat dan sisanya adalah pembilang baru di atas penyebut yang sama; untuk kembali, kalikan bagian bulat dengan penyebut lalu tambahkan pembilang.** Satu-satunya alat adalah pembagian bersisa, yang sama dengan yang dipakai pada [artikel bilangan bulat](https://nunada.my.id/artikel/bilangan-bulat/#remainders). | Arah | Langkah | Contoh | |---|---|---| | tak wajar → campuran | $17\div5=3$ sisa $2$ | $\frac{17}{5}=3\frac25$ | | campuran → tak wajar | $3\cdot5+2=17$, pertahankan penyebut | $3\frac25=\frac{17}{5}$ | | tak wajar negatif → campuran | ubah ukurannya, lalu taruh tanda di depan | $-\frac72=-3\frac12$ | Pada $-3\frac12$ tanda minus berlaku untuk seluruh bilangan: artinya $-\left(3+\frac12\right)=-3{,}5$, bukan $-3+\frac12$. Bilangan campuran baik untuk membaca suatu besaran, seperti $2\frac12$ cangkir, tetapi pecahan tak wajar lebih mudah dihitung, sehingga ubah dulu sebelum mengalikan atau membagi. ## Bagaimana pecahan menjadi desimal dan persen? **Untuk mengubah pecahan menjadi desimal, bagi pembilang dengan penyebut; desimalnya berakhir tepat bila penyebut, dalam bentuk paling sederhana, tidak punya faktor prima selain 2 dan 5, dan jika tidak ia akhirnya berulang secara periodik.** Sepuluh adalah $2\cdot5$, sehingga hanya penyebut yang tersusun dari 2 dan 5 yang muat dalam pangkat sepuluh. | Pecahan | Desimal | Alasan | |---|---|---| | $\frac38$ | $0{,}375$ | $8=2^3$, berakhir setelah 3 angka | | $\frac{7}{20}$ | $0{,}35$ | $20=2^2\cdot5$, berakhir setelah 2 angka | | $\frac13$ | $0{,}\overline{3}$ | 3 bukan 2 dan bukan 5 | | $\frac{5}{12}$ | $0{,}41\overline{6}$ | $12=2^2\cdot3$: 2 angka, lalu 6 berulang | | $\frac17$ | $0{,}\overline{142857}$ | blok 6 angka berulang | Dua bilangan menggambarkan pengulangan itu. Banyak angka sebelum pengulangan adalah $\max(x,y)$ bila penyebutnya $2^x\cdot5^y\cdot q$ dengan $q$ saling prima dengan 10 (itulah sebabnya $\frac5{12}$ punya 2). Panjang blok sama dengan banyaknya faktor 10 yang diperlukan agar sisa menjadi 1 modulo $q$: 1 untuk $\frac13$, 6 untuk $\frac17$ dan $\frac1{13}$, 16 untuk $\frac1{17}$, 96 untuk $\frac1{97}$. Pengulangan selalu terjadi karena pembagian bersusun punya kurang dari $q$ kemungkinan sisa, sehingga ada yang harus kembali. Buktinya, dan cara mengubah desimal berulang kembali menjadi pecahan, ada pada [bagian bilangan rasional di artikel bilangan real](https://nunada.my.id/artikel/bilangan-real/#rational-numbers); pengubahan yang sama adalah jumlah [deret geometri](https://nunada.my.id/artikel/barisan-dan-deret-geometri/#infinite-geometric-series). **Persen** berarti "per seratus": $p\%=\frac{p}{100}$. Untuk mengubah pecahan, bagi untuk mendapat desimal lalu geser koma dua tempat: $\frac38=0{,}375=37{,}5\%$. Untuk kembali, $25\%=\frac{25}{100}=\frac14$. Persentase berlaku pada suatu dasar. Jaket Rp200.000 yang didiskon 15% berharga 85% dari 200.000, yaitu $0{,}85\cdot200000=170000$ rupiah, atau Rp170.000. Kenaikan 20% yang diikuti penurunan 20% tidak kembali ke awal, karena persentase kedua dihitung dari bilangan yang lebih besar: $100\to120\to96$. Ketik pecahan apa pun di bawah untuk melihat desimalnya dan mengapa tampak demikian. Aturan yang sama berlaku pada basis lain: dalam basis 2 hanya penyebut berupa pangkat 2 yang berakhir, seperti ditunjukkan artikel [bilangan biner](https://nunada.my.id/artikel/bilangan-biner/#binary-fractions). ## Bagaimana perbandingan dan proporsi memakai bilangan rasional? **Rasio $a:b$ membandingkan dua besaran dan merupakan pecahan $\frac ab$; proporsi menyatakan dua rasio sama, $\frac ab=\frac cd$, dan diselesaikan dengan perkalian silang: $ad=bc$.** Soal yang menskalakan resep, mengubah jarak peta, atau menghargai suatu jumlah semuanya adalah proporsi. | Situasi | Pemodelan | Jawaban | |---|---|---| | Sebuah resep memakai 3 cangkir tepung untuk 12 kue. Berapa untuk 20 kue? | $\frac{3}{12}=\frac{x}{20}$, sehingga $12x=60$ | $x=5$ cangkir | | 5 kg beras berharga Rp70.000. Berapa harga 3 kg? | $\frac{70000}{5}=\frac{y}{3}$, sehingga $5y=210000$ | $y=42000$ rupiah, atau Rp42.000 | | Satu kelas berisi 30 siswa dan $\frac25$ di antaranya berjalan kaki ke sekolah. Berapa yang berjalan kaki? | $\frac25\cdot30$ | 12 siswa | | Skala peta 1:50000. Sebuah jalan sepanjang 4 cm di peta. | $4\cdot50000=200000$ cm | 2 km | Dua kebiasaan mencegah sebagian besar kesalahan. Jaga besaran yang sama pada tingkat yang sama di setiap pecahan, tepung di atas kue di kedua ruas. Dan periksa apakah jawabannya masuk akal: 20 kue memerlukan lebih banyak tepung daripada 12 kue, sehingga 5 cangkir masuk akal tetapi 2 cangkir tidak. Laju satuan adalah rasio per satu: Rp70.000 untuk 5 kg adalah Rp14.000 per kilogram, dan setiap jumlah adalah laju satuan dikali banyaknya. ## Bagaimana mengolah pecahan di Python dan JavaScript? **Python punya tipe pecahan eksak, `fractions.Fraction`, yang menyimpan pembilang dan penyebut sebagai bilangan bulat; JavaScript tidak punya, dan `/`-nya selalu menghasilkan bilangan floating point biner.** Float hanya menyimpan nilai biner terdekat, sehingga $\frac13$ dan bahkan $\frac1{10}$ tidak dapat disimpan dengan tepat: lihat [bagian floating point pada artikel bilangan real](https://nunada.my.id/artikel/bilangan-real/#real-numbers-in-code). ```python >>> from fractions import Fraction >>> Fraction(6, 8) # reduced automatically Fraction(3, 4) >>> Fraction(1, 3) + Fraction(1, 6) Fraction(1, 2) >>> Fraction(3, 4) / Fraction(9, 10) Fraction(5, 6) >>> Fraction(-7, 2).numerator, Fraction(-7, 2).denominator (-7, 2) >>> float(Fraction(1, 3)) 0.3333333333333333 >>> 0.1 + 0.2 == 0.3 False >>> Fraction(1, 10) + Fraction(2, 10) == Fraction(3, 10) True >>> Fraction(0.1) # the float 0.1 is not one tenth Fraction(3602879701896397, 36028797018963968) >>> Fraction('0.1') # the text 0.1 is Fraction(1, 10) >>> Fraction(1, 0) ZeroDivisionError: Fraction(1, 0) ``` ```javascript 0.1 + 0.2 // 0.30000000000000004 3 / 4 // 0.75: JavaScript has no integer division const gcd = (a, b) => (b === 0n ? (a < 0n ? -a : a) : gcd(b, a % b)) const frac = (n, d) => { const g = gcd(n, d) return d < 0n ? [-n / g, -d / g] : [n / g, d / g] } const add = ([a, b], [c, d]) => frac(a * d + c * b, b * d) add(frac(1n, 3n), frac(1n, 6n)) // [1n, 2n] ``` ```cpp #include #include using namespace std; int gcd(int a, int b) { return b == 0 ? (a < 0 ? -a : a) : gcd(b, a % b); } void show(int n, int d) { // a fraction in lowest terms if (d == 0) { cout << "undefined: the denominator is 0" << endl; return; } if (d < 0) { n = -n; d = -d; } int g = gcd(n, d); cout << n / g << "/" << d / g << endl; } int main() { show(6, 8); // 3/4: reduced show(1 * 6 + 1 * 3, 3 * 6); // 1/3 + 1/6 = 1/2 show(3 * 10, 4 * 9); // (3/4) / (9/10) = 5/6 show(-7, 2); show(1, 0); printf("%.16f\n", 1.0 / 3); // float(1/3) cout << (0.1 + 0.2 == 0.3) << endl; // 0: the floats are not equal cout << (1 * 10 + 2 * 10 == 3 * 10) << endl; // 1: with whole numbers (tenths) they are printf("%.20f\n", 0.1); // the float 0.1 is not one tenth return 0; } /* output: 3/4 1/2 5/6 -7/2 undefined: the denominator is 0 0.3333333333333333 0 1 0.10000000000000000555 */ ``` Jebakannya, berurutan dari yang paling sering menggigit: | Jebakan | Yang terjadi | Yang sebaiknya dilakukan | |---|---|---| | `3 / 4` di Python 3 | 0,75, sebuah float; `3 // 4` adalah 0 | pakai `Fraction(3, 4)` untuk nilai eksak | | `Fraction(0.1)` | nilai eksak dari float, bukan 1/10 | berikan string, `Fraction('0.1')`, atau dua bilangan bulat | | Uang dalam float | `0.1 + 0.2` bukan `0.3` | simpan sen utuh sebagai bilangan bulat, atau pakai `decimal.Decimal` | | Membandingkan float | `==` gagal setipis rambut | bandingkan dengan toleransi, atau bandingkan Fraction | | `Fraction(1, 0)` | ZeroDivisionError | periksa penyebut lebih dulu | | Pecahan di JavaScript | tidak ada tipe bawaan | simpan dua `BigInt` dan sederhanakan dengan FPB, seperti di atas | | Penyebut sangat besar | penjumlahan berulang dapat membuat bilangan membesar | sederhanakan setiap langkah; Fraction melakukannya untukmu | Pakai `Fraction` bila kamu memerlukan jawaban eksak dari masukan eksak, dan float bila kecepatan penting dan galat pembulatan kecil tidak berbahaya. ## Dari mana asal pecahan? **Pecahan termasuk matematika tertua: orang Mesir memakainya sekitar 1550 SM, dan cara kita menuliskannya terbentuk selama sekitar tiga ribu tahun.** - **Mesir.** Papirus Rhind menulis hampir setiap pecahan sebagai jumlah pecahan satuan yang berbeda (pembilang 1): $\frac25=\frac13+\frac1{15}$. Hanya beberapa, seperti $\frac23$, yang punya lambang sendiri. - **India dan dunia Arab.** Pecahan ditulis dengan satu bilangan di atas yang lain. Matematikawan Arab menambahkan garis pembagi. - **Eropa.** Liber Abaci karya Fibonacci (1202) memakai garis pecahan dan ikut menyebarkan angka Hindu-Arab di Eropa. - **Desimal.** De Thiende karya Simon Stevin (1585) menganjurkan menulis pecahan dalam persepuluhan, perseratusan, dan perseribuan, yaitu notasi desimal yang kita pakai. Kini bilangan yang sama tampil sebagai pecahan dalam resep, sebagai desimal pada kalkulator, sebagai persen di toko, dan sebagai rasio pada peta: satu gagasan dengan empat wajah. ## Apa kesalahan umum pada pecahan? **Kesalahan paling umum pada pecahan adalah sembilan hal berikut, masing-masing dengan pernyataan yang benar dan bilangan yang menunjukkan alasannya.** | Kesalahan | Yang benar | |---|---| | ❌ $\frac12+\frac13=\frac25$ | $\frac12+\frac13=\frac56$. Jangan pernah menjumlahkan penyebut. | | ❌ $\frac{2+3}{2+4}=\frac34$ | Suku tidak dicoret: $\frac{5}{6}$ sudah paling sederhana. | | ❌ $\frac13<\frac14$ karena $3<4$ | Penyebut lebih besar berarti potongan lebih kecil: $\frac13>\frac14$. | | ❌ $\frac34\div\frac9{10}=\frac{3\cdot9}{4\cdot10}$ | Balik pembagi: $\frac34\cdot\frac{10}{9}=\frac56$. | | ❌ $\frac{a}{b}\cdot\frac{c}{d}=\frac{ac}{b+d}$ | Kalikan juga penyebutnya: $\frac{ac}{bd}$. | | ❌ $-\frac{3}{4}=\frac{-3}{-4}$ | $\frac{-3}{-4}=+\frac34$. Pindahkan satu tanda minus saja. | | ❌ $\frac50=0$ | Penyebut 0 tidak diperbolehkan: $\frac50$ bukan bilangan. | | ❌ $3\frac12=3\cdot\frac12$ | $3\frac12=3+\frac12=\frac72$. | | ❌ $0{,}\overline{3}\neq\frac13$ karena ekspansinya tak berhingga | $0{,}\overline{3}=\frac13$ tepat: desimal berulang adalah pecahan. | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: bilangan rasional sekilas - **Rasional:** $\frac pq$ dengan bilangan bulat $p,q$ dan $q\neq0$; setiap bilangan bulat rasional; satu bilangan punya banyak pecahan, satu di antaranya paling sederhana. - **Pecahan sama:** $\frac ab=\frac cd\iff ad=bc$; bagi pembilang dan penyebut dengan FPB untuk menyederhanakan; coret faktor, jangan suku. - **Membandingkan:** kalikan silang; penyebut lebih besar membuat potongan lebih kecil; di antara dua bilangan rasional terdapat rata-ratanya. - **Menjumlah dan mengurang:** penyebut sama (KPK), lalu gabungkan pembilang; jangan menjumlahkan penyebut. - **Mengalikan dan membagi:** pembilang kali pembilang, penyebut kali penyebut; bagi dengan membalik pecahan kedua; nol tidak punya kebalikan. - **Bilangan campuran:** bagi dengan sisa untuk mengubah; $-3\frac12=-\left(3+\frac12\right)$. - **Desimal:** pecahan paling sederhana berakhir tepat bila penyebut hanya berisi 2 dan 5; jika tidak ia akhirnya berulang secara periodik; $p\%=\frac p{100}$. - **Kode:** pakai `Fraction` untuk ketepatan di Python; float tidak dapat menyimpan $\frac1{10}$. ## Glosarium: istilah penting - **Bilangan rasional**: Bilangan yang dapat ditulis sebagai pecahan dari dua bilangan bulat dengan penyebut bukan nol, seperti 3 per 4 atau minus 7 per 2. - **Pecahan**: Cara menulis bilangan sebagai pembilang di atas penyebut, yang menyatakan berapa bagian yang sama diambil dari berapa bagian. - **Pembilang**: Bilangan atas sebuah pecahan, yang menyatakan berapa bagian yang diambil. - **Penyebut**: Bilangan bawah sebuah pecahan, yang menyatakan keseluruhan dipotong menjadi berapa bagian sama dan tidak boleh nol. - **Pecahan senilai**: Pecahan berbeda yang menamai bilangan sama, seperti 1 per 2 dan 2 per 4, diperoleh dengan mengalikan atau membagi pembilang dan penyebut dengan bilangan yang sama. - **Bentuk paling sederhana**: Pecahan yang pembilang dan penyebutnya tidak punya faktor sama selain 1, diperoleh dengan membagi keduanya dengan faktor persekutuan terbesarnya. - **Pecahan wajar dan tak wajar**: Pecahan wajar ukurannya kurang dari 1, seperti 3 per 4; pecahan tak wajar ukurannya 1 atau lebih, seperti 17 per 5. - **Bilangan campuran**: Bilangan bulat bersama pecahan wajar, seperti 3 dan 2 per 5, yang berarti 3 ditambah 2 per 5. - **Kebalikan**: Pecahan yang dibalik; bilangan dikali kebalikannya sama dengan 1, dan nol tidak punya kebalikan. - **Penyebut sama**: Penyebut yang menjadi dasar penulisan ulang dua pecahan agar dapat dijumlahkan atau dibandingkan; kelipatan persekutuan terkecil dari penyebutnya adalah pilihan terkecil. - **Desimal berakhir**: Ekspansi desimal dengan angka yang berhingga banyaknya, seperti 0,375; pecahan paling sederhana memilikinya tepat bila penyebutnya hanya berfaktor prima 2 dan 5. - **Desimal berulang**: Ekspansi desimal yang akhirnya berulang secara periodik: mulai dari suatu angka, sebuah blok angka berulang tanpa akhir, seperti 0,333 dan seterusnya untuk 1 per 3. - **Persen**: Pecahan berpenyebut 100, sehingga 25 persen berarti 25 per 100, yaitu 1 per 4. - **Rasio (perbandingan)**: Perbandingan dua besaran yang ditulis a banding b atau sebagai pecahan a per b. ## Pertanyaan yang sering diajukan ### Apa itu bilangan rasional? Bilangan rasional adalah bilangan apa pun yang dapat ditulis sebagai pecahan p per q, dengan p dan q bilangan bulat dan q bukan nol. Contohnya 3 per 4, minus 7 per 2, dan setiap bilangan bulat, sebab 5 sama dengan 5 per 1. ### Apakah setiap bilangan bulat adalah bilangan rasional? Ya. Bilangan bulat n mana pun dapat ditulis sebagai n per 1, yaitu pecahan dari dua bilangan bulat dengan penyebut bukan nol. Jadi bilangan bulat adalah bagian dari bilangan rasional, dan bilangan rasional menambahkan pecahan di antaranya. ### Apa beda pecahan dan bilangan rasional? Pecahan adalah cara menulis, pembilang di atas penyebut, sedangkan bilangan rasional adalah nilai yang dinamai tulisan itu. Banyak pecahan, seperti 1 per 2, 2 per 4, dan 50 per 100, menamai bilangan rasional yang sama. ### Bagaimana menyederhanakan pecahan? Bagi pembilang dan penyebut dengan faktor persekutuan terbesarnya. Untuk 84 per 126 faktor persekutuan terbesarnya 42, sehingga pecahan itu menjadi 2 per 3. Kamu juga boleh mencoret faktor sama selangkah demi selangkah, tetapi jangan pernah suku yang sama. ### Bagaimana membandingkan dua pecahan? Kalikan silang. Untuk membandingkan a per b dengan c per d, bila b dan d positif, bandingkan a kali d dengan c kali b. Untuk 3 per 5 dan 5 per 8 itu 24 lawan 25, sehingga 3 per 5 lebih kecil. Kamu juga dapat memakai penyebut sama. ### Bagaimana menjumlahkan pecahan berpenyebut berbeda? Tulis keduanya di atas penyebut sama, sebaiknya kelipatan persekutuan terkecil, lalu jumlahkan pembilang dan pertahankan penyebut. Untuk 2 per 3 ditambah 3 per 4 pakai 12: 8 per 12 ditambah 9 per 12 adalah 17 per 12. Jangan pernah menjumlahkan penyebut. ### Mengapa pecahan kedua dibalik saat membagi? Karena membagi dengan suatu bilangan sama dengan mengalikan dengan kebalikannya. Pembagian menanyakan berapa yang muat: tiga dibagi setengah adalah 6, yaitu 3 kali 2. Umumnya a per b dibagi c per d sama dengan a per b kali d per c. ### Bagaimana mengubah pecahan tak wajar menjadi bilangan campuran? Bagi pembilang dengan penyebut. Hasil bagi adalah bagian bulat dan sisanya menjadi pembilang baru di atas penyebut yang sama. Untuk 17 per 5, 17 dibagi 5 adalah 3 sisa 2, sehingga menjadi 3 dan 2 per 5. ### Bagaimana mengubah pecahan menjadi desimal? Bagi pembilang dengan penyebut, dengan pembagian bersusun atau kalkulator. Untuk 3 per 8 hasilnya 0,375. Jika pembagian tidak pernah berakhir, angkanya akhirnya berulang secara periodik, seperti 1 per 3 menghasilkan 0,333 dan seterusnya, ditulis dengan garis di atas angka yang berulang. ### Kapan pecahan menghasilkan desimal berakhir? Bila, dalam bentuk paling sederhana, penyebutnya tidak punya faktor prima selain 2 dan 5, karena sepuluh adalah 2 kali 5. Jadi 3 per 8 dan 7 per 20 berakhir, sedangkan 1 per 3, 1 per 6, dan 5 per 12 berulang, sebab penyebutnya memuat 3. ### Apakah 0,333 berulang sama dengan sepertiga? Ya, tepat. Desimal berulang adalah cara lain menulis pecahan. Jika x adalah 0,333 dan seterusnya, maka 10x dikurangi x adalah 3, sehingga 9x adalah 3 dan x adalah sepertiga. Tiga tempat desimal hanya mendekatinya; pengulangan tak hingga sama dengannya. ### Bagaimana mengubah pecahan menjadi persen? Ubah menjadi desimal lalu kalikan 100, atau tulis ulang dengan penyebut 100. Untuk 3 per 8 desimalnya 0,375, sehingga 37,5 persen. Untuk 3 per 20, mengalikan pembilang dan penyebut dengan 5 menghasilkan 15 per 100, yaitu 15 persen. ### Mengapa penyebut tidak boleh nol? Pecahan a per b berarti bilangan yang menghasilkan a bila dikalikan b. Dengan b sama dengan 0, tidak ada bilangan kali 0 yang menghasilkan a bila a bukan 0, dan bila a juga 0 setiap bilangan berlaku. Jadi pembagian dengan nol tidak punya satu jawaban dan tidak terdefinisi. ### Bagaimana memakai pecahan secara eksak di Python? Pakai kelas Fraction dari modul fractions. Kelas itu menyimpan bilangan bulat untuk pembilang dan penyebut, menyederhanakan otomatis, dan menjumlah, mengurang, mengali, serta membagi secara eksak. Berikan string desimal, bukan float, sebab Fraction dari float sepersepuluh menyimpan galat biner float itu. --- # Integers: Number Line, Operations, Divisibility, GCD and LCM Source: https://nunada.my.id/articles/integers/ Updated: 2026-10-10 ## Quick answer **The integers are the whole numbers and their negatives: $\ldots,-3,-2,-1,0,1,2,3,\ldots$, written $\mathbb{Z}$.** You can add, subtract and multiply any two of them and always get another integer, while division may leave a remainder: $17=5\cdot3+2$. Integers sit on a number line, split into primes and composites, and share factors measured by the GCD and the LCM. ### Key takeaways - An integer is a whole number, positive, negative or zero; zero is neither positive nor negative, and every integer $a$ has an opposite $-a$ with $a+(-a)=0$. - On the number line the number further right is greater, so $-7<-3$; the absolute value $|a|$ is the distance from 0. - Subtracting is adding the opposite ($5-(-3)=8$), and a product or quotient is negative exactly when the signs differ. - Divisibility rules test 2, 3, 4, 5, 9, 10 and 11 from the digits alone; every integer above 1 is a product of primes in exactly one way. - Euclid's algorithm finds the GCD by repeated division with remainder, and $\gcd(a,b)\cdot\operatorname{lcm}(a,b)=a\cdot b$. - With negative numbers, languages disagree about remainders: $-7\bmod3$ is 2 in Python and $-1$ in JavaScript. ## What are integers? **Integers are the numbers with no fractional part: the counting numbers $1,2,3,\ldots$, their negatives $-1,-2,-3,\ldots$ and zero.** The set is written $\mathbb{Z}$, from the German Zahlen ("numbers"). Negative numbers exist because people need to describe things that go below a starting point, and the integers are what you get when a quantity can go either way: | Situation | Positive | Zero | Negative | |---|---|---|---| | Temperature (°C) | 25 above freezing | freezing point | −5 below freezing | | Height | 8 m above sea level | sea level | −12 m, a diver | | Lift buttons | floor 3 | ground floor | −1, a basement | | Money | 50 dollars in the account | nothing | −30, an overdraft | | Goal difference | 2 goals ahead | level | −3, behind | Three kinds of number are often confused. The **natural numbers** are $1,2,3,\ldots$ (here they start at 1; some books start at 0). The **whole numbers** are $0,1,2,3,\ldots$. The **integers** add the negatives. Every natural number is a whole number and every whole number is an integer, but not the other way round; the article on [real numbers](https://nunada.my.id/articles/real-numbers/#number-sets) shows how all these sets nest. Two facts about zero and signs are worth fixing now. **Zero is neither positive nor negative.** And every integer $a$ has an **opposite**, $-a$, on the other side of 0 at the same distance, so that $a+(-a)=0$. The opposite of 7 is $-7$, the opposite of $-7$ is 7, and the opposite of 0 is 0, which is why $-(-a)=a$. The integers are a closed family under three operations: add, subtract or multiply two integers and the result is always an integer. They are not closed under division, since $7\div2$ is not an integer. That one gap is what the later sections on remainders are about, and what the article on [rational numbers](https://nunada.my.id/articles/rational-numbers/) closes with fractions. > **Negative numbers took a long time to be accepted** > > The Nine Chapters on the Mathematical Art, compiled by about the first century CE, already calculated with red counting rods for positive numbers and black rods for negative ones: see the [counting rods](https://nunada.my.id/articles/chinese-numbers/#counting-rods) in the article on Chinese numbers. In India, Brahmagupta (628) gave rules for fortunes and debts, including that a debt subtracted from zero is a fortune. European mathematicians were slower: Stifel still called negative numbers "absurd numbers" in 1544, and they were fully accepted only in the 1600s. ## How do you compare integers and what is absolute value? **On the number line the integer further to the right is the greater one, so $-3>-7$ even though 7 is bigger than 3.** Every positive integer is greater than 0 and every negative one is less than 0, which makes every positive integer greater than every negative one. To compare two negative numbers, compare their sizes and reverse the answer: $7>3$, so $-7<-3$. A debt of 7 is worse than a debt of 3. The **absolute value** $|a|$ is the distance from $a$ to 0, so it is never negative: $|7|=7$, $|-7|=7$ and $|0|=0$. In symbols, $|a|=a$ when $a\ge0$ and $|a|=-a$ when $a<0$. Opposites have the same absolute value, and the distance between two integers is the absolute value of their difference: $|{-4}-3|=7$. | Statement | True? | Why | |---|---|---| | $-3>-7$ | yes | $-3$ is to the right of $-7$ | | $-1<0$ | yes | every negative is less than 0 | | $|-5|=|5|$ | yes | both are 5 away from 0 | | $-9<-10$ | no | $-9$ is to the right of $-10$ | Ordering a list is a matter of reading it left to right on the line: negatives first, with the largest size furthest left, then 0, then the positives. ## How do you add and subtract integers? **To add integers, move along the number line: adding a positive moves right and adding a negative moves left; to subtract, add the opposite, so $a-b=a+(-b)$.** That one rule covers every case. Two rules for adding, by the signs: - **Same signs:** add the sizes and keep the sign. $5+3=8$ and $(-5)+(-3)=-8$. - **Different signs:** subtract the smaller size from the larger, and keep the sign of the larger. $5+(-8)=-3$, because 8 is the larger size and it is negative. $(-5)+8=3$. Two numbers that are opposites cancel: $6+(-6)=0$. **Subtracting is adding the opposite.** Taking away a positive moves left: $2-5=2+(-5)=-3$. Taking away a negative moves right, because removing a debt makes you richer: $5-(-3)=5+3=8$ and $(-5)-(-3)=-5+3=-2$. | Expression | Rewritten | Result | |---|---|---| | $5-(-3)$ | $5+3$ | 8 | | $-5-3$ | $-5+(-3)$ | −8 | | $-5-(-3)$ | $-5+3$ | −2 | | $-5+8$ | different signs, 8 is larger | 3 | The order does not matter for adding, $a+b=b+a$, but it does for subtracting: $5-3=2$ while $3-5=-2$. Try your own numbers below; the first jump (above the line) goes from 0 to $a$ and the second (below) is the change. ## How do you multiply and divide integers? **Multiply or divide the sizes, then make the answer positive if the signs are the same and negative if they differ.** A product with a factor of 0 is 0. | First | Second | Product or quotient | Example | |---|---|---|---| | positive | positive | positive | $4\cdot3=12$ | | negative | negative | positive | $(-4)(-3)=12$ | | positive | negative | negative | $4\cdot(-3)=-12$ | | negative | positive | negative | $(-4)\cdot3=-12$ | Division follows the same signs, because $a\div b=c$ means $a=b\cdot c$: $(-12)\div4=-3$ since $4\cdot(-3)=-12$, and $(-12)\div(-3)=4$ since $(-3)\cdot4=-12$. **Why is a negative times a negative positive?** Two arguments show it is not a convention but forced. A pattern. Count down the first factor and watch the products: $3\cdot(-2)=-6$, $2\cdot(-2)=-4$, $1\cdot(-2)=-2$, $0\cdot(-2)=0$. Each step down adds 2. The next step must add 2 again: $(-1)\cdot(-2)=2$. The distributive law. Start from $0=(-1)\cdot0=(-1)\bigl(1+(-1)\bigr)=(-1)\cdot1+(-1)(-1)=-1+(-1)(-1)$. For the right side to equal 0, $(-1)(-1)$ has to be 1. Any other value would break the [distributive law](https://nunada.my.id/articles/algebraic-expressions/#expand), $a(b+c)=ab+ac$, that the whole of arithmetic depends on. **Division by zero is undefined.** $a\div0=c$ would mean $a=0\cdot c=0$, which is impossible for $a\neq0$; and $0\div0$ could be any number, so it has no single value. Meanwhile $0\div a=0$ for $a\neq0$. Integers are not closed under division: $7\div2$ is the fraction $\frac72$, which is why division with remainder is its own topic below. ## What is the order of operations with negative numbers? **Work in this order: brackets, then powers, then multiplication and division from left to right, then addition and subtraction from left to right.** Negative numbers add two traps to it. 1. **A minus sign is not a bracket.** $-3^2$ means $-(3^2)=-9$, because the power binds tighter than the minus. Only $(-3)^2=9$ squares the $-3$. 2. **Same-level operations go left to right.** $12\div(-3)\times2$ is $-4\times2=-8$, not $12\div(-6)=-2$. And $10-4-3=3$, not $10-(4-3)=9$. 3. **Put brackets round a negative after an operator.** $5\cdot-2$ is written $5\cdot(-2)$, and $8-3\times(-2)=8+6=14$: the multiplication goes before the subtraction. | Expression | Steps | Result | |---|---|---| | $-3^2$ | $-(9)$ | −9 | | $(-3)^2$ | $9$ | 9 | | $8-3\times(-2)$ | $8-(-6)=8+6$ | 14 | | $12\div(-3)\times2$ | $-4\times2$ | −8 | | $-2\,(3-7)$ | $-2\cdot(-4)$ | 8 | An even power of a negative number is positive and an odd power is negative: $(-2)^4=16$ and $(-2)^3=-8$, since each pair of minus signs cancels. ## What are even and odd numbers and the divisibility rules? **An integer $a$ is divisible by $b$ when $a=b\cdot k$ for some integer $k$: $b$ is then a divisor (factor) of $a$ and $a$ is a multiple of $b$.** So 12 is divisible by 4 because $12=4\cdot3$, and 0 is divisible by every integer because $0=b\cdot0$. **Even and odd.** An even integer is divisible by 2, $a=2k$; an odd one is $a=2k+1$. Zero is even, and negative numbers have parity too: $-3$ is odd and $-4$ is even. The even numbers $2,4,6,\ldots$, the odd numbers $1,3,5,\ldots$ and the multiples of any integer each form an [arithmetic sequence](https://nunada.my.id/articles/arithmetic-sequences-and-series/#what-is-an-arithmetic-sequence), and their sums have a formula there. Parity follows a short table: | Operation | Result | |---|---| | even + even, odd + odd | even | | even + odd | odd | | even × anything | even | | odd × odd | odd | A proof of one row: $(2a+1)+(2b+1)=2(a+b+1)$, which is even. The same style of proof shows that the square of an odd number is odd, the fact behind the irrationality of $\sqrt2$. **Divisibility rules** let you test a number from its digits, without dividing: | By | The number is divisible when | Why it works | |---|---|---| | 2 | the last digit is even | 10 is a multiple of 2 | | 3 | the digit sum is divisible by 3 | 10, 100, ... each leave remainder 1 | | 4 | the last two digits form a multiple of 4 | 100 is a multiple of 4 | | 5 | the last digit is 0 or 5 | 10 is a multiple of 5 | | 6 | it is divisible by both 2 and 3 | 2 and 3 share no factor | | 8 | the last three digits form a multiple of 8 | 1000 is a multiple of 8 | | 9 | the digit sum is divisible by 9 | 10, 100, ... each leave remainder 1 | | 10 | the last digit is 0 | the definition of base ten | | 11 | the alternating digit sum is divisible by 11 | 10 is one less than a multiple of 11 | Example: $7200$ has digit sum 9 and ends in 00, so it is divisible by 2, 3, 4, 5, 6, 8, 9 and 10. For 11 take the digits from the right with alternating signs, $0-0+2-7=-5$, which is not a multiple of 11, so 7200 is not. Try any number below, including a very long one. ## What are prime numbers and prime factorization? **A prime number is an integer greater than 1 whose only positive divisors are 1 and itself; every integer greater than 1 is either prime or a product of primes, and that product is unique.** The primes begin $2,3,5,7,11,13,17,19,23,29,31,37,41,43,47$, fifteen of them below 50. - **Composite** numbers have more divisors: $12=3\cdot4$. - **1 is neither prime nor composite.** It has one divisor, itself. Calling it prime would break uniqueness, since $6=2\cdot3=1\cdot2\cdot3$. - **2 is the only even prime**, because every other even number is also divisible by 2. **The fundamental theorem of arithmetic** says every integer greater than 1 can be written as a product of primes in exactly one way, apart from the order. So $360=2\cdot2\cdot2\cdot3\cdot3\cdot5=2^3\cdot3^2\cdot5$, and no other set of primes multiplies to 360. **To factorize,** divide by the smallest prime that goes in, again and again, until 1 is left: $360\div2=180$, $\div2=90$, $\div2=45$, $\div3=15$, $\div3=5$, $\div5=1$. **To test whether $n$ is prime,** divide by the primes up to $\sqrt{n}$. If $n$ had a factor larger than $\sqrt{n}$, its partner factor would be smaller than $\sqrt{n}$, so you would have met it already. Take 91: $\sqrt{91}<10$, and $91=7\cdot13$, so it only looks prime. For 97 nothing in 2, 3, 5, 7 divides it, so 97 is prime. **There are infinitely many primes.** Euclid's argument: suppose a list of primes were complete, multiply them all and add 1. The result leaves remainder 1 on division by every prime on the list, so it either is a new prime or has one, and the list was not complete. **Divisors from the factorization.** If $n=p^a q^b\cdots$ it has $(a+1)(b+1)\cdots$ positive divisors, so $360$ has $4\cdot3\cdot2=24$. Use the tool below. ## How do you find the GCD and LCM? **The greatest common divisor (GCD, in Indonesian FPB) of two integers is the largest integer that divides both, and the least common multiple (LCM, KPK) is the smallest positive integer that both divide.** For 48 and 180 the GCD is 12 and the LCM is 720. **By prime factors.** Write each number as primes: $48=2^4\cdot3$ and $180=2^2\cdot3^2\cdot5$. For the GCD take each prime with the smaller exponent: $2^2\cdot3=12$. For the LCM take each prime with the larger exponent: $2^4\cdot3^2\cdot5=720$. **By Euclid's algorithm,** which needs no factoring and works for huge numbers. Divide, keep the remainder, and repeat with the divisor and the remainder until the remainder is 0; the last non-zero remainder is the GCD: $180=3\cdot48+36$, then $48=1\cdot36+12$, then $36=3\cdot12+0$. So $\gcd(48,180)=12$. It works because any number dividing $a$ and $b$ also divides $a-qb$, and the other way round, so $\gcd(a,b)=\gcd(b,\,a-qb)$ while the numbers shrink to zero. Euclid wrote it down in Book VII of the Elements, around 300 BCE, which makes it one of the oldest algorithms still in daily use. **The two are linked:** $\gcd(a,b)\cdot\operatorname{lcm}(a,b)=a\cdot b$. Check: $12\cdot720=8640=48\cdot180$. So $\operatorname{lcm}(a,b)=\dfrac{a\cdot b}{\gcd(a,b)}$. Two numbers are **coprime** when their GCD is 1, as with 8 and 15. **What they are for.** - **Simplifying a fraction:** divide top and bottom by the GCD. $\dfrac{48}{180}=\dfrac{48\div12}{180\div12}=\dfrac{4}{15}$. - **Cutting into equal pieces:** a floor 48 dm by 180 dm is tiled with the largest square tiles whose side is $\gcd=12$ dm, which takes $4\cdot15=60$ tiles. - **Repeating events:** buses leave every 12 and every 18 minutes, together at 7:00. They next leave together after $\operatorname{lcm}(12,18)=36$ minutes. - **Adding fractions:** the least common denominator is the LCM of the denominators. ## What is division with remainder and modular arithmetic? **Dividing an integer $a$ by $b\neq0$ gives a unique quotient $q$ and remainder $r$ with $a=b\cdot q+r$ and $0\le r<|b|$; the remainder is written $a\bmod b$.** For example $17=5\cdot3+2$, so $17\bmod5=2$. With a negative dividend the rule still holds, and the remainder stays between 0 and $|b|-1$: $-7=3\cdot(-3)+2$, so $-7\bmod3=2$, not $-1$. Think of a clock: 7 hours before 12 o'clock is 5 o'clock, and a day of 24 hours repeats after 24, which is the same as counting remainders. **Modular arithmetic** works with remainders only. Two integers are **congruent modulo $n$**, written $a\equiv c\pmod n$, when $n$ divides $a-c$, that is, when they leave the same remainder: $17\equiv2\pmod5$. Remainders respect addition and multiplication, so you can reduce first and calculate afterward: - **Days of the week.** 100 days after a Monday: $100\bmod7=2$, so it is a Wednesday. - **Last digits.** The last digit of $7^k$ repeats 7, 9, 3, 1. Since $2026\bmod4=2$, the last digit of $7^{2026}$ is the second in the cycle, 9. - **Parity.** Even and odd are just $a\bmod2$. - **Check digits and hashing.** Barcodes and card numbers carry a digit computed with $\bmod10$ to catch typing errors, and a hash table picks a slot with $\bmod$ the table size. The catch is that **programming languages do not all agree on negative operands.** Each satisfies $a=b\cdot q+r$ but chooses $q$ differently: mathematics keeps $r\ge0$; Python rounds $q$ down, so $r$ takes the sign of the divisor; JavaScript, C, C++ and Java truncate $q$ toward zero, so $r$ takes the sign of the dividend. Compare them below. ## How do you work with integers in Python and JavaScript? **Python integers have no size limit and use floor division, while JavaScript numbers are floating-point numbers (floats), exact only up to $2^{53}-1$, with a remainder that follows the dividend; use `BigInt` in JavaScript for large exact integers.** The two languages disagree exactly where this article has been pointing. Why fixed-size integers wrap around is explained by [two’s complement](https://nunada.my.id/articles/binary-numbers/#twos-complement) in the article on binary numbers. ```python >>> 7 // 2, -7 // 2 # floor division rounds down (3, -4) >>> 7 % 3, -7 % 3, 7 % -3 # the remainder takes the sign of the divisor (1, 2, -2) >>> divmod(-7, 3) # quotient and remainder together (-3, 2) >>> int(-7 / 2) # / gives a float, int() truncates toward zero -3 >>> import math >>> math.gcd(48, 180), math.lcm(4, 6) (12, 12) >>> 2 ** 100 # no overflow 1267650600228229401496703205376 ``` ```python def gcd(a, b): while b: a, b = b, a % b return abs(a) def factorize(n): out, p = [], 2 while p * p <= n: while n % p == 0: out.append(p) n //= p p += 1 if n > 1: out.append(n) return out gcd(48, 180) # 12 factorize(360) # [2, 2, 2, 3, 3, 5] ``` ```javascript -7 % 3 // -1 the remainder takes the sign of the dividend ((-7 % 3) + 3) % 3 // 2 the usual fix for a non-negative remainder Math.trunc(-7 / 2) // -3 Math.floor(-7 / 2) // -4 Number.MAX_SAFE_INTEGER // 9007199254740991 2 ** 53 + 1 === 2 ** 53 // true: beyond 2^53 integers lose exactness 2n ** 100n // 1267650600228229401496703205376n -7n % 3n // -1n BigInt behaves like Number here 7n / 2n // 3n BigInt division truncates ``` ```cpp #include using namespace std; int mod(int a, int b) { return ((a % b) + b) % b; } // a non-negative remainder, for b > 0 int floorDiv(int a, int b) { return (a - mod(a, b)) / b; } int gcd(int a, int b) { // Euclid's algorithm while (b != 0) { int t = a % b; a = b; b = t; } return a < 0 ? -a : a; } int lcm(int a, int b) { return a / gcd(a, b) * b; } int main() { cout << 7 / 2 << " " << 7 % 3 << endl; // 3 1 // C++ truncates toward zero: -7 / 2 is -3 and -7 % 3 is -1 cout << floorDiv(-7, 2) << " " << mod(-7, 3) << endl; // floor division and the usual remainder cout << gcd(48, 180) << " " << lcm(4, 6) << endl; int n = 360; // factorization by trial division for (int p = 2; p * p <= n; p++) while (n % p == 0) { cout << p << " "; n /= p; } if (n > 1) cout << n; cout << endl; return 0; } /* output: 3 1 -4 2 12 12 2 2 2 3 3 5 */ ``` The pitfalls, in order of how often they bite: | Pitfall | What happens | What to do | |---|---|---| | `-7 % 3` in JavaScript | gives −1, not 2 | use `((n % m) + m) % m` when you need 0 to m − 1 | | `7 / 2` | 3.5 in both languages; JavaScript has no integer division | use `//` in Python, `Math.trunc` or `Math.floor` in JavaScript | | Python `//` with negatives | rounds down: `-7 // 2` is −4, not −3 | use `int(-7 / 2)` if you want truncation | | Integers above 2⁵³ in JavaScript | silently inexact | use `BigInt` and the `n` suffix; do not mix it with `Number` | | Fixed-size integers in C and Java | 2147483647 + 1 wraps to −2147483648 in Java, and is undefined in C | choose a wider type, or check before adding | | Bitwise operators in JavaScript | `1 << 32` is 1: they work on 32 bits | avoid them for large values | | `0 % n` and `n % 0` | 0 is fine; dividing by 0 raises an error in Python and gives `NaN` in JavaScript | check the divisor first | Python's `math.gcd` and `math.lcm` (from Python 3.9) take any size of integer, so you rarely need your own, but writing Euclid's loop once is the best way to see why it ends. ## What are the common mistakes with integers? **The most common mistakes with integers are the nine below, each with the correct statement and a number that shows why.** | Mistake | Correct | |---|---| | ❌ $-3^2=9$ | $-3^2=-(3\cdot3)=-9$. Only $(-3)^2=9$. | | ❌ $5-(-3)=2$ | $5-(-3)=5+3=8$. Subtracting a negative adds. | | ❌ $-5-3=-2$ | $-5-3=-5+(-3)=-8$. | | ❌ $(-2)(-3)=-6$ | Same signs give a positive: $6$. | | ❌ $-7>-3$ because $7>3$ | The order reverses for negatives: $-7<-3$. | | ❌ 0 is a positive integer | 0 is neither positive nor negative. | | ❌ 1 is a prime number | 1 has one divisor; the primes start at 2. | | ❌ $5\div0=0$ | Division by zero is undefined. | | ❌ $\operatorname{lcm}$ and $\gcd$ swapped | GCD divides both numbers and is the smaller; the LCM is a multiple of both and is the larger: $\gcd(12,18)=6$, $\operatorname{lcm}=36$. | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: integers at a glance - **Integers:** $\ldots,-2,-1,0,1,2,\ldots$; zero is neither positive nor negative; every $a$ has an opposite $-a$. - **Order and size:** further right is greater, so $-7<-3$; $|a|$ is the distance from 0. - **Adding and subtracting:** same signs add and keep the sign; different signs subtract and keep the sign of the larger; $a-b=a+(-b)$. - **Multiplying and dividing:** same signs give positive, different signs give negative; never divide by 0. - **Order of operations:** brackets, powers, then ×÷, then +− left to right; $-3^2=-9$ but $(-3)^2=9$. - **Divisibility:** digit rules for 2, 3, 4, 5, 6, 8, 9, 10, 11; every integer above 1 has one prime factorization. - **GCD and LCM:** smaller or larger prime exponents, or Euclid's algorithm; $\gcd\cdot\operatorname{lcm}=a\cdot b$. - **Remainders:** $a=bq+r$ with $0\le r<|b|$; Python, JavaScript and mathematics differ for negatives. ## Glossary: key terms - **Integer**: A number in the set ℤ, with no fractional part: zero, the positive whole numbers and their negatives. - **Opposite**: The number on the other side of zero at the same distance, so that a number plus its opposite is zero. - **Absolute value**: The distance of a number from zero, which is never negative, so the absolute value of minus 7 is 7. - **Closed under an operation**: A set is closed under an operation when applying it to members of the set always gives a member; the integers are closed under addition, subtraction and multiplication. - **Divisor (factor)**: An integer b is a divisor of a when a equals b times some integer, so that division leaves no remainder. - **Multiple**: The product of a number and any integer, such as 12, 24 and 36 for the number 12. - **Prime number**: An integer greater than 1 whose only positive divisors are 1 and itself. - **Composite number**: An integer greater than 1 that is not prime, so it has a divisor other than 1 and itself. - **Prime factorization**: The unique way of writing an integer greater than 1 as a product of primes, such as 360 equal to 2 cubed times 3 squared times 5. - **Greatest common divisor (GCD)**: The largest integer that divides both of two given integers; for 48 and 180 it is 12. - **Least common multiple (LCM)**: The smallest positive integer that is a multiple of both of two given integers; for 12 and 18 it is 36. - **Coprime**: Two integers whose greatest common divisor is 1, such as 8 and 15. - **Remainder**: What is left after dividing: in a equal to b times q plus r, the number r, which lies from 0 up to the size of b minus 1. - **Modulo**: The operation that gives the remainder of a division, so that 17 modulo 5 is 2. ## Frequently asked questions ### What is an integer? An integer is a number with no fractional part: zero, the positive whole numbers 1, 2, 3 and so on, and their negatives minus 1, minus 2, minus 3 and so on. The set of integers is written with the letter Z. ### Is zero a positive or a negative integer? Zero is neither positive nor negative. It is an integer, it is even, and it is the dividing point on the number line between the negative integers on the left and the positive integers on the right. ### What is the difference between natural numbers, whole numbers and integers? Natural numbers are 1, 2, 3 and so on. Whole numbers add zero. Integers add the negative numbers as well. So every natural number is a whole number, and every whole number is an integer, but not the other way round. ### Why is a negative times a negative positive? Because the distributive law forces it. Since minus 1 times the sum of 1 and minus 1 is zero, minus 1 plus minus 1 times minus 1 must be zero, so minus 1 times minus 1 has to be 1. Any other value would break ordinary arithmetic. ### How do you subtract a negative number? Subtracting a negative number is the same as adding its opposite. So 5 minus minus 3 is 5 plus 3, which is 8. On the number line you move to the right, just as taking away a debt leaves you better off. ### What is absolute value? The absolute value of a number is its distance from zero on the number line, so it is never negative. The absolute value of 7 and of minus 7 is 7, and the absolute value of zero is zero. It is written with two vertical bars. ### Why can you not divide by zero? Dividing a by zero would need a number c with 0 times c equal to a. Zero times anything is zero, so this is impossible when a is not zero, and when a is zero every c would work. Either way there is no single answer. ### How do you know if a number is divisible by 3 or 9? Add up its digits. If the digit sum is divisible by 3, so is the number, and if the digit sum is divisible by 9, so is the number. For example 522 has digit sum 9, so it is divisible by both 3 and 9. ### Is 1 a prime number? No. A prime has exactly two positive divisors, 1 and itself, while 1 has only one divisor. Excluding it keeps prime factorization unique, because otherwise 6 could be written as 2 times 3 and also as 1 times 2 times 3. The first prime is 2. ### How do you check whether a number is prime? Try dividing it by the primes up to its square root. If none divides it, it is prime. You can stop at the square root because any larger factor would pair with a smaller one you already tried. So 97 is prime, while 91 equals 7 times 13. ### How do you find the GCD of two numbers? Either take each shared prime factor with its smaller exponent, or use Euclid’s algorithm: divide the larger number by the smaller, replace the pair by the smaller number and the remainder, and repeat. The last non-zero remainder is the GCD. ### What is the difference between GCD and LCM? The GCD is the largest number that divides both numbers, so it is never larger than either. The LCM is the smallest number that both divide, so it is never smaller than either. Their product equals the product of the two numbers. ### What is the remainder when a negative number is divided? In mathematics the remainder is never negative, so minus 7 divided by 3 leaves 2, because minus 7 is 3 times minus 3 plus 2. Python agrees, but JavaScript, C and Java return minus 1, because they cut the quotient toward zero. ### How do you do integer division in Python? Use the double slash operator, which rounds down, so 7 // 2 is 3 and minus 7 // 2 is minus 4. A single slash always gives a float. The percent sign gives the remainder, and divmod returns the quotient and the remainder together. --- # Bilangan Bulat: Operasi, Faktor Prima, FPB, dan KPK Source: https://nunada.my.id/artikel/bilangan-bulat/ Updated: 2026-10-10 ## Jawaban singkat **Bilangan bulat adalah bilangan cacah beserta negatifnya: $\ldots,-3,-2,-1,0,1,2,3,\ldots$, ditulis $\mathbb{Z}$.** Kamu dapat menjumlahkan, mengurangkan, dan mengalikan dua bilangan bulat mana pun dan selalu mendapat bilangan bulat lagi, sedangkan pembagian dapat menyisakan sisa: $17=5\cdot3+2$. Bilangan bulat terletak pada garis bilangan, terbagi menjadi bilangan prima dan komposit, dan berbagi faktor yang diukur dengan FPB dan KPK. ### Poin penting - Bilangan bulat adalah bilangan utuh, positif, negatif, atau nol; nol bukan positif dan bukan negatif, dan setiap bilangan bulat $a$ punya lawan $-a$ dengan $a+(-a)=0$. - Pada garis bilangan, bilangan yang lebih kanan lebih besar, sehingga $-7<-3$; nilai mutlak $|a|$ adalah jarak dari 0. - Mengurangi sama dengan menambah lawannya ($5-(-3)=8$), dan hasil kali atau hasil bagi negatif tepat bila tanda keduanya berbeda. - Aturan habis dibagi menguji 2, 3, 4, 5, 9, 10, dan 11 hanya dari angka-angkanya; setiap bilangan bulat di atas 1 adalah hasil kali bilangan prima dengan tepat satu cara. - Algoritma Euclid mencari FPB dengan pembagian bersisa berulang, dan $\gcd(a,b)\cdot\operatorname{lcm}(a,b)=a\cdot b$. - Pada bilangan negatif, bahasa pemrograman berbeda soal sisa pembagian: $-7\bmod3$ adalah 2 di Python dan $-1$ di JavaScript. ## Apa itu bilangan bulat? **Bilangan bulat adalah bilangan tanpa bagian pecahan: bilangan asli $1,2,3,\ldots$, negatifnya $-1,-2,-3,\ldots$, dan nol.** Himpunannya ditulis $\mathbb{Z}$, dari kata Jerman Zahlen ("bilangan"). Bilangan negatif ada karena orang perlu menyatakan hal yang turun di bawah titik awal, dan bilangan bulat adalah yang kamu dapat ketika suatu besaran dapat bergerak ke dua arah: | Situasi | Positif | Nol | Negatif | |---|---|---|---| | Suhu (°C) | 25 di atas titik beku | titik beku | −5 di bawah titik beku | | Ketinggian | 8 m di atas permukaan laut | permukaan laut | −12 m, seorang penyelam | | Tombol lift | lantai 3 | lantai dasar | −1, ruang bawah tanah | | Uang | saldo Rp50.000 | tidak ada | −Rp30.000, utang | | Selisih gol | unggul 2 gol | imbang | −3, tertinggal | Tiga jenis bilangan sering tertukar. **Bilangan asli** adalah $1,2,3,\ldots$ (di sini mulai dari 1; sebagian buku mulai dari 0). **Bilangan cacah** adalah $0,1,2,3,\ldots$. **Bilangan bulat** menambahkan negatifnya. Setiap bilangan asli adalah bilangan cacah dan setiap bilangan cacah adalah bilangan bulat, tetapi tidak sebaliknya; artikel [bilangan real](https://nunada.my.id/artikel/bilangan-real/#number-sets) menunjukkan bagaimana semua himpunan ini bersarang. Dua hal tentang nol dan tanda perlu dipegang sekarang. **Nol bukan positif dan bukan negatif.** Dan setiap bilangan bulat $a$ punya **lawan**, $-a$, di seberang 0 pada jarak yang sama, sehingga $a+(-a)=0$. Lawan 7 adalah $-7$, lawan $-7$ adalah 7, dan lawan 0 adalah 0, itulah sebabnya $-(-a)=a$. Bilangan bulat adalah keluarga yang tertutup terhadap tiga operasi: jumlahkan, kurangkan, atau kalikan dua bilangan bulat dan hasilnya selalu bilangan bulat. Mereka tidak tertutup terhadap pembagian, sebab $7\div2$ bukan bilangan bulat. Celah itulah yang dibahas pada bagian sisa pembagian nanti, dan yang ditutup oleh artikel [bilangan rasional](https://nunada.my.id/artikel/bilangan-rasional/) dengan pecahan. > **Bilangan negatif lama baru diterima** > > Nine Chapters on the Mathematical Art, yang disusun sekitar abad pertama M, sudah menghitung dengan batang hitung merah untuk bilangan positif dan batang hitam untuk bilangan negatif: lihat [batang hitung](https://nunada.my.id/artikel/bilangan-bahasa-china/#counting-rods) pada artikel tentang bilangan dalam bahasa China. Di India, Brahmagupta (628) memberi aturan untuk harta dan utang, termasuk bahwa utang yang dikurangkan dari nol adalah harta. Matematikawan Eropa lebih lambat: Stifel pada 1544 masih menyebut bilangan negatif "bilangan yang absurd", dan baru diterima sepenuhnya pada abad ke-17. ## Bagaimana membandingkan bilangan bulat dan apa itu nilai mutlak? **Pada garis bilangan, bilangan bulat yang lebih ke kanan adalah yang lebih besar, sehingga $-3>-7$ walaupun 7 lebih besar daripada 3.** Setiap bilangan bulat positif lebih besar daripada 0 dan setiap yang negatif lebih kecil daripada 0, sehingga setiap bilangan bulat positif lebih besar daripada setiap yang negatif. Untuk membandingkan dua bilangan negatif, bandingkan ukurannya lalu balik jawabannya: $7>3$, sehingga $-7<-3$. Utang 7 lebih buruk daripada utang 3. **Nilai mutlak** $|a|$ adalah jarak dari $a$ ke 0, sehingga tidak pernah negatif: $|7|=7$, $|-7|=7$, dan $|0|=0$. Dalam lambang, $|a|=a$ bila $a\ge0$ dan $|a|=-a$ bila $a<0$. Bilangan yang saling berlawanan punya nilai mutlak sama, dan jarak antara dua bilangan bulat adalah nilai mutlak selisihnya: $|{-4}-3|=7$. | Pernyataan | Benar? | Alasan | |---|---|---| | $-3>-7$ | ya | $-3$ berada di kanan $-7$ | | $-1<0$ | ya | setiap bilangan negatif kurang dari 0 | | $|-5|=|5|$ | ya | keduanya berjarak 5 dari 0 | | $-9<-10$ | tidak | $-9$ berada di kanan $-10$ | Mengurutkan daftar berarti membacanya dari kiri ke kanan pada garis: yang negatif dahulu, dengan ukuran terbesar paling kiri, lalu 0, lalu yang positif. ## Bagaimana menjumlahkan dan mengurangkan bilangan bulat? **Untuk menjumlahkan bilangan bulat, bergeraklah di garis bilangan: menambah bilangan positif bergeser ke kanan dan menambah bilangan negatif bergeser ke kiri; untuk mengurangkan, tambahkan lawannya, sehingga $a-b=a+(-b)$.** Satu aturan itu mencakup semua kasus. Dua aturan penjumlahan menurut tandanya: - **Tanda sama:** jumlahkan ukurannya dan pertahankan tandanya. $5+3=8$ dan $(-5)+(-3)=-8$. - **Tanda berbeda:** kurangkan ukuran yang kecil dari yang besar, dan pertahankan tanda yang besar. $5+(-8)=-3$, karena 8 adalah ukuran yang lebih besar dan ia negatif. $(-5)+8=3$. Dua bilangan yang saling berlawanan saling meniadakan: $6+(-6)=0$. **Mengurangkan sama dengan menambah lawannya.** Mengambil bilangan positif bergeser ke kiri: $2-5=2+(-5)=-3$. Mengambil bilangan negatif bergeser ke kanan, karena menghapus utang membuatmu lebih kaya: $5-(-3)=5+3=8$ dan $(-5)-(-3)=-5+3=-2$. | Ekspresi | Ditulis ulang | Hasil | |---|---|---| | $5-(-3)$ | $5+3$ | 8 | | $-5-3$ | $-5+(-3)$ | −8 | | $-5-(-3)$ | $-5+3$ | −2 | | $-5+8$ | tanda berbeda, 8 lebih besar | 3 | Urutan tidak berpengaruh pada penjumlahan, $a+b=b+a$, tetapi berpengaruh pada pengurangan: $5-3=2$ sedangkan $3-5=-2$. Coba bilanganmu sendiri di bawah; lompatan pertama (di atas garis) dari 0 ke $a$ dan lompatan kedua (di bawah) adalah perubahannya. ## Bagaimana mengalikan dan membagi bilangan bulat? **Kalikan atau bagi ukurannya, lalu buat jawabannya positif bila tanda keduanya sama dan negatif bila berbeda.** Hasil kali dengan faktor 0 adalah 0. | Pertama | Kedua | Hasil kali atau hasil bagi | Contoh | |---|---|---|---| | positif | positif | positif | $4\cdot3=12$ | | negatif | negatif | positif | $(-4)(-3)=12$ | | positif | negatif | negatif | $4\cdot(-3)=-12$ | | negatif | positif | negatif | $(-4)\cdot3=-12$ | Pembagian mengikuti tanda yang sama, karena $a\div b=c$ berarti $a=b\cdot c$: $(-12)\div4=-3$ sebab $4\cdot(-3)=-12$, dan $(-12)\div(-3)=4$ sebab $(-3)\cdot4=-12$. **Mengapa negatif kali negatif menjadi positif?** Dua argumen menunjukkan bahwa ini bukan kesepakatan, melainkan keharusan. Pola. Turunkan faktor pertama dan perhatikan hasil kalinya: $3\cdot(-2)=-6$, $2\cdot(-2)=-4$, $1\cdot(-2)=-2$, $0\cdot(-2)=0$. Tiap langkah turun menambah 2. Langkah berikutnya harus menambah 2 lagi: $(-1)\cdot(-2)=2$. Sifat distributif. Mulai dari $0=(-1)\cdot0=(-1)\bigl(1+(-1)\bigr)=(-1)\cdot1+(-1)(-1)=-1+(-1)(-1)$. Agar ruas kanan sama dengan 0, $(-1)(-1)$ harus 1. Nilai lain akan merusak [sifat distributif](https://nunada.my.id/artikel/bentuk-aljabar/#expand), $a(b+c)=ab+ac$, yang menjadi sandaran seluruh aritmetika. **Pembagian dengan nol tidak terdefinisi.** $a\div0=c$ akan berarti $a=0\cdot c=0$, yang mustahil untuk $a\neq0$; dan $0\div0$ dapat berupa bilangan apa pun, sehingga tidak punya satu nilai. Sementara itu $0\div a=0$ untuk $a\neq0$. Bilangan bulat tidak tertutup terhadap pembagian: $7\div2$ adalah pecahan $\frac72$, itulah sebabnya pembagian bersisa menjadi topik tersendiri di bawah. ## Apa urutan operasi hitung pada bilangan negatif? **Kerjakan dengan urutan ini: kurung, lalu pangkat, lalu perkalian dan pembagian dari kiri ke kanan, lalu penjumlahan dan pengurangan dari kiri ke kanan.** Bilangan negatif menambah dua jebakan. 1. **Tanda minus bukan kurung.** $-3^2$ berarti $-(3^2)=-9$, karena pangkat lebih kuat mengikat daripada minus. Hanya $(-3)^2=9$ yang mengkuadratkan $-3$. 2. **Operasi setingkat dikerjakan dari kiri ke kanan.** $12\div(-3)\times2$ adalah $-4\times2=-8$, bukan $12\div(-6)=-2$. Dan $10-4-3=3$, bukan $10-(4-3)=9$. 3. **Beri kurung pada bilangan negatif setelah operator.** $5\cdot-2$ ditulis $5\cdot(-2)$, dan $8-3\times(-2)=8+6=14$: perkalian dikerjakan sebelum pengurangan. | Ekspresi | Langkah | Hasil | |---|---|---| | $-3^2$ | $-(9)$ | −9 | | $(-3)^2$ | $9$ | 9 | | $8-3\times(-2)$ | $8-(-6)=8+6$ | 14 | | $12\div(-3)\times2$ | $-4\times2$ | −8 | | $-2\,(3-7)$ | $-2\cdot(-4)$ | 8 | Pangkat genap dari bilangan negatif positif dan pangkat ganjil negatif: $(-2)^4=16$ dan $(-2)^3=-8$, sebab tiap pasang tanda minus saling meniadakan. ## Apa itu bilangan genap, ganjil, dan aturan habis dibagi? **Bilangan bulat $a$ habis dibagi $b$ bila $a=b\cdot k$ untuk suatu bilangan bulat $k$: $b$ kemudian disebut pembagi (faktor) dari $a$ dan $a$ adalah kelipatan $b$.** Jadi 12 habis dibagi 4 karena $12=4\cdot3$, dan 0 habis dibagi setiap bilangan bulat karena $0=b\cdot0$. **Genap dan ganjil.** Bilangan bulat genap habis dibagi 2, $a=2k$; yang ganjil berbentuk $a=2k+1$. Nol genap, dan bilangan negatif juga punya paritas: $-3$ ganjil dan $-4$ genap. Bilangan genap $2,4,6,\ldots$, bilangan ganjil $1,3,5,\ldots$, dan kelipatan bilangan bulat mana pun masing-masing membentuk [barisan aritmetika](https://nunada.my.id/artikel/barisan-dan-deret-aritmetika/#what-is-an-arithmetic-sequence), dan jumlah-jumlahnya punya rumus di sana. Paritas mengikuti tabel singkat: | Operasi | Hasil | |---|---| | genap + genap, ganjil + ganjil | genap | | genap + ganjil | ganjil | | genap × apa pun | genap | | ganjil × ganjil | ganjil | Bukti satu baris: $(2a+1)+(2b+1)=2(a+b+1)$, yang genap. Bukti dengan gaya yang sama menunjukkan bahwa kuadrat bilangan ganjil adalah ganjil, fakta di balik keirasionalan $\sqrt2$. **Aturan habis dibagi** memungkinkanmu menguji sebuah bilangan dari angka-angkanya, tanpa membagi: | Oleh | Bilangan habis dibagi bila | Mengapa berlaku | |---|---|---| | 2 | angka terakhir genap | 10 kelipatan 2 | | 3 | jumlah angkanya habis dibagi 3 | 10, 100, ... masing-masing bersisa 1 | | 4 | dua angka terakhir membentuk kelipatan 4 | 100 kelipatan 4 | | 5 | angka terakhir 0 atau 5 | 10 kelipatan 5 | | 6 | habis dibagi 2 dan 3 sekaligus | 2 dan 3 tidak punya faktor sama | | 8 | tiga angka terakhir membentuk kelipatan 8 | 1000 kelipatan 8 | | 9 | jumlah angkanya habis dibagi 9 | 10, 100, ... masing-masing bersisa 1 | | 10 | angka terakhir 0 | definisi basis sepuluh | | 11 | jumlah angka berselang-seling habis dibagi 11 | 10 kurang satu dari kelipatan 11 | Contoh: $7200$ berjumlah angka 9 dan berakhir 00, sehingga habis dibagi 2, 3, 4, 5, 6, 8, 9, dan 10. Untuk 11, ambil angka dari kanan dengan tanda berselang-seling, $0-0+2-7=-5$, yang bukan kelipatan 11, sehingga 7200 tidak habis dibagi 11. Coba bilangan apa pun di bawah, termasuk yang sangat panjang. ## Apa itu bilangan prima dan faktorisasi prima? **Bilangan prima adalah bilangan bulat lebih dari 1 yang satu-satunya pembagi positifnya adalah 1 dan dirinya sendiri; setiap bilangan bulat lebih dari 1 adalah prima atau hasil kali bilangan prima, dan hasil kali itu tunggal.** Bilangan prima dimulai $2,3,5,7,11,13,17,19,23,29,31,37,41,43,47$, lima belas bilangan di bawah 50. - Bilangan **komposit** punya lebih banyak pembagi: $12=3\cdot4$. - **1 bukan prima dan bukan komposit.** Ia hanya punya satu pembagi, yaitu dirinya sendiri. Menyebutnya prima akan merusak ketunggalan, sebab $6=2\cdot3=1\cdot2\cdot3$. - **2 adalah satu-satunya prima genap**, karena setiap bilangan genap lain juga habis dibagi 2. **Teorema dasar aritmetika** menyatakan setiap bilangan bulat lebih dari 1 dapat ditulis sebagai hasil kali bilangan prima dengan tepat satu cara, selain urutannya. Jadi $360=2\cdot2\cdot2\cdot3\cdot3\cdot5=2^3\cdot3^2\cdot5$, dan tidak ada himpunan bilangan prima lain yang hasil kalinya 360. **Untuk memfaktorkan,** bagi dengan bilangan prima terkecil yang membagi, berulang-ulang, sampai tersisa 1: $360\div2=180$, $\div2=90$, $\div2=45$, $\div3=15$, $\div3=5$, $\div5=1$. **Untuk menguji apakah $n$ prima,** bagi dengan bilangan prima sampai $\sqrt{n}$. Jika $n$ punya faktor yang lebih besar dari $\sqrt{n}$, pasangan faktornya lebih kecil dari $\sqrt{n}$, sehingga sudah kamu temui. Ambil 91: $\sqrt{91}<10$, dan $91=7\cdot13$, sehingga ia hanya tampak prima. Untuk 97 tidak ada di antara 2, 3, 5, 7 yang membaginya, sehingga 97 prima. **Bilangan prima tak berhingga banyaknya.** Argumen Euclid: misalkan daftar bilangan prima sudah lengkap, kalikan semuanya lalu tambah 1. Hasilnya bersisa 1 bila dibagi bilangan prima mana pun pada daftar, sehingga ia prima baru atau punya pembagi prima baru, dan daftar itu tidak lengkap. **Pembagi dari faktorisasi.** Jika $n=p^a q^b\cdots$ maka ia punya $(a+1)(b+1)\cdots$ pembagi positif, sehingga $360$ punya $4\cdot3\cdot2=24$. Pakai alat di bawah. ## Bagaimana mencari FPB dan KPK? **Faktor persekutuan terbesar (FPB) dua bilangan bulat adalah bilangan bulat terbesar yang membagi keduanya, dan kelipatan persekutuan terkecil (KPK) adalah bilangan bulat positif terkecil yang habis dibagi keduanya.** Untuk 48 dan 180, FPB-nya 12 dan KPK-nya 720. **Dengan faktor prima.** Tulis tiap bilangan sebagai bilangan prima: $48=2^4\cdot3$ dan $180=2^2\cdot3^2\cdot5$. Untuk FPB ambil tiap bilangan prima dengan eksponen yang terkecil: $2^2\cdot3=12$. Untuk KPK ambil tiap bilangan prima dengan eksponen yang terbesar: $2^4\cdot3^2\cdot5=720$. **Dengan algoritma Euclid,** yang tidak memerlukan pemfaktoran dan berlaku untuk bilangan yang sangat besar. Bagi, simpan sisanya, dan ulangi dengan pembagi dan sisa sampai sisanya 0; sisa terakhir yang bukan nol adalah FPB: $180=3\cdot48+36$, lalu $48=1\cdot36+12$, lalu $36=3\cdot12+0$. Jadi $\gcd(48,180)=12$. Algoritma ini berhasil karena bilangan mana pun yang membagi $a$ dan $b$ juga membagi $a-qb$, dan sebaliknya, sehingga $\gcd(a,b)=\gcd(b,\,a-qb)$ sementara bilangannya mengecil sampai nol. Euclid menuliskannya dalam Buku VII Elements, sekitar 300 SM, sehingga ia salah satu algoritma tertua yang masih dipakai setiap hari. **Keduanya berkaitan:** $\gcd(a,b)\cdot\operatorname{lcm}(a,b)=a\cdot b$. Periksa: $12\cdot720=8640=48\cdot180$. Jadi $\operatorname{lcm}(a,b)=\dfrac{a\cdot b}{\gcd(a,b)}$. Dua bilangan **saling prima** bila FPB-nya 1, seperti 8 dan 15. **Kegunaannya.** - **Menyederhanakan pecahan:** bagi pembilang dan penyebut dengan FPB. $\dfrac{48}{180}=\dfrac{48\div12}{180\div12}=\dfrac{4}{15}$. - **Memotong menjadi bagian sama besar:** lantai 48 dm kali 180 dm dipasangi ubin persegi terbesar yang sisinya $\gcd=12$ dm, yang membutuhkan $4\cdot15=60$ ubin. - **Kejadian berulang:** bus berangkat tiap 12 menit dan tiap 18 menit, bersamaan pada pukul 07:00. Keduanya berangkat bersamaan lagi setelah $\operatorname{lcm}(12,18)=36$ menit. - **Menjumlahkan pecahan:** penyebut sekutu terkecil adalah KPK dari penyebut-penyebutnya. ## Apa itu pembagian bersisa dan aritmetika modular? **Membagi bilangan bulat $a$ dengan $b\neq0$ menghasilkan hasil bagi $q$ dan sisa $r$ yang tunggal dengan $a=b\cdot q+r$ dan $0\le r<|b|$; sisanya ditulis $a\bmod b$.** Misalnya $17=5\cdot3+2$, sehingga $17\bmod5=2$. Dengan bilangan yang dibagi negatif, aturan itu tetap berlaku, dan sisanya tetap antara 0 dan $|b|-1$: $-7=3\cdot(-3)+2$, sehingga $-7\bmod3=2$, bukan $-1$. Bayangkan jam: 7 jam sebelum pukul 12 adalah pukul 5, dan satu hari 24 jam berulang setelah 24, yang sama dengan menghitung sisa. **Aritmetika modular** bekerja hanya dengan sisa. Dua bilangan bulat **kongruen modulo $n$**, ditulis $a\equiv c\pmod n$, bila $n$ membagi $a-c$, yaitu bila keduanya bersisa sama: $17\equiv2\pmod5$. Sisa mengikuti penjumlahan dan perkalian, sehingga kamu dapat menyederhanakan lebih dulu lalu menghitung: - **Hari dalam seminggu.** 100 hari setelah hari Senin: $100\bmod7=2$, sehingga harinya Rabu. - **Angka satuan.** Angka satuan $7^k$ berulang 7, 9, 3, 1. Karena $2026\bmod4=2$, angka satuan $7^{2026}$ adalah yang kedua dalam siklus, yaitu 9. - **Paritas.** Genap dan ganjil tidak lain adalah $a\bmod2$. - **Angka pemeriksa dan hashing.** Barcode dan nomor kartu memuat angka yang dihitung dengan $\bmod10$ untuk menangkap kesalahan ketik, dan tabel hash memilih slot dengan $\bmod$ ukuran tabel. Masalahnya, **bahasa pemrograman tidak semuanya sepakat tentang operan negatif.** Masing-masing memenuhi $a=b\cdot q+r$ tetapi memilih $q$ secara berbeda: matematika menjaga $r\ge0$; Python membulatkan $q$ ke bawah, sehingga $r$ bertanda sama dengan pembagi; JavaScript, C, C++, dan Java memotong $q$ ke arah nol, sehingga $r$ bertanda sama dengan bilangan yang dibagi. Bandingkan di bawah. ## Bagaimana mengolah bilangan bulat di Python dan JavaScript? **Bilangan bulat Python tidak punya batas ukuran dan memakai pembagian floor, sedangkan bilangan JavaScript berupa bilangan floating point (float), eksak hanya sampai $2^{53}-1$, dengan sisa yang mengikuti bilangan yang dibagi; pakai `BigInt` di JavaScript untuk bilangan bulat besar yang eksak.** Kedua bahasa itu berbeda tepat di tempat yang ditunjuk artikel ini. Mengapa bilangan bulat berukuran tetap berputar kembali dijelaskan oleh [komplemen dua](https://nunada.my.id/artikel/bilangan-biner/#twos-complement) pada artikel bilangan biner. ```python >>> 7 // 2, -7 // 2 # floor division rounds down (3, -4) >>> 7 % 3, -7 % 3, 7 % -3 # the remainder takes the sign of the divisor (1, 2, -2) >>> divmod(-7, 3) # quotient and remainder together (-3, 2) >>> int(-7 / 2) # / gives a float, int() truncates toward zero -3 >>> import math >>> math.gcd(48, 180), math.lcm(4, 6) (12, 12) >>> 2 ** 100 # no overflow 1267650600228229401496703205376 ``` ```python def gcd(a, b): while b: a, b = b, a % b return abs(a) def factorize(n): out, p = [], 2 while p * p <= n: while n % p == 0: out.append(p) n //= p p += 1 if n > 1: out.append(n) return out gcd(48, 180) # 12 factorize(360) # [2, 2, 2, 3, 3, 5] ``` ```javascript -7 % 3 // -1 the remainder takes the sign of the dividend ((-7 % 3) + 3) % 3 // 2 the usual fix for a non-negative remainder Math.trunc(-7 / 2) // -3 Math.floor(-7 / 2) // -4 Number.MAX_SAFE_INTEGER // 9007199254740991 2 ** 53 + 1 === 2 ** 53 // true: beyond 2^53 integers lose exactness 2n ** 100n // 1267650600228229401496703205376n -7n % 3n // -1n BigInt behaves like Number here 7n / 2n // 3n BigInt division truncates ``` ```cpp #include using namespace std; int mod(int a, int b) { return ((a % b) + b) % b; } // a non-negative remainder, for b > 0 int floorDiv(int a, int b) { return (a - mod(a, b)) / b; } int gcd(int a, int b) { // Euclid's algorithm while (b != 0) { int t = a % b; a = b; b = t; } return a < 0 ? -a : a; } int lcm(int a, int b) { return a / gcd(a, b) * b; } int main() { cout << 7 / 2 << " " << 7 % 3 << endl; // 3 1 // C++ truncates toward zero: -7 / 2 is -3 and -7 % 3 is -1 cout << floorDiv(-7, 2) << " " << mod(-7, 3) << endl; // floor division and the usual remainder cout << gcd(48, 180) << " " << lcm(4, 6) << endl; int n = 360; // factorization by trial division for (int p = 2; p * p <= n; p++) while (n % p == 0) { cout << p << " "; n /= p; } if (n > 1) cout << n; cout << endl; return 0; } /* output: 3 1 -4 2 12 12 2 2 2 3 3 5 */ ``` Jebakannya, berurutan dari yang paling sering menggigit: | Jebakan | Yang terjadi | Yang sebaiknya dilakukan | |---|---|---| | `-7 % 3` di JavaScript | hasilnya −1, bukan 2 | pakai `((n % m) + m) % m` bila perlu 0 sampai m − 1 | | `7 / 2` | 3,5 di kedua bahasa; JavaScript tidak punya pembagian bulat | pakai `//` di Python, `Math.trunc` atau `Math.floor` di JavaScript | | Python `//` dengan negatif | membulat ke bawah: `-7 // 2` adalah −4, bukan −3 | pakai `int(-7 / 2)` bila ingin pemotongan | | Bilangan di atas 2⁵³ di JavaScript | diam-diam tidak eksak | pakai `BigInt` dan akhiran `n`; jangan campur dengan `Number` | | Bilangan berukuran tetap di C dan Java | 2147483647 + 1 berputar menjadi −2147483648 di Java, dan tidak terdefinisi di C | pilih tipe yang lebih lebar, atau periksa sebelum menambah | | Operator bitwise di JavaScript | `1 << 32` bernilai 1: operator itu bekerja pada 32 bit | hindari untuk nilai besar | | `0 % n` dan `n % 0` | 0 tidak masalah; membagi dengan 0 menimbulkan galat di Python dan memberi `NaN` di JavaScript | periksa pembaginya lebih dulu | `math.gcd` dan `math.lcm` Python (sejak Python `3.9`) menerima bilangan bulat sebesar apa pun, sehingga jarang perlu membuat sendiri, tetapi menulis perulangan Euclid sekali adalah cara terbaik melihat mengapa ia berhenti. ## Apa kesalahan umum pada bilangan bulat? **Kesalahan paling umum pada bilangan bulat adalah sembilan hal berikut, masing-masing dengan pernyataan yang benar dan bilangan yang menunjukkan alasannya.** | Kesalahan | Yang benar | |---|---| | ❌ $-3^2=9$ | $-3^2=-(3\cdot3)=-9$. Hanya $(-3)^2=9$. | | ❌ $5-(-3)=2$ | $5-(-3)=5+3=8$. Mengurangi bilangan negatif berarti menambah. | | ❌ $-5-3=-2$ | $-5-3=-5+(-3)=-8$. | | ❌ $(-2)(-3)=-6$ | Tanda sama menghasilkan positif: $6$. | | ❌ $-7>-3$ karena $7>3$ | Urutannya berbalik untuk bilangan negatif: $-7<-3$. | | ❌ 0 adalah bilangan bulat positif | 0 bukan positif dan bukan negatif. | | ❌ 1 adalah bilangan prima | 1 hanya punya satu pembagi; bilangan prima dimulai dari 2. | | ❌ $5\div0=0$ | Pembagian dengan nol tidak terdefinisi. | | ❌ $\operatorname{lcm}$ dan $\gcd$ tertukar | FPB membagi kedua bilangan dan lebih kecil; KPK adalah kelipatan keduanya dan lebih besar: $\gcd(12,18)=6$, $\operatorname{lcm}=36$. | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: bilangan bulat sekilas - **Bilangan bulat:** $\ldots,-2,-1,0,1,2,\ldots$; nol bukan positif dan bukan negatif; setiap $a$ punya lawan $-a$. - **Urutan dan ukuran:** makin ke kanan makin besar, sehingga $-7<-3$; $|a|$ adalah jarak dari 0. - **Menjumlah dan mengurang:** tanda sama dijumlahkan dan tandanya dipertahankan; tanda berbeda dikurangkan dan mengikuti tanda yang lebih besar; $a-b=a+(-b)$. - **Mengalikan dan membagi:** tanda sama menghasilkan positif, tanda berbeda menghasilkan negatif; jangan pernah membagi dengan 0. - **Urutan operasi:** kurung, pangkat, lalu ×÷, lalu +− dari kiri ke kanan; $-3^2=-9$ tetapi $(-3)^2=9$. - **Habis dibagi:** aturan angka untuk 2, 3, 4, 5, 6, 8, 9, 10, 11; setiap bilangan bulat di atas 1 punya satu faktorisasi prima. - **FPB dan KPK:** eksponen prima terkecil atau terbesar, atau algoritma Euclid; $\gcd\cdot\operatorname{lcm}=a\cdot b$. - **Sisa:** $a=bq+r$ dengan $0\le r<|b|$; Python, JavaScript, dan matematika berbeda untuk bilangan negatif. ## Glosarium: istilah penting - **Bilangan bulat**: Bilangan dalam himpunan ℤ, tanpa bagian pecahan: nol, bilangan bulat positif, dan negatifnya. - **Lawan (bilangan berlawanan)**: Bilangan di seberang nol pada jarak yang sama, sehingga sebuah bilangan ditambah lawannya sama dengan nol. - **Nilai mutlak**: Jarak sebuah bilangan dari nol yang tidak pernah negatif, sehingga nilai mutlak minus 7 adalah 7. - **Tertutup terhadap suatu operasi**: Sebuah himpunan tertutup terhadap suatu operasi bila menerapkannya pada anggota himpunan selalu memberi anggota; bilangan bulat tertutup terhadap penjumlahan, pengurangan, dan perkalian. - **Pembagi (faktor)**: Bilangan bulat b adalah pembagi a bila a sama dengan b kali suatu bilangan bulat, sehingga pembagian tidak menyisakan sisa. - **Kelipatan**: Hasil kali sebuah bilangan dengan bilangan bulat mana pun, seperti 12, 24, dan 36 untuk bilangan 12. - **Bilangan prima**: Bilangan bulat lebih dari 1 yang satu-satunya pembagi positifnya adalah 1 dan dirinya sendiri. - **Bilangan komposit**: Bilangan bulat lebih dari 1 yang bukan prima, sehingga punya pembagi selain 1 dan dirinya sendiri. - **Faktorisasi prima**: Cara tunggal menulis bilangan bulat lebih dari 1 sebagai hasil kali bilangan prima, seperti 360 sama dengan 2 pangkat tiga kali 3 kuadrat kali 5. - **Faktor persekutuan terbesar (FPB)**: Bilangan bulat terbesar yang membagi dua bilangan bulat yang diberikan; untuk 48 dan 180 nilainya 12. - **Kelipatan persekutuan terkecil (KPK)**: Bilangan bulat positif terkecil yang merupakan kelipatan dua bilangan bulat yang diberikan; untuk 12 dan 18 nilainya 36. - **Saling prima**: Dua bilangan bulat yang faktor persekutuan terbesarnya 1, seperti 8 dan 15. - **Sisa pembagian**: Yang tersisa setelah membagi: dalam a sama dengan b kali q ditambah r, bilangan r, yang terletak dari 0 sampai ukuran b dikurangi 1. - **Modulo**: Operasi yang memberi sisa suatu pembagian, sehingga 17 modulo 5 adalah 2. ## Pertanyaan yang sering diajukan ### Apa itu bilangan bulat? Bilangan bulat adalah bilangan tanpa bagian pecahan: nol, bilangan utuh positif 1, 2, 3 dan seterusnya, serta negatifnya minus 1, minus 2, minus 3 dan seterusnya. Himpunan bilangan bulat ditulis dengan huruf Z. ### Apakah nol bilangan bulat positif atau negatif? Nol bukan positif dan bukan negatif. Ia adalah bilangan bulat, ia genap, dan ia menjadi titik pemisah pada garis bilangan antara bilangan bulat negatif di kiri dan bilangan bulat positif di kanan. ### Apa beda bilangan asli, bilangan cacah, dan bilangan bulat? Bilangan asli adalah 1, 2, 3 dan seterusnya. Bilangan cacah menambahkan nol. Bilangan bulat menambahkan pula bilangan negatif. Jadi setiap bilangan asli adalah bilangan cacah, dan setiap bilangan cacah adalah bilangan bulat, tetapi tidak sebaliknya. ### Mengapa negatif kali negatif hasilnya positif? Karena sifat distributif memaksanya. Karena minus 1 kali jumlah 1 dan minus 1 adalah nol, maka minus 1 ditambah minus 1 kali minus 1 harus nol, sehingga minus 1 kali minus 1 harus 1. Nilai lain akan merusak aritmetika biasa. ### Bagaimana mengurangkan bilangan negatif? Mengurangkan bilangan negatif sama dengan menambahkan lawannya. Jadi 5 dikurangi minus 3 adalah 5 ditambah 3, yaitu 8. Pada garis bilangan kamu bergeser ke kanan, seperti menghapus utang membuatmu lebih baik. ### Apa itu nilai mutlak? Nilai mutlak sebuah bilangan adalah jaraknya dari nol pada garis bilangan, sehingga tidak pernah negatif. Nilai mutlak 7 dan minus 7 adalah 7, dan nilai mutlak nol adalah nol. Ditulis dengan dua garis tegak. ### Mengapa tidak boleh membagi dengan nol? Membagi a dengan nol memerlukan bilangan c dengan 0 kali c sama dengan a. Nol kali apa pun adalah nol, sehingga ini mustahil bila a bukan nol, dan bila a nol maka setiap c berlaku. Bagaimanapun tidak ada satu jawaban. ### Bagaimana mengetahui bilangan habis dibagi 3 atau 9? Jumlahkan angka-angkanya. Jika jumlah angkanya habis dibagi 3, bilangannya juga, dan jika jumlah angkanya habis dibagi 9, bilangannya juga. Misalnya 522 berjumlah angka 9, sehingga habis dibagi 3 maupun 9. ### Apakah 1 bilangan prima? Bukan. Bilangan prima punya tepat dua pembagi positif, 1 dan dirinya sendiri, sedangkan 1 hanya punya satu pembagi. Mengecualikannya menjaga faktorisasi prima tetap tunggal, sebab jika tidak 6 dapat ditulis 2 kali 3 dan juga 1 kali 2 kali 3. Prima pertama adalah 2. ### Bagaimana memeriksa apakah suatu bilangan prima? Coba bagi dengan bilangan prima sampai akar kuadratnya. Jika tidak ada yang membaginya, ia prima. Kamu boleh berhenti di akar kuadrat karena faktor yang lebih besar akan berpasangan dengan yang lebih kecil yang sudah dicoba. Jadi 97 prima, sedangkan 91 sama dengan 7 kali 13. ### Bagaimana mencari FPB dua bilangan? Ambil tiap faktor prima bersama dengan eksponen yang lebih kecil, atau pakai algoritma Euclid: bagi bilangan yang besar dengan yang kecil, ganti pasangan itu dengan bilangan yang kecil dan sisanya, lalu ulangi. Sisa terakhir yang bukan nol adalah FPB. ### Apa beda FPB dan KPK? FPB adalah bilangan terbesar yang membagi kedua bilangan, sehingga tidak pernah lebih besar dari keduanya. KPK adalah bilangan terkecil yang habis dibagi keduanya, sehingga tidak pernah lebih kecil dari keduanya. Hasil kali keduanya sama dengan hasil kali kedua bilangan. ### Berapa sisa bila bilangan negatif dibagi? Dalam matematika sisa tidak pernah negatif, sehingga minus 7 dibagi 3 bersisa 2, karena minus 7 adalah 3 kali minus 3 ditambah 2. Python sependapat, tetapi JavaScript, C, dan Java mengembalikan minus 1, karena memotong hasil bagi ke arah nol. ### Bagaimana melakukan pembagian bulat di Python? Pakai operator garis miring ganda, yang membulatkan ke bawah, sehingga 7 // 2 adalah 3 dan minus 7 // 2 adalah minus 4. Garis miring tunggal selalu memberi float. Tanda persen memberi sisa, dan divmod mengembalikan hasil bagi dan sisa sekaligus. --- # Algebraic Expressions: Terms, Simplifying, Expanding and Factoring Source: https://nunada.my.id/articles/algebraic-expressions/ Updated: 2026-10-31 ## Quick answer **An algebraic expression is a combination of numbers, letters (variables) and operations, such as $3x^2-5x+7$; it has no equals sign, so it is simplified or evaluated rather than solved.** You simplify it by combining like terms, remove brackets with the distributive law ($a(b+c)=ab+ac$), and reverse that step by factoring ($x^2-9=(x-3)(x+3)$). Every step can be checked by substituting a number for the letter. ### Key takeaways - An expression is built from terms joined by + and −; each term has a coefficient and a variable part, and a term with no letter is a constant. - Only like terms, those with exactly the same letters and exponents, can be combined: $3x+5x=8x$, but $3x+5x^2$ stays as it is. - To evaluate, put each value in brackets in place of its letter and then follow the order of operations. - To expand, multiply every term of one bracket by every term of the other: $(a+b)(c+d)=ac+ad+bc+bd$, and $(a+b)^2=a^2+2ab+b^2$, not $a^2+b^2$. - Factoring undoes expanding: take out a common factor first, then look for a difference of squares, a perfect square, or two numbers with the right product and sum. - In a fraction you can cancel factors but never terms, and the canceled factor must not be zero: $\dfrac{x^2-9}{x+3}=x-3$ only for $x\neq-3$. ## What is an algebraic expression? **An algebraic expression is a mathematical phrase made of numbers, variables (letters standing for numbers) and operations such as +, −, ×, ÷ and powers.** Examples are $2x+3$, $a^2-2ab+b^2$ and $\dfrac{x+1}{x}$. An expression is a phrase, not a sentence: it has no equals sign and nothing to solve, but it has a value once the letters are given values. Expressions are built from **terms**, the parts joined by + or −. Each term has a **coefficient** (the number multiplying the letters) and a **variable part** (the letters with their exponents). A term with no letter is a **constant**. | Term | Coefficient | Variable part | Degree | |---|---|---|---| | $3x^2$ | 3 | $x^2$ | 2 | | $-5x$ | −5 | $x$ | 1 | | $7$ | 7 (a constant) | none | 0 | | $-y$ | −1 | $y$ | 1 | | $4xy$ | 4 | $xy$ | 2 | Three habits make this easier. The sign in front of a term belongs to the term, so $3x^2-5x+7$ has the terms $3x^2$, $-5x$ and $7$. A letter on its own has coefficient 1, so $x=1x$. And the **degree** of a term is the sum of the [exponents](https://nunada.my.id/articles/exponents-and-radicals/#what-is-an-exponent) of its letters, so $4xy$ has degree 2; the degree of an expression is the largest degree among its terms. The usual names are by number of terms: a **monomial** has one term, a **binomial** two and a **trinomial** three. A sum of terms whose letters have whole-number exponents is a **polynomial**; its degree gives it a name, linear (1), quadratic (2) or cubic (3). Not every expression is a polynomial: $\dfrac1x$ and $\sqrt{x}$ are algebraic expressions but not polynomials. A linear expression such as $4n+1$ is also how the $n$-th term of an [arithmetic sequence](https://nunada.my.id/articles/arithmetic-sequences-and-series/#nth-term) is written. **Expression or equation?** An equation has an equals sign and says two expressions are equal, as in $2x+3=11$; you solve it. An expression such as $2x+3$ you simplify, evaluate or factor. Type any expression below to see it taken apart. ## How do you combine like terms? **Like terms have exactly the same variable part, the same letters with the same exponents, and you combine them by adding their coefficients and keeping the variable part: $3x+5x=8x$.** Only the coefficients may differ. | Pair | Like terms? | Why | |---|---|---| | $3x$ and $-7x$ | yes | same letter, same exponent | | $4xy$ and $-xy$ | yes | same variable part $xy$ | | $5$ and $-2$ | yes | both constants | | $3x^2$ and $5x$ | no | exponents differ | | $2xy$ and $2x$ | no | letters differ | **Why it works.** It is the distributive law read backward: $3x+5x=(3+5)x=8x$, as three of something plus five of the same thing is eight of it. That is also why unlike terms cannot be merged: $3x+5x^2$ is three of one thing and five of another, and there is no common thing to count. Worked example: simplify $5x^2+3x-2x^2+7x-4$. 1. Group the like terms: $(5x^2-2x^2)+(3x+7x)-4$. 2. Combine each group: $3x^2+10x-4$. Nothing else can be combined, so $3x^2+10x-4$ is the simplified form. It is conventional to write the terms from the highest degree down. Use the tool below to check any expression you simplify by hand. ## How do you evaluate an algebraic expression? **To evaluate an expression, replace every letter with its value, writing each value in brackets, and then calculate with the usual order of operations: brackets, then powers, then × and ÷, then + and −.** The brackets are what keep negative values safe, and the [order of operations with negative numbers](https://nunada.my.id/articles/integers/#order-of-operations) has traps of its own. Evaluate $2x^2-3x$ at $x=-3$: 1. Substitute in brackets: $2(-3)^2-3(-3)$. 2. Power first: $2\cdot9-3(-3)$. 3. Multiply: $18+9$. 4. Add: $27$. The classic slip is skipping the brackets: $2\cdot-3^2$ would give $-18$, because the power would apply to the 3 alone. A second slip is squaring the coefficient too: in $2x^2$ only $x$ is squared, so at $x=-3$ it is $2\cdot9=18$, not $(2\cdot(-3))^2=36$. A table of values evaluates one expression at many inputs. For $2x^2-3x$: | $x$ | −2 | −1 | 0 | 1 | 2 | |---|---|---|---|---|---| | $2x^2-3x$ | 14 | 5 | 0 | −1 | 2 | **Substitution is also how you test.** Two expressions are equivalent when they have the same value for every input. One input where they differ proves they are not equivalent: $(x+3)^2$ and $x^2+9$ both give 9 at $x=0$, but at $x=1$ they give 16 and 10. The reverse does not hold. Agreeing at a few inputs proves nothing, since $x^2$ and $2x$ agree at both $x=0$ and $x=2$ yet are different expressions. ## How do you expand brackets? **To expand brackets, multiply every term inside by whatever is outside, using the distributive law $a(b+c)=ab+ac$; for two brackets, multiply every term of the first by every term of the second.** For a number outside: $3(x+2)=3x+6$. A minus sign in front of a bracket multiplies by −1 and flips every sign inside: $-(x-4)=-x+4$. For two binomials the rule is $(a+b)(c+d)=ac+ad+bc+bd$, four products. Many classes call this FOIL (first, outer, inner, last), which is the same four products in a fixed order. Example: $(x+2)(x-3)=x\cdot x+x\cdot(-3)+2\cdot x+2\cdot(-3)=x^2-3x+2x-6=x^2-x-6$. **The area model shows why.** A rectangle of width $a+b$ and height $c+d$ has area $(a+b)(c+d)$, the rectangle formula from the [area of a quadrilateral](https://nunada.my.id/articles/quadrilaterals/#perimeter-and-area). Cut it into four pieces and the areas are $ac$, $bc$, $ad$ and $bd$; the pieces make up the whole, so the four products add up to the product of the sums. Move the sliders to see it with numbers. Three products come up so often that they are worth recognizing: | Name | Pattern | Example | |---|---|---| | Square of a sum | $(a+b)^2=a^2+2ab+b^2$ | $(2x+3)^2=4x^2+12x+9$ | | Square of a difference | $(a-b)^2=a^2-2ab+b^2$ | $(x-5)^2=x^2-10x+25$ | | Difference of squares | $(a+b)(a-b)=a^2-b^2$ | $(x+5)(x-5)=x^2-25$ | In the difference of squares the two middle terms $-ab$ and $+ab$ cancel, which is why no $x$ term is left. A square is never just the squares of the parts: $(a+b)^2$ is a product of two brackets, $(a+b)(a+b)$, and the cross terms $ab$ appear twice. The same idea in three dimensions gives the cube of a sum: a cube of edge $a+b$ breaks into one cube $a^3$, three slabs $a^2b$, three rods $ab^2$ and one cube $b^3$, so $(a+b)^3=a^3+3a^2b+3ab^2+b^3$ (see [the cube of a sum](https://nunada.my.id/articles/cube/#cube-numbers)). ## How do you factor an algebraic expression? **To factor an expression is to write it as a product, the reverse of expanding: $x^2-x-6$ becomes $(x+2)(x-3)$.** Work through the same checklist every time, in this order, and check the answer by expanding it again. 1. **Take out the common factor.** $6x^2+9x=3x(2x+3)$, since 3 and $x$ divide both terms. Do this first, because it makes everything after it smaller. 2. **Two terms: a difference of squares?** $a^2-b^2=(a-b)(a+b)$, so $x^2-25=(x-5)(x+5)$ and $4x^2-9=(2x-3)(2x+3)$. A sum of squares such as $x^2+9$ does not factor over the real numbers. 3. **Three terms: a perfect square?** $a^2\pm2ab+b^2=(a\pm b)^2$, so $x^2+6x+9=(x+3)^2$. The test is that the middle term is twice the product of the square roots of the outer terms. 4. **Three terms, leading coefficient 1.** For $x^2+bx+c$ find two numbers whose product is $c$ and whose sum is $b$: they are the numbers in $(x+p)(x+q)$. For $x^2-5x+6$ the numbers are $-2$ and $-3$ (product 6, sum −5), so it is $(x-2)(x-3)$. 5. **Three terms, leading coefficient not 1.** For $ax^2+bx+c$ find two numbers whose product is $ac$ and whose sum is $b$, split the middle term with them, and group. For $2x^2+7x+3$ the product is 6 and the sum 7, so the numbers are 1 and 6: $2x^2+x+6x+3=x(2x+1)+3(2x+1)=(2x+1)(x+3)$. **Reading the signs for $x^2+bx+c$.** If $c$ is positive the two numbers have the same sign, the sign of $b$: $x^2+7x+12=(x+3)(x+4)$ and $x^2-7x+12=(x-3)(x-4)$. If $c$ is negative they have opposite signs, and the larger one takes the sign of $b$: $x^2+2x-15=(x+5)(x-3)$. **Not everything factors.** An expression is fully factored when no factor can be broken further. The trinomial $x^2+x+1$ has no whole-number factors at all, and $x^2-2$ has none with whole numbers, although with radicals it is $(x-\sqrt2)(x+\sqrt2)$. The tool below follows the checklist and says which step it used. > **Always check by expanding** > > Factoring is easy to verify: multiply your factors back out and compare with the start. If $(x-2)(x-3)$ expands to $x^2-5x+6$, you are done. If the middle term is wrong, the two numbers have the right product but the wrong sum, or the wrong signs. ## How do you simplify algebraic fractions? **To simplify an algebraic fraction, factor the top and the bottom, then cancel the factors they share; you may cancel factors, never terms.** This is where factoring pays off. $\dfrac{x^2-9}{x+3}=\dfrac{(x-3)(x+3)}{x+3}=x-3$. $\dfrac{x^2-1}{x^2-x}=\dfrac{(x-1)(x+1)}{x(x-1)}=\dfrac{x+1}{x}$. **Restrictions.** A fraction is undefined where its bottom is zero, and canceling does not remove that. The first fraction above is not defined at $x=-3$, although $x-3$ is. So the honest statement is $\dfrac{x^2-9}{x+3}=x-3$ for $x\neq-3$. Try $x=-3$ in code below: the original gives an error or NaN. **Terms cannot be canceled.** In $\dfrac{x+3}{3}$ the 3 on top is part of a sum, not a factor, so it does not cancel. Test with $x=3$: the fraction is $\dfrac63=2$, while $x+1=4$. What is true is $\dfrac{x+3}{3}=\dfrac x3+1$. **Multiplying and dividing** work as with numbers: multiply tops and bottoms, $\dfrac ab\cdot\dfrac cd=\dfrac{ac}{bd}$, and to divide, multiply by the reciprocal, $\dfrac ab\div\dfrac cd=\dfrac ab\cdot\dfrac dc$. Factor first and cancel before multiplying out. **Adding and subtracting** need a common denominator, just as [fractions of numbers](https://nunada.my.id/articles/rational-numbers/#add-subtract-fractions) such as $\frac12+\frac13$ do: $\dfrac1x+\dfrac1{x+1}=\dfrac{x+1}{x(x+1)}+\dfrac{x}{x(x+1)}=\dfrac{2x+1}{x(x+1)}$. The common denominator is the product of the different factors, here $x(x+1)$, with each fraction rewritten over it. ## How do you turn words into algebra? **To turn words into algebra, name the unknown quantity with a letter and translate each phrase into an operation, taking care over the order of "less than" and "from".** Algebra is a short way of writing a sentence. | In words | In algebra | |---|---| | a number plus 5, or 5 more than $n$ | $n+5$ | | 7 less than twice $n$ | $2n-7$ | | 7 less than $n$ | $n-7$ | | $n$ subtracted from 7 | $7-n$ | | the sum of $n$ and 3, doubled | $2(n+3)$ | | a third of $n$ | $\dfrac n3$ | | the square of the sum of $a$ and $b$ | $(a+b)^2$ | | the sum of the squares of $a$ and $b$ | $a^2+b^2$ | "Less than" and "from" reverse the order: "7 less than $n$" starts from $n$, so it is $n-7$, not $7-n$. **A worked example.** A notebook costs 5 dollars and a pen costs 3 dollars. For $x$ notebooks and $y$ pens the total is $5x+3y$ dollars. With 3 notebooks and 2 pens, substitute: $5\cdot3+3\cdot2=21$ dollars. The expression is a recipe that works for any quantities, and that is the point of using letters. When a problem has two unknown quantities, you write two equations and solve them together: see [systems of linear equations](https://nunada.my.id/articles/linear-systems-two-variables/#word-problems). ## How do you work with algebraic expressions in Python and JavaScript? **In code an expression you want to evaluate becomes a function, and an expression you want to manipulate symbolically needs a library such as SymPy in Python.** Plain Python and JavaScript only calculate with numbers; they do not know that $x^2-9=(x-3)(x+3)$. ```python >>> from sympy import symbols, expand, factor, simplify >>> x = symbols('x') >>> expand((x + 2) * (x - 3)) x**2 - x - 6 >>> factor(x**2 - 5*x + 6) (x - 3)*(x - 2) >>> factor(x**2 + 1) # no real factors, so it is returned unchanged x**2 + 1 >>> simplify((x**2 - 9) / (x + 3)) x - 3 >>> (3*x**2 - 5*x + 1).subs(x, 2) 3 ``` ```javascript const f = (x) => 3 * x ** 2 - 5 * x + 1 f(2) // 3 f(-2) // 23 const g = (x) => (x ** 2 - 9) / (x + 3) g(2) // -1 g(3) // 0, the same as 3 - 3 g(-3) // NaN, because the original is 0 / 0 there ``` ```cpp #include using namespace std; double f(double x) { return 3 * x * x - 5 * x + 1; } double g(double x) { return (x * x - 9) / (x + 3); } int main() { cout << f(2) << " " << f(-2) << endl; // 3 23 cout << g(2) << " " << g(3) << endl; // -1 0 // A program cannot expand or factor for you, but it can test an identity at many points int bad = 0; for (int x = -10; x <= 10; x++) { if ((x + 2) * (x - 3) != x * x - x - 6) bad++; // expand if (x * x - 5 * x + 6 != (x - 2) * (x - 3)) bad++; // factor } cout << "failures: " << bad << endl; return 0; } /* output: 3 23 -1 0 failures: 0 */ ``` The pitfalls, in order of how often they bite: | Pitfall | What happens | What to do | |---|---|---| | `3x` for 3 times x | SyntaxError in both languages | write `3 * x`; code has no implied multiplication | | `2(x + 1)` | TypeError: the 2 is treated as a function | write `2 * (x + 1)` | | `^` for a power | it is XOR, not a power | use `**` | | `x ** 2` in plain Python | NameError until x has a value | give x a number, or use SymPy for a symbol | | Symbolic vs numeric | `x**2 - 9` never becomes `(x - 3)*(x + 3)` by itself | use `factor` in SymPy | | Comparing results | `0.1 * 3` is not exactly `0.3` | compare with a tolerance, as in the [article on real numbers](https://nunada.my.id/articles/real-numbers/#real-numbers-in-code) | A numeric test such as `f(2)` can catch a wrong simplification but cannot prove a right one: it checks one input, exactly the limit described in the section on evaluating. ## What are the common mistakes in algebraic expressions? **The most common mistakes with algebraic expressions are the nine below, each with the correct statement and a number that shows why.** | Mistake | Correct | |---|---| | ❌ $2x+3x=5x^2$ | $2x+3x=5x$. Adding like terms changes the coefficient, not the exponent. | | ❌ $(x+3)^2=x^2+9$ | $(x+3)^2=x^2+6x+9$. Check at $x=1$: 16, not 10. | | ❌ $3(x+2)=3x+2$ | $3(x+2)=3x+6$. The 3 multiplies every term. | | ❌ $-(x-4)=-x-4$ | $-(x-4)=-x+4$. The minus flips every sign inside. | | ❌ $3x+5x^2=8x^3$ | Unlike terms stay apart: $3x+5x^2$ is already simplest. | | ❌ $\dfrac{x+3}{3}=x+1$ | Terms do not cancel: $\dfrac{x+3}{3}=\dfrac x3+1$. | | ❌ $\dfrac{x^2-9}{x+3}=x-9$ | Factor first: it is $x-3$ (for $x\neq-3$). | | ❌ $x^2-16=(x-4)^2$ | $x^2-16=(x-4)(x+4)$. A difference of squares has two different signs. | | ❌ $-x^2=9$ at $x=-3$ | $-x^2=-(-3)^2=-9$. Only $(-x)^2$ is positive. | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: algebraic expressions at a glance - **Parts:** an expression is terms joined by + and −; a term has a coefficient and a variable part, and a term with no letter is a constant. - **Like terms:** same letters, same exponents; add coefficients, keep the variable part. - **Evaluate:** put each value in brackets, then follow the order of operations. A few matching inputs never prove two expressions equal. - **Expand:** $a(b+c)=ab+ac$ and $(a+b)(c+d)=ac+ad+bc+bd$; $(a\pm b)^2=a^2\pm2ab+b^2$; $(a+b)(a-b)=a^2-b^2$. - **Factor:** common factor first, then a difference of squares, a perfect square, or two numbers with product $c$ and sum $b$; check by expanding. - **Fractions:** factor, then cancel factors, never terms; note where the bottom is zero. - **Words:** name the unknown, and watch the order in "less than". - **Code:** write `3 * x`, not `3x`; use `**` for powers; use SymPy for symbolic work. ## Glossary: key terms - **Algebraic expression**: A combination of numbers, variables and operations with no equals sign, such as 3x squared minus 5x plus 7. - **Variable**: A letter that stands for a number that can change or is not yet known. - **Constant**: A term with no variable, whose value never changes, such as the 7 in 3x plus 7. - **Term**: One part of an expression, separated from the others by a plus or minus sign, which carries its own sign. - **Coefficient**: The number that multiplies the variables in a term, as the minus 5 in minus 5x. - **Like terms**: Terms with exactly the same variables raised to the same exponents, which differ at most in their coefficients. - **Polynomial**: A sum of terms in which each variable has a whole-number exponent, such as x squared minus x minus 6. - **Degree**: The largest sum of exponents of the variables in any single term of a polynomial. - **Binomial**: A polynomial with exactly two terms, such as x plus 3. - **Distributive law**: The rule that a times the sum of b and c equals a times b plus a times c. - **Expanding**: Removing brackets by multiplying out a product, so that (x plus 2)(x minus 3) becomes x squared minus x minus 6. - **Factoring**: Writing an expression as a product of simpler expressions, the reverse of expanding. - **Difference of squares**: An expression of the form a squared minus b squared, which factors as a minus b times a plus b. - **Algebraic fraction**: A fraction whose top and bottom are algebraic expressions, defined only where the bottom is not zero. ## Frequently asked questions ### What is an algebraic expression? An algebraic expression is a combination of numbers, variables and operations without an equals sign, such as 3x plus 5 or a squared minus b squared. It has a value once the variables are given values, and it can be simplified, expanded or factored, but not solved. ### What is the difference between an expression and an equation? An equation has an equals sign and states that two expressions are equal, for example 2x plus 3 equals 11, and you solve it for the unknown. An expression has no equals sign, like 2x plus 3, and you simplify it, evaluate it or factor it. ### What are like terms? Like terms have exactly the same variables with the same exponents; only their coefficients may differ. So 3x and minus 7x are like terms, as are 4xy and minus xy, but 3x squared and 5x are not, because the exponents differ. Only like terms can be combined. ### What is a coefficient? The coefficient is the number that multiplies the variables in a term, including its sign. In 4x squared minus 7x plus 2, the coefficients are 4 and minus 7. A variable on its own, such as x, has coefficient 1, and the constant 2 is its own coefficient. ### How do you simplify an algebraic expression? Remove brackets with the distributive law, then group the like terms and add their coefficients, and write the result from the highest degree down. For example 3 times x plus 2, minus 2 times x minus 1, becomes 3x plus 6 minus 2x plus 2, which is x plus 8. ### How do you expand two brackets? Multiply every term in the first bracket by every term in the second, then combine like terms. For x plus 2 times x minus 3 the four products are x squared, minus 3x, 2x and minus 6, which add up to x squared minus x minus 6. ### Why is x plus 3, squared, not x squared plus 9? Because squaring means multiplying the bracket by itself, x plus 3 times x plus 3, and that produces two middle terms: 3x and 3x. The correct result is x squared plus 6x plus 9. A quick check at x equals 1 gives 16 on the left and only 10 for x squared plus 9. ### How do you factor a quadratic expression? First take out any common factor. Then, for x squared plus bx plus c, find two numbers whose product is c and whose sum is b, and write them in two brackets. For x squared minus 5x plus 6 the numbers are minus 2 and minus 3, so it factors as x minus 2 times x minus 3. ### What is a difference of squares? It is an expression of the form a squared minus b squared, which always factors as a minus b times a plus b. For example x squared minus 25 is x minus 5 times x plus 5. A sum of squares such as x squared plus 25 does not factor over the real numbers. ### Can you cancel terms in a fraction? No, only factors can be canceled. In x plus 3 over 3 the 3 on top is part of a sum, so it stays: the result is x over 3 plus 1. To cancel, factor first, as in x squared minus 9 over x plus 3, which becomes x minus 3. ### How do you evaluate an expression with a negative number? Put the negative value in brackets in place of the letter, then follow the order of operations. For 2x squared at x equal to minus 3, write 2 times minus 3, squared, which is 2 times 9, or 18. Without the brackets you would wrongly get minus 18. ### What is the degree of a polynomial? The degree is the highest total of exponents in any single term. In 3x squared minus 5x plus 7 it is 2, so the polynomial is quadratic. The term 4xy has degree 2, because the exponents 1 and 1 add up, and a nonzero constant has degree 0. ### How do you check a factorization? Multiply the factors back out and compare the result with the original expression. If x minus 2 times x minus 3 expands to x squared minus 5x plus 6, the factoring is correct. You can also substitute one number, such as x equals 1, into both forms. ### How do you expand and factor with Python? Use the SymPy library. Create a symbol with symbols, then call expand to remove brackets, factor to write a product, and simplify to reduce a fraction. Plain Python cannot do this because it only calculates with numbers, and the caret is XOR, so write powers with a double asterisk. --- # Bentuk Aljabar: Suku, Penjabaran, dan Pemfaktoran Source: https://nunada.my.id/artikel/bentuk-aljabar/ Updated: 2026-10-31 ## Jawaban singkat **Bentuk aljabar adalah gabungan bilangan, huruf (variabel), dan operasi, seperti $3x^2-5x+7$; ia tidak memuat tanda sama dengan, sehingga ia disederhanakan atau dihitung nilainya, bukan diselesaikan.** Kamu menyederhanakannya dengan menggabungkan suku sejenis, menghilangkan kurung dengan sifat distributif ($a(b+c)=ab+ac$), dan membalik langkah itu dengan memfaktorkan ($x^2-9=(x-3)(x+3)$). Setiap langkah dapat diperiksa dengan mengganti huruf dengan sebuah bilangan. ### Poin penting - Sebuah ekspresi tersusun dari suku-suku yang dihubungkan oleh + dan −; tiap suku punya koefisien dan bagian variabel, dan suku tanpa huruf disebut konstanta. - Hanya suku sejenis, yaitu suku dengan huruf dan eksponen yang persis sama, yang dapat digabung: $3x+5x=8x$, tetapi $3x+5x^2$ dibiarkan. - Untuk menghitung nilai, ganti tiap huruf dengan nilainya di dalam kurung lalu ikuti urutan operasi. - Untuk menjabarkan, kalikan setiap suku dari satu kurung dengan setiap suku dari kurung lainnya: $(a+b)(c+d)=ac+ad+bc+bd$, dan $(a+b)^2=a^2+2ab+b^2$, bukan $a^2+b^2$. - Memfaktorkan membalik penjabaran: keluarkan faktor persekutuan lebih dulu, lalu cari selisih dua kuadrat, kuadrat sempurna, atau dua bilangan dengan hasil kali dan jumlah yang tepat. - Pada pecahan kamu boleh mencoret faktor tetapi tidak pernah suku, dan faktor yang dicoret tidak boleh nol: $\dfrac{x^2-9}{x+3}=x-3$ hanya untuk $x\neq-3$. ## Apa itu bentuk aljabar? **Bentuk aljabar adalah frasa matematika yang tersusun dari bilangan, variabel (huruf yang mewakili bilangan), dan operasi seperti +, −, ×, ÷, serta pangkat.** Contohnya $2x+3$, $a^2-2ab+b^2$, dan $\dfrac{x+1}{x}$. Bentuk aljabar adalah frasa, bukan kalimat: ia tidak punya tanda sama dengan dan tidak ada yang diselesaikan, tetapi ia punya nilai begitu huruf-hurufnya diberi nilai. Bentuk aljabar tersusun dari **suku**, yaitu bagian-bagian yang dihubungkan oleh + atau −. Setiap suku punya **koefisien** (bilangan yang mengalikan huruf) dan **bagian variabel** (huruf beserta eksponennya). Suku tanpa huruf disebut **konstanta**. | Suku | Koefisien | Bagian variabel | Derajat | |---|---|---|---| | $3x^2$ | 3 | $x^2$ | 2 | | $-5x$ | −5 | $x$ | 1 | | $7$ | 7 (sebuah konstanta) | tidak ada | 0 | | $-y$ | −1 | $y$ | 1 | | $4xy$ | 4 | $xy$ | 2 | Tiga kebiasaan membuatnya lebih mudah. Tanda di depan sebuah suku adalah milik suku itu, sehingga $3x^2-5x+7$ memiliki suku $3x^2$, $-5x$, dan $7$. Huruf yang berdiri sendiri berkoefisien 1, sehingga $x=1x$. Dan **derajat** sebuah suku adalah jumlah [eksponen](https://nunada.my.id/artikel/eksponen-dan-akar/#what-is-an-exponent) hurufnya, sehingga $4xy$ berderajat 2; derajat bentuk aljabar adalah derajat terbesar di antara sukunya. Namanya biasanya menurut banyak suku: **monomial** memiliki satu suku, **binomial** dua, dan **trinomial** tiga. Jumlah suku yang hurufnya berpangkat bilangan bulat disebut **polinomial** (suku banyak); derajatnya memberi nama: linear (1), kuadrat (2), atau kubik (3). Tidak semua bentuk aljabar adalah polinomial: $\dfrac1x$ dan $\sqrt{x}$ adalah bentuk aljabar tetapi bukan polinomial. Bentuk linear seperti $4n+1$ juga adalah cara menulis suku ke-$n$ sebuah [barisan aritmetika](https://nunada.my.id/artikel/barisan-dan-deret-aritmetika/#nth-term). **Bentuk aljabar atau persamaan?** Persamaan memiliki tanda sama dengan dan menyatakan dua bentuk aljabar sama, seperti $2x+3=11$; persamaan diselesaikan. Bentuk aljabar seperti $2x+3$ disederhanakan, dihitung nilainya, atau difaktorkan. Ketik bentuk aljabar apa pun di bawah untuk melihatnya diuraikan. ## Bagaimana menggabungkan suku sejenis? **Suku sejenis memiliki bagian variabel yang persis sama, yaitu huruf yang sama dengan eksponen yang sama, dan kamu menggabungkannya dengan menjumlahkan koefisiennya dan mempertahankan bagian variabel: $3x+5x=8x$.** Hanya koefisiennya yang boleh berbeda. | Pasangan | Sejenis? | Alasan | |---|---|---| | $3x$ dan $-7x$ | ya | huruf sama, eksponen sama | | $4xy$ dan $-xy$ | ya | bagian variabel sama, yaitu $xy$ | | $5$ dan $-2$ | ya | keduanya konstanta | | $3x^2$ dan $5x$ | bukan | eksponennya berbeda | | $2xy$ dan $2x$ | bukan | hurufnya berbeda | **Mengapa berlaku.** Ini adalah sifat distributif yang dibaca terbalik: $3x+5x=(3+5)x=8x$, sebab tiga buah sesuatu ditambah lima buah sesuatu yang sama adalah delapan buah. Itu pula sebabnya suku tak sejenis tidak dapat digabung: $3x+5x^2$ adalah tiga buah satu benda dan lima buah benda lain, dan tidak ada benda bersama yang dapat dihitung. Contoh: sederhanakan $5x^2+3x-2x^2+7x-4$. 1. Kelompokkan suku sejenis: $(5x^2-2x^2)+(3x+7x)-4$. 2. Gabungkan tiap kelompok: $3x^2+10x-4$. Tidak ada lagi yang dapat digabung, sehingga $3x^2+10x-4$ adalah bentuk paling sederhananya. Lazimnya suku ditulis dari derajat tertinggi ke terendah. Pakai alat di bawah untuk memeriksa bentuk aljabar apa pun yang kamu sederhanakan sendiri. ## Bagaimana menghitung nilai bentuk aljabar? **Untuk menghitung nilai bentuk aljabar, ganti setiap huruf dengan nilainya, tulis tiap nilai di dalam kurung, lalu hitung dengan urutan operasi biasa: kurung, lalu pangkat, lalu × dan ÷, lalu + dan −.** Kurunglah yang menjaga nilai negatif tetap aman, dan [urutan operasi pada bilangan negatif](https://nunada.my.id/artikel/bilangan-bulat/#order-of-operations) punya jebakannya sendiri. Hitung $2x^2-3x$ pada $x=-3$: 1. Substitusikan di dalam kurung: $2(-3)^2-3(-3)$. 2. Pangkat lebih dulu: $2\cdot9-3(-3)$. 3. Kalikan: $18+9$. 4. Jumlahkan: $27$. Kekeliruan klasik adalah melewatkan kurung: $2\cdot-3^2$ akan memberi $-18$, sebab pangkat hanya berlaku untuk angka 3. Kekeliruan kedua adalah ikut mengkuadratkan koefisien: pada $2x^2$ hanya $x$ yang dikuadratkan, sehingga pada $x=-3$ nilainya $2\cdot9=18$, bukan $(2\cdot(-3))^2=36$. Tabel nilai menghitung satu bentuk aljabar pada banyak masukan. Untuk $2x^2-3x$: | $x$ | −2 | −1 | 0 | 1 | 2 | |---|---|---|---|---|---| | $2x^2-3x$ | 14 | 5 | 0 | −1 | 2 | **Substitusi juga cara menguji.** Dua bentuk aljabar ekuivalen bila nilainya sama untuk setiap masukan. Satu masukan yang memberi nilai berbeda membuktikan keduanya tidak ekuivalen: $(x+3)^2$ dan $x^2+9$ sama-sama bernilai 9 pada $x=0$, tetapi pada $x=1$ nilainya 16 dan 10. Kebalikannya tidak berlaku. Sama pada beberapa masukan tidak membuktikan apa-apa, sebab $x^2$ dan $2x$ sama pada $x=0$ maupun $x=2$ namun merupakan bentuk yang berbeda. ## Bagaimana menjabarkan tanda kurung? **Untuk menjabarkan kurung, kalikan setiap suku di dalam dengan apa yang ada di luar, memakai sifat distributif $a(b+c)=ab+ac$; untuk dua kurung, kalikan setiap suku dari kurung pertama dengan setiap suku dari kurung kedua.** Untuk bilangan di luar: $3(x+2)=3x+6$. Tanda minus di depan kurung mengalikan dengan −1 dan membalik setiap tanda di dalamnya: $-(x-4)=-x+4$. Untuk dua binomial aturannya $(a+b)(c+d)=ac+ad+bc+bd$, empat hasil kali. Banyak kelas menyebutnya FOIL (first, outer, inner, last), yaitu empat hasil kali yang sama dalam urutan tertentu. Contoh: $(x+2)(x-3)=x\cdot x+x\cdot(-3)+2\cdot x+2\cdot(-3)=x^2-3x+2x-6=x^2-x-6$. **Model luas menunjukkan alasannya.** Persegi panjang dengan lebar $a+b$ dan tinggi $c+d$ berluas $(a+b)(c+d)$, rumus persegi panjang dari [luas segiempat](https://nunada.my.id/artikel/segiempat/#perimeter-and-area). Potong menjadi empat bagian dan luasnya $ac$, $bc$, $ad$, dan $bd$; keempat bagian itu menyusun keseluruhannya, sehingga empat hasil kali itu berjumlah sama dengan hasil kali kedua jumlah. Geser penggesernya untuk melihatnya dengan bilangan. Tiga hasil kali begitu sering muncul sehingga layak dikenali: | Nama | Pola | Contoh | |---|---|---| | Kuadrat jumlah | $(a+b)^2=a^2+2ab+b^2$ | $(2x+3)^2=4x^2+12x+9$ | | Kuadrat selisih | $(a-b)^2=a^2-2ab+b^2$ | $(x-5)^2=x^2-10x+25$ | | Selisih dua kuadrat | $(a+b)(a-b)=a^2-b^2$ | $(x+5)(x-5)=x^2-25$ | Pada selisih dua kuadrat, dua suku tengah $-ab$ dan $+ab$ saling meniadakan, itulah sebabnya tidak ada suku $x$ yang tersisa. Kuadrat tidak pernah sekadar kuadrat dari bagian-bagiannya: $(a+b)^2$ adalah hasil kali dua kurung, $(a+b)(a+b)$, dan suku silang $ab$ muncul dua kali. Gagasan yang sama dalam tiga dimensi memberi pangkat tiga suatu jumlah: kubus berusuk $a+b$ terpecah menjadi satu kubus $a^3$, tiga lempeng $a^2b$, tiga batang $ab^2$, dan satu kubus $b^3$, sehingga $(a+b)^3=a^3+3a^2b+3ab^2+b^3$ (lihat [pangkat tiga suatu jumlah](https://nunada.my.id/artikel/kubus/#cube-numbers)). ## Bagaimana memfaktorkan bentuk aljabar? **Memfaktorkan bentuk aljabar berarti menuliskannya sebagai hasil kali, kebalikan dari menjabarkan: $x^2-x-6$ menjadi $(x+2)(x-3)$.** Kerjakan daftar periksa yang sama setiap kali, dengan urutan ini, dan periksa jawabannya dengan menjabarkannya kembali. 1. **Keluarkan faktor persekutuan.** $6x^2+9x=3x(2x+3)$, sebab 3 dan $x$ membagi kedua suku. Lakukan ini lebih dulu, karena langkah-langkah sesudahnya jadi lebih kecil. 2. **Dua suku: selisih dua kuadrat?** $a^2-b^2=(a-b)(a+b)$, sehingga $x^2-25=(x-5)(x+5)$ dan $4x^2-9=(2x-3)(2x+3)$. Jumlah dua kuadrat seperti $x^2+9$ tidak dapat difaktorkan di bilangan real. 3. **Tiga suku: kuadrat sempurna?** $a^2\pm2ab+b^2=(a\pm b)^2$, sehingga $x^2+6x+9=(x+3)^2$. Ujinya, suku tengah sama dengan dua kali hasil kali akar kuadrat dari suku-suku di tepinya. 4. **Tiga suku, koefisien depan 1.** Untuk $x^2+bx+c$ cari dua bilangan yang hasil kalinya $c$ dan jumlahnya $b$: itulah bilangan dalam $(x+p)(x+q)$. Untuk $x^2-5x+6$ bilangannya $-2$ dan $-3$ (hasil kali 6, jumlah −5), sehingga bentuknya $(x-2)(x-3)$. 5. **Tiga suku, koefisien depan bukan 1.** Untuk $ax^2+bx+c$ cari dua bilangan yang hasil kalinya $ac$ dan jumlahnya $b$, pecah suku tengah dengan keduanya, lalu kelompokkan. Untuk $2x^2+7x+3$ hasil kalinya 6 dan jumlahnya 7, sehingga bilangannya 1 dan 6: $2x^2+x+6x+3=x(2x+1)+3(2x+1)=(2x+1)(x+3)$. **Membaca tanda pada $x^2+bx+c$.** Bila $c$ positif, kedua bilangan bertanda sama, yaitu tanda $b$: $x^2+7x+12=(x+3)(x+4)$ dan $x^2-7x+12=(x-3)(x-4)$. Bila $c$ negatif, tandanya berlawanan, dan yang lebih besar mengikuti tanda $b$: $x^2+2x-15=(x+5)(x-3)$. **Tidak semuanya dapat difaktorkan.** Sebuah bentuk terfaktor sepenuhnya bila tidak ada faktor yang dapat dipecah lagi. Trinomial $x^2+x+1$ sama sekali tidak punya faktor bilangan bulat, dan $x^2-2$ tidak punya faktor bilangan bulat, meskipun dengan akar ia menjadi $(x-\sqrt2)(x+\sqrt2)$. Alat di bawah mengikuti daftar periksa itu dan menyebutkan langkah yang dipakainya. > **Selalu periksa dengan menjabarkan** > > Pemfaktoran mudah diverifikasi: kalikan kembali faktor-faktormu dan bandingkan dengan bentuk awal. Jika $(x-2)(x-3)$ dijabarkan menjadi $x^2-5x+6$, selesai. Jika suku tengahnya salah, kedua bilangan punya hasil kali yang benar tetapi jumlah atau tanda yang salah. ## Bagaimana menyederhanakan pecahan aljabar? **Untuk menyederhanakan pecahan aljabar, faktorkan pembilang dan penyebut, lalu coret faktor yang sama; kamu boleh mencoret faktor, tidak pernah suku.** Di sinilah pemfaktoran berguna. $\dfrac{x^2-9}{x+3}=\dfrac{(x-3)(x+3)}{x+3}=x-3$. $\dfrac{x^2-1}{x^2-x}=\dfrac{(x-1)(x+1)}{x(x-1)}=\dfrac{x+1}{x}$. **Pembatas.** Pecahan tidak terdefinisi di tempat penyebutnya nol, dan mencoret tidak menghapus hal itu. Pecahan pertama di atas tidak terdefinisi pada $x=-3$, padahal $x-3$ terdefinisi. Jadi pernyataan yang jujur adalah $\dfrac{x^2-9}{x+3}=x-3$ untuk $x\neq-3$. Coba $x=-3$ pada kode di bawah: bentuk aslinya memberi galat atau NaN. **Suku tidak boleh dicoret.** Pada $\dfrac{x+3}{3}$ angka 3 di atas adalah bagian dari sebuah jumlah, bukan faktor, sehingga tidak dicoret. Ujilah dengan $x=3$: pecahannya $\dfrac63=2$, sedangkan $x+1=4$. Yang benar adalah $\dfrac{x+3}{3}=\dfrac x3+1$. **Perkalian dan pembagian** bekerja seperti pada bilangan: kalikan pembilang dan penyebut, $\dfrac ab\cdot\dfrac cd=\dfrac{ac}{bd}$, dan untuk membagi, kalikan dengan kebalikannya, $\dfrac ab\div\dfrac cd=\dfrac ab\cdot\dfrac dc$. Faktorkan dulu dan coret sebelum mengalikan. **Penjumlahan dan pengurangan** memerlukan penyebut yang sama, seperti pada [pecahan bilangan](https://nunada.my.id/artikel/bilangan-rasional/#add-subtract-fractions) semisal $\frac12+\frac13$: $\dfrac1x+\dfrac1{x+1}=\dfrac{x+1}{x(x+1)}+\dfrac{x}{x(x+1)}=\dfrac{2x+1}{x(x+1)}$. Penyebut bersamanya adalah hasil kali faktor-faktor yang berbeda, di sini $x(x+1)$, dengan tiap pecahan ditulis ulang di atasnya. ## Bagaimana mengubah kalimat menjadi aljabar? **Untuk mengubah kalimat menjadi aljabar, namai besaran yang tidak diketahui dengan sebuah huruf dan terjemahkan tiap frasa menjadi operasi, dengan teliti pada urutan "kurangnya dari" dan "dikurangi dari".** Aljabar adalah cara singkat menulis sebuah kalimat. | Dalam kata | Dalam aljabar | |---|---| | suatu bilangan ditambah 5, atau 5 lebihnya dari $n$ | $n+5$ | | 7 kurangnya dari dua kali $n$ | $2n-7$ | | 7 kurangnya dari $n$ | $n-7$ | | $n$ dikurangkan dari 7 | $7-n$ | | jumlah $n$ dan 3, dilipatduakan | $2(n+3)$ | | sepertiga dari $n$ | $\dfrac n3$ | | kuadrat dari jumlah $a$ dan $b$ | $(a+b)^2$ | | jumlah kuadrat $a$ dan $b$ | $a^2+b^2$ | "Kurangnya dari" dan "dikurangkan dari" membalik urutan: "7 kurangnya dari $n$" bermula dari $n$, sehingga $n-7$, bukan $7-n$. **Contoh.** Sebuah buku tulis berharga Rp5.000 dan sebuah pena Rp3.000. Untuk $x$ buku tulis dan $y$ pena, totalnya $5000x+3000y$ rupiah. Dengan 3 buku tulis dan 2 pena, substitusikan: $5000\cdot3+3000\cdot2=21000$ rupiah, yaitu Rp21.000. Bentuk aljabar itu adalah resep yang berlaku untuk jumlah berapa pun, dan itulah gunanya memakai huruf. Bila sebuah soal memiliki dua besaran yang tidak diketahui, kamu menulis dua persamaan dan menyelesaikannya bersama: lihat [sistem persamaan linear](https://nunada.my.id/artikel/sistem-persamaan-linear-dua-variabel/#word-problems). ## Bagaimana mengolah bentuk aljabar di Python dan JavaScript? **Dalam kode, bentuk aljabar yang ingin dihitung nilainya menjadi sebuah fungsi, dan bentuk yang ingin dimanipulasi secara simbolik memerlukan pustaka seperti SymPy di Python.** Python dan JavaScript biasa hanya menghitung dengan bilangan; keduanya tidak tahu bahwa $x^2-9=(x-3)(x+3)$. ```python >>> from sympy import symbols, expand, factor, simplify >>> x = symbols('x') >>> expand((x + 2) * (x - 3)) x**2 - x - 6 >>> factor(x**2 - 5*x + 6) (x - 3)*(x - 2) >>> factor(x**2 + 1) # no real factors, so it is returned unchanged x**2 + 1 >>> simplify((x**2 - 9) / (x + 3)) x - 3 >>> (3*x**2 - 5*x + 1).subs(x, 2) 3 ``` ```javascript const f = (x) => 3 * x ** 2 - 5 * x + 1 f(2) // 3 f(-2) // 23 const g = (x) => (x ** 2 - 9) / (x + 3) g(2) // -1 g(3) // 0, the same as 3 - 3 g(-3) // NaN, because the original is 0 / 0 there ``` ```cpp #include using namespace std; double f(double x) { return 3 * x * x - 5 * x + 1; } double g(double x) { return (x * x - 9) / (x + 3); } int main() { cout << f(2) << " " << f(-2) << endl; // 3 23 cout << g(2) << " " << g(3) << endl; // -1 0 // A program cannot expand or factor for you, but it can test an identity at many points int bad = 0; for (int x = -10; x <= 10; x++) { if ((x + 2) * (x - 3) != x * x - x - 6) bad++; // expand if (x * x - 5 * x + 6 != (x - 2) * (x - 3)) bad++; // factor } cout << "failures: " << bad << endl; return 0; } /* output: 3 23 -1 0 failures: 0 */ ``` Jebakannya, berurutan dari yang paling sering menggigit: | Jebakan | Yang terjadi | Yang sebaiknya dilakukan | |---|---|---| | `3x` untuk 3 kali x | SyntaxError di kedua bahasa | tulis `3 * x`; kode tidak mengenal perkalian tersirat | | `2(x + 1)` | TypeError: angka 2 dianggap fungsi | tulis `2 * (x + 1)` | | `^` untuk pangkat | itu XOR, bukan pangkat | pakai `**` | | `x ** 2` di Python biasa | NameError sampai x diberi nilai | beri x sebuah bilangan, atau pakai SymPy untuk simbol | | Simbolik lawan numerik | `x**2 - 9` tidak pernah menjadi `(x - 3)*(x + 3)` dengan sendirinya | pakai `factor` di SymPy | | Membandingkan hasil | `0.1 * 3` tidak persis `0.3` | bandingkan dengan toleransi, seperti pada [artikel bilangan real](https://nunada.my.id/artikel/bilangan-real/#real-numbers-in-code) | Uji numerik seperti `f(2)` dapat menangkap penyederhanaan yang salah tetapi tidak dapat membuktikan yang benar: ia memeriksa satu masukan, tepat seperti batas yang dijelaskan pada bagian menghitung nilai. ## Apa kesalahan umum pada bentuk aljabar? **Kesalahan paling umum pada bentuk aljabar adalah sembilan hal berikut, masing-masing dengan pernyataan yang benar dan bilangan yang menunjukkan alasannya.** | Kesalahan | Yang benar | |---|---| | ❌ $2x+3x=5x^2$ | $2x+3x=5x$. Menjumlahkan suku sejenis mengubah koefisien, bukan eksponen. | | ❌ $(x+3)^2=x^2+9$ | $(x+3)^2=x^2+6x+9$. Periksa pada $x=1$: 16, bukan 10. | | ❌ $3(x+2)=3x+2$ | $3(x+2)=3x+6$. Angka 3 mengalikan setiap suku. | | ❌ $-(x-4)=-x-4$ | $-(x-4)=-x+4$. Tanda minus membalik setiap tanda di dalam. | | ❌ $3x+5x^2=8x^3$ | Suku tak sejenis tetap terpisah: $3x+5x^2$ sudah paling sederhana. | | ❌ $\dfrac{x+3}{3}=x+1$ | Suku tidak dicoret: $\dfrac{x+3}{3}=\dfrac x3+1$. | | ❌ $\dfrac{x^2-9}{x+3}=x-9$ | Faktorkan dulu: hasilnya $x-3$ (untuk $x\neq-3$). | | ❌ $x^2-16=(x-4)^2$ | $x^2-16=(x-4)(x+4)$. Selisih dua kuadrat bertanda berbeda di kedua faktor. | | ❌ $-x^2=9$ pada $x=-3$ | $-x^2=-(-3)^2=-9$. Hanya $(-x)^2$ yang positif. | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: bentuk aljabar sekilas - **Bagian:** bentuk aljabar adalah suku-suku yang dihubungkan oleh + dan −; suku memiliki koefisien dan bagian variabel, dan suku tanpa huruf adalah konstanta. - **Suku sejenis:** huruf sama, eksponen sama; jumlahkan koefisien, pertahankan bagian variabel. - **Hitung nilai:** taruh tiap nilai dalam kurung, lalu ikuti urutan operasi. Beberapa masukan yang cocok tidak pernah membuktikan dua bentuk sama. - **Jabarkan:** $a(b+c)=ab+ac$ dan $(a+b)(c+d)=ac+ad+bc+bd$; $(a\pm b)^2=a^2\pm2ab+b^2$; $(a+b)(a-b)=a^2-b^2$. - **Faktorkan:** faktor persekutuan lebih dulu, lalu selisih dua kuadrat, kuadrat sempurna, atau dua bilangan dengan hasil kali $c$ dan jumlah $b$; periksa dengan menjabarkan. - **Pecahan:** faktorkan, lalu coret faktor, bukan suku; perhatikan di mana penyebutnya nol. - **Kalimat:** namai yang tidak diketahui, dan perhatikan urutan pada "kurangnya dari". - **Kode:** tulis `3 * x`, bukan `3x`; pakai `**` untuk pangkat; pakai SymPy untuk kerja simbolik. ## Glosarium: istilah penting - **Bentuk aljabar**: Gabungan bilangan, variabel, dan operasi tanpa tanda sama dengan, seperti 3x kuadrat dikurangi 5x ditambah 7. - **Variabel**: Huruf yang mewakili bilangan yang dapat berubah atau belum diketahui. - **Konstanta**: Suku tanpa variabel yang nilainya tidak pernah berubah, seperti 7 pada 3x ditambah 7. - **Suku**: Satu bagian dari bentuk aljabar yang dipisahkan dari bagian lain oleh tanda plus atau minus, dan membawa tandanya sendiri. - **Koefisien**: Bilangan yang mengalikan variabel dalam sebuah suku, seperti minus 5 pada minus 5x. - **Suku sejenis**: Suku-suku dengan variabel yang persis sama dan eksponen yang sama, yang paling banyak berbeda pada koefisiennya. - **Polinomial (suku banyak)**: Jumlah suku-suku yang tiap variabelnya berpangkat bilangan bulat, seperti x kuadrat dikurangi x dikurangi 6. - **Derajat**: Jumlah eksponen variabel terbesar pada satu suku mana pun dari sebuah polinomial. - **Binomial**: Polinomial dengan tepat dua suku, seperti x ditambah 3. - **Sifat distributif**: Aturan bahwa a kali jumlah b dan c sama dengan a kali b ditambah a kali c. - **Menjabarkan**: Menghilangkan kurung dengan mengalikan sebuah hasil kali, sehingga (x ditambah 2)(x dikurangi 3) menjadi x kuadrat dikurangi x dikurangi 6. - **Memfaktorkan**: Menuliskan bentuk aljabar sebagai hasil kali bentuk-bentuk yang lebih sederhana, kebalikan dari menjabarkan. - **Selisih dua kuadrat**: Bentuk a kuadrat dikurangi b kuadrat, yang difaktorkan menjadi a dikurangi b kali a ditambah b. - **Pecahan aljabar**: Pecahan yang pembilang dan penyebutnya bentuk aljabar, terdefinisi hanya bila penyebutnya bukan nol. ## Pertanyaan yang sering diajukan ### Apa itu bentuk aljabar? Bentuk aljabar adalah gabungan bilangan, variabel, dan operasi tanpa tanda sama dengan, seperti 3x ditambah 5 atau a kuadrat dikurangi b kuadrat. Ia punya nilai begitu variabelnya diberi nilai, dan dapat disederhanakan, dijabarkan, atau difaktorkan, tetapi tidak diselesaikan. ### Apa beda bentuk aljabar dan persamaan? Persamaan memiliki tanda sama dengan dan menyatakan dua bentuk aljabar sama, misalnya 2x ditambah 3 sama dengan 11, dan kamu menyelesaikannya untuk mencari yang tidak diketahui. Bentuk aljabar tidak memiliki tanda sama dengan, seperti 2x ditambah 3, dan kamu menyederhanakan, menghitung nilai, atau memfaktorkannya. ### Apa itu suku sejenis? Suku sejenis memiliki variabel yang persis sama dengan eksponen yang sama; hanya koefisiennya yang boleh berbeda. Jadi 3x dan minus 7x sejenis, begitu pula 4xy dan minus xy, tetapi 3x kuadrat dan 5x tidak, karena eksponennya berbeda. Hanya suku sejenis yang dapat digabung. ### Apa itu koefisien? Koefisien adalah bilangan yang mengalikan variabel dalam sebuah suku, termasuk tandanya. Pada 4x kuadrat dikurangi 7x ditambah 2, koefisiennya adalah 4 dan minus 7. Variabel yang berdiri sendiri, seperti x, berkoefisien 1, dan konstanta 2 adalah koefisiennya sendiri. ### Bagaimana menyederhanakan bentuk aljabar? Hilangkan kurung dengan sifat distributif, lalu kelompokkan suku sejenis dan jumlahkan koefisiennya, dan tulis hasilnya dari derajat tertinggi ke bawah. Misalnya 3 kali x ditambah 2, dikurangi 2 kali x dikurangi 1, menjadi 3x ditambah 6 dikurangi 2x ditambah 2, yaitu x ditambah 8. ### Bagaimana menjabarkan dua kurung? Kalikan setiap suku di kurung pertama dengan setiap suku di kurung kedua, lalu gabungkan suku sejenis. Untuk x ditambah 2 kali x dikurangi 3, empat hasil kalinya adalah x kuadrat, minus 3x, 2x, dan minus 6, yang berjumlah x kuadrat dikurangi x dikurangi 6. ### Mengapa x ditambah 3, dikuadratkan, bukan x kuadrat ditambah 9? Karena mengkuadratkan berarti mengalikan kurung dengan dirinya sendiri, x ditambah 3 kali x ditambah 3, dan itu menghasilkan dua suku tengah: 3x dan 3x. Hasil yang benar adalah x kuadrat ditambah 6x ditambah 9. Pemeriksaan cepat pada x sama dengan 1 memberi 16 di kiri dan hanya 10 untuk x kuadrat ditambah 9. ### Bagaimana memfaktorkan bentuk kuadrat? Pertama keluarkan faktor persekutuan bila ada. Lalu, untuk x kuadrat ditambah bx ditambah c, cari dua bilangan yang hasil kalinya c dan jumlahnya b, dan tulis dalam dua kurung. Untuk x kuadrat dikurangi 5x ditambah 6 bilangannya minus 2 dan minus 3, sehingga difaktorkan menjadi x dikurangi 2 kali x dikurangi 3. ### Apa itu selisih dua kuadrat? Itu adalah bentuk a kuadrat dikurangi b kuadrat, yang selalu difaktorkan menjadi a dikurangi b kali a ditambah b. Misalnya x kuadrat dikurangi 25 adalah x dikurangi 5 kali x ditambah 5. Jumlah dua kuadrat seperti x kuadrat ditambah 25 tidak dapat difaktorkan di bilangan real. ### Bolehkah mencoret suku pada pecahan? Tidak, hanya faktor yang boleh dicoret. Pada x ditambah 3 per 3, angka 3 di atas adalah bagian dari sebuah jumlah, sehingga tetap: hasilnya x per 3 ditambah 1. Untuk mencoret, faktorkan dulu, seperti pada x kuadrat dikurangi 9 per x ditambah 3, yang menjadi x dikurangi 3. ### Bagaimana menghitung bentuk aljabar dengan bilangan negatif? Taruh nilai negatif dalam kurung menggantikan huruf, lalu ikuti urutan operasi. Untuk 2x kuadrat pada x sama dengan minus 3, tulis 2 kali minus 3, dikuadratkan, yaitu 2 kali 9, atau 18. Tanpa kurung kamu akan keliru mendapat minus 18. ### Berapakah derajat suatu polinomial? Derajat adalah jumlah eksponen tertinggi pada satu suku mana pun. Pada 3x kuadrat dikurangi 5x ditambah 7 derajatnya 2, sehingga polinomial itu kuadrat. Suku 4xy berderajat 2, karena eksponen 1 dan 1 dijumlahkan, dan konstanta bukan nol berderajat 0. ### Bagaimana memeriksa hasil pemfaktoran? Kalikan kembali faktor-faktornya dan bandingkan hasilnya dengan bentuk semula. Jika x dikurangi 2 kali x dikurangi 3 dijabarkan menjadi x kuadrat dikurangi 5x ditambah 6, pemfaktorannya benar. Kamu juga dapat mensubstitusikan satu bilangan, misalnya x sama dengan 1, ke kedua bentuk. ### Bagaimana menjabarkan dan memfaktorkan dengan Python? Pakai pustaka SymPy. Buat simbol dengan symbols, lalu panggil expand untuk menghilangkan kurung, factor untuk menulis hasil kali, dan simplify untuk menyederhanakan pecahan. Python biasa tidak dapat melakukannya karena hanya menghitung dengan bilangan, dan tanda sisipan adalah XOR, jadi tulis pangkat dengan dua tanda bintang. --- # Exponents and Radicals: Laws, Rules, Examples and Practice Source: https://nunada.my.id/articles/exponents-and-radicals/ Updated: 2026-10-10 ## Quick answer **An exponent says how many times to multiply a number by itself: in $2^5$ the base 2 is used as a factor five times, so $2^5=32$. A radical undoes it: the $n$-th root of a number is the value that gives that number when raised to the power $n$, so $\sqrt[3]{27}=3$ because $3^3=27$.** The two are one idea, since $a^{1/n}=\sqrt[n]{a}$, and the same five laws handle both. ### Key takeaways - $a^n$ means $n$ copies of $a$ multiplied together; $a$ is the base and $n$ the exponent. - Five laws cover everything: add exponents to multiply powers of one base, subtract to divide, multiply for a power of a power, and a power spreads over a product or a quotient. - $a^0=1$, $a^{-n}=\dfrac{1}{a^n}$ and $a^{1/n}=\sqrt[n]{a}$ are not extra rules to memorize: they are the only values that keep the laws true. - $\sqrt{a}$ is the non-negative root, so $\sqrt{9}=3$ and not ±3, and $\sqrt{x^2}=|x|$. - Simplify a radical by taking perfect powers out of it ($\sqrt{72}=6\sqrt{2}$), and rationalize a denominator by multiplying by the root or by the conjugate. - Scientific notation $a\times10^k$ is the exponent laws at work, and in code the power operator is `**`, not `^`. ## What is an exponent? **An exponent (or power) is a small raised number that says how many times the base is multiplied by itself: $a^n=a\cdot a\cdots a$, with $n$ factors of $a$.** In $2^5$ the base is 2 and the exponent is 5. | Expression | Read as | Expanded | Value | |---|---|---|---| | $5^2$ | five squared | $5\cdot5$ | 25 | | $10^3$ | ten cubed | $10\cdot10\cdot10$ | 1,000 | | $3^4$ | three to the power four | $3\cdot3\cdot3\cdot3$ | 81 | | $2^5$ | two to the power five | $2\cdot2\cdot2\cdot2\cdot2$ | 32 | | $(-2)^3$ | minus two cubed | $(-2)(-2)(-2)$ | −8 | An exponent of 1 changes nothing ($a^1=a$). The words "squared" and "cubed" come from geometry: $5^2$ is the area of a [square](https://nunada.my.id/articles/quadrilaterals/#perimeter-and-area) with side 5, and $10^3$ is the volume of a cube with side 10. Powers grow fast. Each time the exponent goes up by 1, the value is multiplied by the base again: $2^{10}=1{,}024$, $2^{20}=1{,}048{,}576$ and $2^{30}$ is already over a billion. That is why exponents are the language of growth, of computer memory and of very large and very small quantities, and why the successive powers of a number form a [geometric sequence](https://nunada.my.id/articles/geometric-sequences-and-series/#nth-term). ## What are the laws of exponents? **There are five laws of exponents: to multiply powers with the same base add the exponents, to divide subtract them, to raise a power to a power multiply them, and a power of a product or of a quotient is the product or quotient of the powers.** | Law | Rule | Example | |---|---|---| | Product | $a^m\cdot a^n=a^{m+n}$ | $2^3\cdot2^4=2^7=128$ | | Quotient | $\dfrac{a^m}{a^n}=a^{m-n}$ for $a\neq0$ | $\dfrac{5^6}{5^2}=5^4=625$ | | Power of a power | $(a^m)^n=a^{mn}$ | $(3^2)^3=3^6=729$ | | Power of a product | $(ab)^n=a^nb^n$ | $(2\cdot5)^3=2^3\cdot5^3=1{,}000$ | | Power of a quotient | $\left(\dfrac{a}{b}\right)^n=\dfrac{a^n}{b^n}$ for $b\neq0$ | $\left(\dfrac{2}{3}\right)^2=\dfrac{4}{9}$ | **Why the product law works.** Count the factors: $2^3\cdot2^4=(2\cdot2\cdot2)(2\cdot2\cdot2\cdot2)$ has $3+4=7$ factors of 2, so it is $2^7$. The other laws come from counting in the same way. **The laws need one thing in common.** The product and quotient laws combine powers of the same base: $2^3\cdot2^4=2^7$, but $2^3\cdot3^4$ cannot be combined into one power. Try the laws on numbers of your own below, and see both sides calculated exactly. ## What do zero, negative and fractional exponents mean? **$a^0=1$ for any $a\neq0$, $a^{-n}=\dfrac{1}{a^n}$, and $a^{1/n}=\sqrt[n]{a}$: these are not extra rules to memorize but the only values that keep the laws of exponents true.** Counting factors cannot explain an exponent of 0 or of −3, so mathematicians ask what value the laws force. - **Zero.** The product law says $a^m\cdot a^0=a^{m+0}=a^m$. Multiplying $a^m$ by $a^0$ changes nothing, so $a^0$ must be 1. - **Negative.** $a^n\cdot a^{-n}=a^{0}=1$. Something that multiplies $a^n$ to give 1 is its reciprocal, so $a^{-n}=\dfrac{1}{a^n}$. A negative exponent does not make the number negative: $2^{-3}=\dfrac18$, not $-8$. - **Fractional.** $\left(a^{1/n}\right)^n=a^{\frac1n\cdot n}=a^1=a$. A number whose $n$-th power is $a$ is an $n$-th root, so $a^{1/n}=\sqrt[n]{a}$. More generally $a^{m/n}=\left(a^{1/n}\right)^m=\sqrt[n]{a^m}$, so any [rational number](https://nunada.my.id/articles/rational-numbers/) can be an exponent. The pattern is easiest to see by walking down the powers of 2. Each step down divides by 2: $2^4=16$, $2^3=8$, $2^2=4$, $2^1=2$, $2^0=1$, $2^{-1}=\frac12$, $2^{-2}=\frac14$, $2^{-3}=\frac18$. Use the widget to try another base. > **What about 0⁰?** > > In algebra $0^0$ is left undefined, because two rules disagree: "anything to the power 0 is 1" says 1, and "0 to any positive power is 0" says 0. In programming and in combinatorics it is defined as 1 by convention, so `0 ** 0` is 1 in both Python and JavaScript. > **Negative bases and fractional exponents** > > Be careful with a negative base. $(-8)^{1/3}=-2$ is fine, since a cube root of a negative number is real. But $(-4)^{1/2}$ is not a real number, because no real number squared is negative. Reduce $\frac{m}{n}$ to lowest terms before you evaluate, as $(-8)^{2/6}$ and $(-8)^{1/3}$ must mean the same thing. ## What is a radical (root)? **The $n$-th root of $a$, written $\sqrt[n]{a}$, is the number that gives $a$ when it is raised to the power $n$; $\sqrt{a}$ (index 2) is the square root and $\sqrt[3]{a}$ is the cube root.** In $\sqrt[n]{a}$ the symbol $\sqrt{\ }$ is the radical sign, $a$ is the radicand and $n$ is the index. - **Square root:** $\sqrt{49}=7$ because $7^2=49$. - **Cube root:** $\sqrt[3]{125}=5$ because $5^3=125$, and $\sqrt[3]{-8}=-2$ because $(-2)^3=-8$. - **Principal root:** $\sqrt{9}=3$, not $\pm3$. The radical sign always means the non-negative root. The equation $x^2=9$ has two solutions, $x=3$ and $x=-3$, which is why a solution step writes $x=\pm\sqrt{9}$. - **Even and odd roots:** an even root of a negative number is not real ($\sqrt{-4}$), but an odd root of a negative number is ($\sqrt[3]{-27}=-3$). - **A root of a square:** $\sqrt{x^2}=|x|$, not $x$, because the result may not be negative: $\sqrt{(-5)^2}=\sqrt{25}=5$. - **A root in geometry:** the diagonal of a unit square is $\sqrt{1^2+1^2}=\sqrt2$, by the [Pythagorean theorem](https://nunada.my.id/articles/pythagorean-theorem/#what-is-the-theorem). | $n$ | $n^2$ | $n$ | $n^3$ | |---|---|---|---| | 1 | 1 | 1 | 1 | | 2 | 4 | 2 | 8 | | 3 | 9 | 3 | 27 | | 4 | 16 | 4 | 64 | | 5 | 25 | 5 | 125 | | 6 | 36 | 6 | 216 | | 7 | 49 | 7 | 343 | | 8 | 64 | 8 | 512 | | 9 | 81 | 9 | 729 | | 10 | 100 | 10 | 1,000 | | 11 to 15 | 121, 144, 169, 196, 225 | | | A root of a whole number is either a whole number (when the number is a perfect power, as in the table) or an irrational number: for a positive integer $a$, $\sqrt{a}$ is irrational exactly when $a$ is not a perfect square. That is why the decimal expansions of $\sqrt{2}$, $\sqrt{3}$ and $\sqrt{72}$ are infinite and never periodic; the article on [irrational numbers](https://nunada.my.id/articles/irrational-numbers/#which-roots-are-irrational) shows how to test any root. > **Where the notation comes from** > > The radical sign $\sqrt{\ }$ first appeared in print in Christoff Rudolff's Die Coss (1525). The raised exponent, as in $a^2$ and $a^3$, was popularized by René Descartes in La Géométrie (1637). Giving meaning to negative and fractional exponents is usually credited to John Wallis (1656) and Isaac Newton (1676), who began writing roots as powers. ## How do you simplify a radical? **To simplify a radical, factor the number under the root, take every group of $n$ equal factors out of an $n$-th root, and multiply what comes out: $\sqrt{72}=\sqrt{2^3\cdot3^2}=3\cdot2\sqrt{2}=6\sqrt{2}$.** Follow these steps, shown for $\sqrt{72}$: 1. Factor the radicand into [primes](https://nunada.my.id/articles/integers/#primes): $72=2\cdot2\cdot2\cdot3\cdot3$. 2. Group equal primes in sets as large as the index (pairs for a square root): $(2\cdot2)\cdot2\cdot(3\cdot3)$. 3. Take one prime out for each group; what has no partner stays inside: the pair of 2s gives 2, the pair of 3s gives 3, and one 2 stays under the root. 4. Multiply what came out: $2\cdot3=6$, so $\sqrt{72}=6\sqrt{2}$. The rules behind it, for $a,b\ge0$: $\sqrt{ab}=\sqrt{a}\cdot\sqrt{b}$ and $\sqrt{\dfrac{a}{b}}=\dfrac{\sqrt{a}}{\sqrt{b}}$ for $b>0$. For a cube root take groups of three: $\sqrt[3]{54}=\sqrt[3]{2\cdot3^3}=3\sqrt[3]{2}$. **Adding radicals.** Only like radicals, those with the same index and radicand, combine: $3\sqrt{2}+5\sqrt{2}=8\sqrt{2}$. Two different-looking roots may turn out alike once simplified: $\sqrt{50}+\sqrt{8}=5\sqrt{2}+2\sqrt{2}=7\sqrt{2}$. But $\sqrt{a+b}$ is not $\sqrt{a}+\sqrt{b}$: $\sqrt{9+16}=5$, not $3+4$. Try any number below. Switch the index to see cube roots and higher roots. ## How do you rationalize a denominator? **To rationalize a denominator, multiply the top and bottom of the fraction by a number that removes the root from the bottom: by the root itself for $\dfrac{a}{\sqrt{b}}$, and by the conjugate for $\dfrac{a}{p+\sqrt{q}}$.** Multiplying top and bottom by the same non-zero number does not change the value of a fraction. - **A single root.** $\dfrac{6}{\sqrt{3}}=\dfrac{6\cdot\sqrt{3}}{\sqrt{3}\cdot\sqrt{3}}=\dfrac{6\sqrt{3}}{3}=2\sqrt{3}$, because $\sqrt{3}\cdot\sqrt{3}=3$. - **A sum or difference.** The conjugate of $p+\sqrt{q}$ is $p-\sqrt{q}$ (flip the sign). Their product is a difference of squares, which has no root left: $(p+\sqrt{q})(p-\sqrt{q})=p^2-q$. For example $\dfrac{1}{1+\sqrt{2}}=\dfrac{1\cdot(1-\sqrt{2})}{(1+\sqrt{2})(1-\sqrt{2})}=\dfrac{1-\sqrt{2}}{1-2}=\dfrac{1-\sqrt{2}}{-1}=\sqrt{2}-1$. **How to rationalize a denominator**, in short: (1) choose the root, or the conjugate when the bottom is a sum or a difference; (2) multiply the top and the bottom by it; (3) simplify, and cancel any common factor. Rationalizing is a convention, not a correction: $\dfrac{1}{\sqrt{2}}$ and $\dfrac{\sqrt{2}}{2}$ are the same number. The second is the expected form, and it is easier to estimate by hand, since $\sqrt{2}\approx1.414$ gives about $0.707$. ## How are radicals and fractional exponents connected? **A radical is a fractional exponent: $\sqrt[n]{a}=a^{1/n}$ and $\sqrt[n]{a^m}=\left(\sqrt[n]{a}\right)^m=a^{m/n}$, so every law of exponents also works for roots.** | Radical form | Exponent form | Value | |---|---|---| | $\sqrt{9}$ | $9^{1/2}$ | 3 | | $\sqrt[3]{27}$ | $27^{1/3}$ | 3 | | $\sqrt[3]{8^2}$ | $8^{2/3}$ | 4 | | $\dfrac{1}{\sqrt{16}}$ | $16^{-1/2}$ | $\dfrac14$ | | $\sqrt[4]{16^3}$ | $16^{3/4}$ | 8 | **How to evaluate $a^{m/n}$:** 1. Take the $n$-th root of the base (the denominator of the exponent): $8^{2/3}$ starts with $\sqrt[3]{8}=2$. 2. Raise the result to the power $m$ (the numerator): $2^2=4$. 3. If the exponent is negative, take the reciprocal: $8^{-2/3}=\dfrac{1}{8^{2/3}}=\dfrac14$. Taking the root first keeps the numbers small, which is why this order is best by hand. The exponent form is also the only way to combine roots with different indexes. Since $\sqrt{2}=2^{1/2}$ and $\sqrt[3]{2}=2^{1/3}$, the product law gives $\sqrt{2}\cdot\sqrt[3]{2}=2^{1/2+1/3}=2^{5/6}=\sqrt[6]{32}$. Try your own below. ## How do you solve equations with exponents and roots? **To solve an exponent equation write both sides with the same base and equate the exponents; to solve a radical equation isolate the root, raise both sides to the index, solve, and check every answer, because raising to a power can create false solutions.** **Exponent equations (same base).** - $2^x=32\;\Rightarrow\;2^x=2^5\;\Rightarrow\;x=5$. - $9^x=27$, so $(3^2)^x=3^3$, so $3^{2x}=3^3$, so $2x=3$, so $x=\dfrac32$. - A power on the unknown: $x^3=27\;\Rightarrow\;x=3$ (an odd power has one real root), but $x^2=9\;\Rightarrow\;x=\pm3$ (an even power has two). **Radical equations.** $\sqrt{x+1}=3\;\Rightarrow\;x+1=9\;\Rightarrow\;x=8$, and the check $\sqrt{8+1}=3$ holds. **Always check.** Squaring both sides can add answers that do not fit the original equation, called extraneous solutions. Take $\sqrt{x+2}=x$: 1. Square both sides: $x+2=x^2$. 2. Rearrange: $x^2-x-2=0$, which factorizes as $(x-2)(x+1)=0$, so $x=2$ or $x=-1$. 3. Check $x=2$: $\sqrt{4}=2$ ✓. Check $x=-1$: $\sqrt{1}=1$, which is not $-1$ ✗. Only $x=2$ is a solution. The root sign is never negative, so the right side cannot be negative either. ## How do you write numbers in scientific notation? **Scientific notation writes a number as $a\times10^k$ with $1\le a<10$ and $k$ an integer: move the decimal point until one non-zero digit is left of it, and let $k$ count the places moved.** Moving left makes $k$ positive and moving right makes it negative. | Quantity | Ordinary number | Scientific notation | |---|---|---| | Speed of light in a vacuum | 299,792,458 m/s | $2.99792458\times10^{8}$ m/s | | Avogadro constant | 602,214,076,000,000,000,000,000 per mole | $6.02214076\times10^{23}$ per mole | | One astronomical unit | 149,597,870,700 m | $1.495978707\times10^{11}$ m | | A small length | 0.00045 m | $4.5\times10^{-4}$ m | The first three values are exact by definition in the International System of Units. Scientific notation is the laws of exponents at work. To multiply, multiply the numbers and add the exponents: $(3\times10^{5})(2\times10^{4})=6\times10^{9}$. To divide, divide the numbers and subtract the exponents. To add, first give both numbers the same power of 10. ## How do you calculate exponents and roots in Python and JavaScript? **In Python and JavaScript the power operator is a double asterisk, not the caret (which is bitwise XOR), and a root is a power of `1/n` or a function such as `math.sqrt` and `Math.cbrt`.** ```python >>> 2 ** 10 1024 >>> 2 ** -3 0.125 >>> 16 ** 0.5 4.0 >>> 27 ** (1/3) 3.0 >>> import math >>> math.sqrt(72) 8.48528137423857 >>> math.isqrt(72) # whole-number square root, rounded down 8 >>> (-8) ** (1/3) # a negative base with a fractional exponent (1.0000000000000002+1.7320508075688772j) >>> 2 ^ 3 # XOR, not a power 1 ``` ```javascript 2 ** 10 // 1024 2 ** -3 // 0.125 Math.sqrt(72) // 8.48528137423857 Math.cbrt(-8) // -2 (-8) ** (1 / 3) // NaN (-2) ** 2 // 4 (-2 ** 2 is a SyntaxError) Math.sqrt(2) ** 2 // 2.0000000000000004 2n ** 100n // 1267650600228229401496703205376n (BigInt stays exact) ``` ```cpp #include #include #include using namespace std; int isqrt(int n) { // the whole-number square root, rounded down int r = 0; while ((r + 1) * (r + 1) <= n) r++; return r; } int main() { printf("%.0f %.3f %.0f\n", pow(2, 10), pow(2, -3), pow(16, 0.5)); printf("%.12f\n", sqrt(72)); cout << isqrt(72) << endl; printf("%.12f %.12f\n", pow(27, 1.0 / 3), -pow(8, 1.0 / 3)); // a cube root of a negative: take the sign out // pow(-8, 1.0 / 3) is nan: a negative base needs a whole-number exponent cout << (2 ^ 3) << endl; // XOR, not a power printf("%.16f\n", sqrt(2) * sqrt(2)); // rounding, not a bug int p = 1; for (int i = 0; i < 30; i++) p *= 2; // 2^30 fits in an int; 2^31 would overflow cout << p << endl; return 0; } /* output: 1024 0.125 4 8.485281374239 8 3.000000000000 -2.000000000000 1 2.0000000000000004 1073741824 */ ``` The pitfalls, in order of how often they bite: | Pitfall | What happens | What to do | |---|---|---| | `^` for a power | it is XOR: `2 ^ 3` is 1 | use `**`, or `pow(2, 3)` in Python and `Math.pow(2, 3)` in JavaScript | | `-2 ** 2` | Python gives −4; JavaScript refuses it as a SyntaxError | write `(-2) ** 2` or `-(2 ** 2)` so the meaning is clear | | Negative base, fractional exponent | Python returns a complex number; JavaScript returns NaN | use `Math.cbrt` for cube roots; check the sign first | | Roots and rounding | `Math.sqrt(2) ** 2` is `2.0000000000000004` | compare with a tolerance, as in the [article on real numbers](https://nunada.my.id/articles/real-numbers/#real-numbers-in-code) | | Very large powers | JavaScript numbers lose exactness beyond 2⁵³; Python integers do not | use `BigInt` in JavaScript, or Python's `int` | | `0 ** 0` | it is 1 in both languages | remember it is a convention, not a theorem | Use `math.isqrt` in Python when you need the whole-number part of a square root: it is exact for any size of integer, while `math.sqrt` works with floating-point numbers (floats). ## What are the common mistakes with exponents and radicals? **The most common mistakes with exponents and radicals are the nine below, each with the correct statement and a number that shows why.** | Mistake | Correct | |---|---| | ❌ $(a+b)^2=a^2+b^2$ | $(a+b)^2=a^2+2ab+b^2$. Check: $(1+2)^2=9$, not $1+4=5$. See [expanding brackets](https://nunada.my.id/articles/algebraic-expressions/#expand). | | ❌ $\sqrt{a+b}=\sqrt{a}+\sqrt{b}$ | False in general: $\sqrt{9+16}=5$, not $3+4=7$. | | ❌ $-3^2=9$ | $-3^2=-(3\cdot3)=-9$. Only $(-3)^2=9$. | | ❌ $2^{-3}=-8$ | $2^{-3}=\dfrac18$. A negative exponent is a reciprocal. | | ❌ $a^m\cdot a^n=a^{mn}$ | Exponents add: $a^{m+n}$. It is $(a^m)^n$ that multiplies them. | | ❌ $2^3\cdot3^3=6^6$ | $2^3\cdot3^3=6^3$. Bases multiply only when the exponents are equal. | | ❌ $\sqrt{x^2}=x$ | $\sqrt{x^2}=|x|$. Check: $\sqrt{(-5)^2}=5$, not $-5$. | | ❌ $a^0=0$ | $a^0=1$ for $a\neq0$. | | ❌ $\dfrac{1}{\sqrt{2}}$ is already simplest | The value is right, but the expected form has no root below: $\dfrac{\sqrt{2}}{2}$. | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: exponents and radicals at a glance - **Exponent:** $a^n$ is $n$ factors of $a$; the base is $a$ and the exponent is $n$. - **Five laws:** $a^ma^n=a^{m+n}$, $\dfrac{a^m}{a^n}=a^{m-n}$, $(a^m)^n=a^{mn}$, $(ab)^n=a^nb^n$, $\left(\dfrac ab\right)^n=\dfrac{a^n}{b^n}$. - **Forced values:** $a^0=1$ ($a\neq0$), $a^{-n}=\dfrac1{a^n}$, $a^{1/n}=\sqrt[n]{a}$, $a^{m/n}=\left(\sqrt[n]{a}\right)^m$. - **Roots:** $\sqrt{x^2}=|x|$; an even root of a negative number is not real; $\sqrt{a+b}\neq\sqrt{a}+\sqrt{b}$. - **Simplify** by taking groups of $n$ equal prime factors out of an $n$-th root; **rationalize** with the root or the conjugate. - **Equations:** equal bases give equal exponents; check every radical solution. - **Scientific notation:** $a\times10^k$ with $1\le a<10$; in code use `**`, not `^`. ## Glossary: key terms - **Exponent (power)**: The small raised number that says how many times the base is multiplied by itself, as the 5 in 2 to the power 5. - **Base**: The number that is multiplied by itself in a power, as the 2 in 2 to the power 5. - **Radical (root)**: The n-th root of a number is the value that gives that number when raised to the power n, written with the radical sign. - **Radicand**: The number written under the radical sign, such as 72 in the square root of 72. - **Index**: The small number on the radical sign that says which root is taken; 2 is a square root and 3 is a cube root. - **Principal square root**: The non-negative square root, which is what the radical sign means: the square root of 9 is 3, not plus or minus 3. - **Perfect square**: A whole number that is the square of a whole number, such as 1, 4, 9, 16 and 25. - **Rational exponent**: A fractional exponent m over n, meaning the n-th root of the base raised to the power m. - **Conjugate**: For p plus the square root of q, the expression p minus the square root of q; their product has no root. - **Rationalizing the denominator**: Multiplying the top and bottom of a fraction by a number that removes the root from the denominator. - **Scientific notation**: A way of writing a number as a times 10 to the power k, with a at least 1 and less than 10. - **Extraneous solution**: A value that solves the equation after squaring both sides but fails in the original equation. ## Frequently asked questions ### What is an exponent? An exponent is the small raised number in a power such as 2 to the power 5. It tells you how many times the base is used as a factor, so 2 to the power 5 is 2 times 2 times 2 times 2 times 2, which is 32. ### What does a negative exponent mean? A negative exponent means the reciprocal of the power with the positive exponent: 2 to the power minus 3 is 1 over 2 cubed, which is 1/8. It does not make the number negative. The rule keeps the laws of exponents working. ### Why is any number to the power 0 equal to 1? Because the product law must keep working. Multiplying a to the power m by a to the power 0 gives a to the power m plus 0, which is a to the power m again, so a to the power 0 has to be 1. This holds for every a except 0. ### What is 0 to the power 0? In algebra it is undefined, because the rule that anything to the power 0 is 1 and the rule that 0 to a positive power is 0 disagree. In programming and combinatorics it is defined as 1 by convention, and Python and JavaScript both return 1. ### What is the square root of a negative number? It is not a real number, because no real number squared is negative. Mathematicians define the imaginary unit i with i squared equal to minus 1, so the square root of minus 4 is 2i. These belong to the complex numbers. ### Why is the square root of x squared the absolute value of x? The square root sign always gives the non-negative root. If x is negative, such as minus 5, then x squared is 25 and its square root is 5, which is minus x. So the answer is x when x is at least 0 and minus x otherwise: the absolute value of x. ### How do you simplify a square root? Factor the number under the root into primes, pair up equal primes, take one of each pair out of the root, and multiply what came out. For 72 that is 2 times 2 times 2 times 3 times 3, so the square root of 72 is 2 times 3 times the square root of 2, or 6 root 2. ### How do you rationalize a denominator? Multiply the top and bottom of the fraction by a number that removes the root from the bottom. For a single root such as 6 over root 3 multiply by root 3 to get 2 root 3. For a sum such as 1 over 1 plus root 2, multiply by the conjugate, 1 minus root 2. ### What does a fractional exponent mean? A fractional exponent is a root combined with a power. The exponent 1 over n means the n-th root, and m over n means take the n-th root and then raise it to the power m. So 8 to the power 2 over 3 is the cube root of 8, which is 2, squared, which is 4. ### Is the square root of 2 plus the square root of 3 equal to the square root of 5? No. The square root of a sum is not the sum of the square roots. The left side is about 1.414 plus 1.732, which is 3.146, while the square root of 5 is about 2.236. Roots can be added only when they are like radicals. ### What is the difference between (−2)² and −2²? Minus 2 in brackets, squared, is minus 2 times minus 2, which is 4. Without brackets the exponent applies only to the 2, so minus 2 squared is minus (2 times 2), which is minus 4. The brackets decide what is being squared. ### How do you write a number in scientific notation? Move the decimal point until exactly one non-zero digit is to its left, then multiply by 10 raised to the number of places you moved. Moving left gives a positive exponent and moving right a negative one, so 45,000 is 4.5 times 10 to the 4 and 0.00045 is 4.5 times 10 to the minus 4. ### How do you calculate a power in Python? Use the double asterisk operator, which gives 1024 for two to the power ten, or the pow function. The caret is not a power in Python: it is bitwise XOR. For square roots use math.sqrt, and for the whole-number part of a square root use math.isqrt. ### Are all radicals irrational numbers? No. A root of a whole number is irrational only when the number is not a perfect power of that index. The square root of 16 is 4 and the cube root of 27 is 3, both rational, while the square root of 2 and the cube root of 5 are irrational. --- # Eksponen dan Akar: Sifat Bilangan Berpangkat dan Bentuk Akar Source: https://nunada.my.id/artikel/eksponen-dan-akar/ Updated: 2026-10-10 ## Jawaban singkat **Eksponen menyatakan berapa kali sebuah bilangan dikalikan dengan dirinya sendiri: pada $2^5$ basis 2 dipakai sebagai faktor sebanyak lima kali, sehingga $2^5=32$. Akar membalikkannya: akar pangkat $n$ dari sebuah bilangan adalah nilai yang menghasilkan bilangan itu bila dipangkatkan $n$, sehingga $\sqrt[3]{27}=3$ karena $3^3=27$.** Keduanya satu gagasan, sebab $a^{1/n}=\sqrt[n]{a}$, dan lima hukum yang sama berlaku untuk keduanya. ### Poin penting - $a^n$ berarti $n$ salinan $a$ yang dikalikan; $a$ adalah basis dan $n$ adalah eksponen. - Lima hukum mencakup semuanya: jumlahkan eksponen untuk mengalikan pangkat dengan basis sama, kurangkan untuk membagi, kalikan untuk pangkat dari pangkat, dan pangkat menyebar ke perkalian atau pembagian. - $a^0=1$, $a^{-n}=\dfrac{1}{a^n}$, dan $a^{1/n}=\sqrt[n]{a}$ bukan aturan tambahan yang harus dihafal: itulah satu-satunya nilai yang menjaga hukum-hukumnya tetap benar. - $\sqrt{a}$ adalah akar yang tidak negatif, sehingga $\sqrt{9}=3$ dan bukan ±3, serta $\sqrt{x^2}=|x|$. - Sederhanakan bentuk akar dengan mengeluarkan pangkat sempurna darinya ($\sqrt{72}=6\sqrt{2}$), dan rasionalkan penyebut dengan mengalikan dengan akarnya atau dengan bentuk sekawannya. - Notasi ilmiah $a\times10^k$ adalah hukum eksponen yang bekerja, dan dalam kode operator pangkat adalah `**`, bukan `^`. ## Apa itu eksponen? **Eksponen (atau pangkat) adalah bilangan kecil yang ditulis di atas dan menyatakan berapa kali basis dikalikan dengan dirinya sendiri: $a^n=a\cdot a\cdots a$, dengan $n$ faktor $a$.** Pada $2^5$ basisnya 2 dan eksponennya 5. | Ekspresi | Dibaca | Dijabarkan | Nilai | |---|---|---|---| | $5^2$ | lima kuadrat | $5\cdot5$ | 25 | | $10^3$ | sepuluh pangkat tiga | $10\cdot10\cdot10$ | 1.000 | | $3^4$ | tiga pangkat empat | $3\cdot3\cdot3\cdot3$ | 81 | | $2^5$ | dua pangkat lima | $2\cdot2\cdot2\cdot2\cdot2$ | 32 | | $(-2)^3$ | minus dua pangkat tiga | $(-2)(-2)(-2)$ | −8 | Eksponen 1 tidak mengubah apa pun ($a^1=a$). Istilah "kuadrat" dan "kubik" berasal dari geometri: $5^2$ adalah luas [persegi](https://nunada.my.id/artikel/segiempat/#perimeter-and-area) dengan sisi 5, dan $10^3$ adalah volume kubus dengan rusuk 10. Pangkat tumbuh dengan cepat. Setiap kali eksponen naik 1, nilainya dikalikan basis sekali lagi: $2^{10}=1.024$, $2^{20}=1.048.576$, dan $2^{30}$ sudah lebih dari satu miliar. Itulah sebabnya eksponen menjadi bahasa pertumbuhan, memori komputer, serta besaran yang sangat besar dan sangat kecil, dan mengapa pangkat berurutan dari suatu bilangan membentuk [barisan geometri](https://nunada.my.id/artikel/barisan-dan-deret-geometri/#nth-term). ## Apa saja hukum eksponen? **Ada lima hukum eksponen: untuk mengalikan pangkat dengan basis sama, jumlahkan eksponennya; untuk membagi, kurangkan; untuk memangkatkan pangkat, kalikan eksponennya; dan pangkat dari perkalian atau pembagian adalah perkalian atau pembagian dari pangkat-pangkatnya.** | Hukum | Aturan | Contoh | |---|---|---| | Perkalian | $a^m\cdot a^n=a^{m+n}$ | $2^3\cdot2^4=2^7=128$ | | Pembagian | $\dfrac{a^m}{a^n}=a^{m-n}$ untuk $a\neq0$ | $\dfrac{5^6}{5^2}=5^4=625$ | | Pangkat dari pangkat | $(a^m)^n=a^{mn}$ | $(3^2)^3=3^6=729$ | | Pangkat dari perkalian | $(ab)^n=a^nb^n$ | $(2\cdot5)^3=2^3\cdot5^3=1.000$ | | Pangkat dari pembagian | $\left(\dfrac{a}{b}\right)^n=\dfrac{a^n}{b^n}$ untuk $b\neq0$ | $\left(\dfrac{2}{3}\right)^2=\dfrac{4}{9}$ | **Mengapa hukum perkalian berlaku.** Hitung faktornya: $2^3\cdot2^4=(2\cdot2\cdot2)(2\cdot2\cdot2\cdot2)$ memiliki $3+4=7$ faktor 2, sehingga hasilnya $2^7$. Hukum lainnya berasal dari cara menghitung yang sama. **Hukum-hukum itu membutuhkan satu syarat.** Hukum perkalian dan pembagian menggabungkan pangkat dengan basis yang sama: $2^3\cdot2^4=2^7$, tetapi $2^3\cdot3^4$ tidak dapat digabung menjadi satu pangkat. Coba hukum-hukum ini dengan bilanganmu sendiri di bawah, dan lihat kedua ruasnya dihitung secara eksak. ## Apa arti eksponen nol, negatif, dan pecahan? **$a^0=1$ untuk setiap $a\neq0$, $a^{-n}=\dfrac{1}{a^n}$, dan $a^{1/n}=\sqrt[n]{a}$: ini bukan aturan tambahan yang harus dihafal, melainkan satu-satunya nilai yang menjaga hukum eksponen tetap benar.** Menghitung faktor tidak dapat menjelaskan eksponen 0 atau −3, sehingga para matematikawan bertanya nilai apa yang dipaksakan oleh hukum-hukumnya. - **Nol.** Hukum perkalian berkata $a^m\cdot a^0=a^{m+0}=a^m$. Mengalikan $a^m$ dengan $a^0$ tidak mengubah apa pun, sehingga $a^0$ harus 1. - **Negatif.** $a^n\cdot a^{-n}=a^{0}=1$. Sesuatu yang mengalikan $a^n$ menjadi 1 adalah kebalikannya, sehingga $a^{-n}=\dfrac{1}{a^n}$. Eksponen negatif tidak membuat bilangannya negatif: $2^{-3}=\dfrac18$, bukan $-8$. - **Pecahan.** $\left(a^{1/n}\right)^n=a^{\frac1n\cdot n}=a^1=a$. Bilangan yang pangkat $n$-nya adalah $a$ adalah akar pangkat $n$, sehingga $a^{1/n}=\sqrt[n]{a}$. Lebih umum, $a^{m/n}=\left(a^{1/n}\right)^m=\sqrt[n]{a^m}$, sehingga setiap [bilangan rasional](https://nunada.my.id/artikel/bilangan-rasional/) dapat menjadi eksponen. Polanya paling mudah terlihat dengan menuruni pangkat dari 2. Setiap langkah ke bawah membagi dengan 2: $2^4=16$, $2^3=8$, $2^2=4$, $2^1=2$, $2^0=1$, $2^{-1}=\frac12$, $2^{-2}=\frac14$, $2^{-3}=\frac18$. Pakai widget untuk mencoba basis lain. > **Bagaimana dengan 0⁰?** > > Dalam aljabar $0^0$ dibiarkan tidak terdefinisi, karena dua aturan berselisih: "apa pun pangkat 0 adalah 1" mengatakan 1, dan "0 pangkat bilangan positif apa pun adalah 0" mengatakan 0. Dalam pemrograman dan kombinatorika ia didefinisikan sebagai 1 menurut kesepakatan, sehingga `0 ** 0` bernilai 1 di Python maupun JavaScript. > **Basis negatif dan eksponen pecahan** > > Hati-hati dengan basis negatif. $(-8)^{1/3}=-2$ tidak masalah, karena akar pangkat tiga dari bilangan negatif itu real. Tetapi $(-4)^{1/2}$ bukan bilangan real, karena tidak ada bilangan real yang kuadratnya negatif. Sederhanakan $\frac{m}{n}$ ke bentuk paling sederhana sebelum menghitung, sebab $(-8)^{2/6}$ dan $(-8)^{1/3}$ harus berarti sama. ## Apa itu akar (radikal)? **Akar pangkat $n$ dari $a$, ditulis $\sqrt[n]{a}$, adalah bilangan yang menghasilkan $a$ bila dipangkatkan $n$; $\sqrt{a}$ (indeks 2) adalah akar kuadrat dan $\sqrt[3]{a}$ adalah akar pangkat tiga.** Pada $\sqrt[n]{a}$ lambang $\sqrt{\ }$ adalah tanda akar, $a$ adalah radikan (bilangan di bawah tanda akar), dan $n$ adalah indeks. - **Akar kuadrat:** $\sqrt{49}=7$ karena $7^2=49$. - **Akar pangkat tiga:** $\sqrt[3]{125}=5$ karena $5^3=125$, dan $\sqrt[3]{-8}=-2$ karena $(-2)^3=-8$. - **Akar utama:** $\sqrt{9}=3$, bukan $\pm3$. Tanda akar selalu berarti akar yang tidak negatif. Persamaan $x^2=9$ memiliki dua penyelesaian, $x=3$ dan $x=-3$, itulah sebabnya langkah penyelesaian menulis $x=\pm\sqrt{9}$. - **Akar genap dan ganjil:** akar genap dari bilangan negatif bukan bilangan real ($\sqrt{-4}$), tetapi akar ganjil dari bilangan negatif adalah real ($\sqrt[3]{-27}=-3$). - **Akar dari kuadrat:** $\sqrt{x^2}=|x|$, bukan $x$, karena hasilnya tidak boleh negatif: $\sqrt{(-5)^2}=\sqrt{25}=5$. - **Akar dalam geometri:** diagonal persegi satuan adalah $\sqrt{1^2+1^2}=\sqrt2$, menurut [teorema Pythagoras](https://nunada.my.id/artikel/teorema-pythagoras/#what-is-the-theorem). | $n$ | $n^2$ | $n$ | $n^3$ | |---|---|---|---| | 1 | 1 | 1 | 1 | | 2 | 4 | 2 | 8 | | 3 | 9 | 3 | 27 | | 4 | 16 | 4 | 64 | | 5 | 25 | 5 | 125 | | 6 | 36 | 6 | 216 | | 7 | 49 | 7 | 343 | | 8 | 64 | 8 | 512 | | 9 | 81 | 9 | 729 | | 10 | 100 | 10 | 1.000 | | 11 sampai 15 | 121, 144, 169, 196, 225 | | | Akar dari bilangan bulat adalah bilangan bulat (bila bilangan itu pangkat sempurna, seperti pada tabel) atau bilangan irasional: untuk bilangan bulat positif $a$, $\sqrt{a}$ irasional tepat ketika $a$ bukan kuadrat sempurna. Itulah sebabnya ekspansi desimal $\sqrt{2}$, $\sqrt{3}$, dan $\sqrt{72}$ tak berhingga dan tidak pernah periodik; artikel [bilangan irasional](https://nunada.my.id/artikel/bilangan-irasional/#which-roots-are-irrational) menunjukkan cara menguji akar apa pun. > **Asal usul notasinya** > > Tanda akar $\sqrt{\ }$ pertama kali muncul dalam cetakan di Die Coss karya Christoff Rudolff (1525). Eksponen yang ditulis di atas, seperti pada $a^2$ dan $a^3$, dipopulerkan oleh René Descartes dalam La Géométrie (1637). Pemberian makna pada eksponen negatif dan pecahan biasanya dikaitkan dengan John Wallis (1656) dan Isaac Newton (1676), yang mulai menulis akar sebagai pangkat. ## Bagaimana menyederhanakan bentuk akar? **Untuk menyederhanakan bentuk akar, faktorkan bilangan di bawah akar, keluarkan setiap kelompok berisi $n$ faktor yang sama dari akar pangkat $n$, lalu kalikan yang keluar: $\sqrt{72}=\sqrt{2^3\cdot3^2}=3\cdot2\sqrt{2}=6\sqrt{2}$.** Ikuti langkah berikut, ditunjukkan untuk $\sqrt{72}$: 1. Faktorkan radikan menjadi [bilangan prima](https://nunada.my.id/artikel/bilangan-bulat/#primes): $72=2\cdot2\cdot2\cdot3\cdot3$. 2. Kelompokkan bilangan prima yang sama dalam himpunan sebesar indeksnya (berpasangan untuk akar kuadrat): $(2\cdot2)\cdot2\cdot(3\cdot3)$. 3. Keluarkan satu bilangan prima untuk setiap kelompok; yang tidak berpasangan tetap di dalam: pasangan 2 menghasilkan 2, pasangan 3 menghasilkan 3, dan satu 2 tetap di bawah akar. 4. Kalikan yang keluar: $2\cdot3=6$, sehingga $\sqrt{72}=6\sqrt{2}$. Aturan di baliknya, untuk $a,b\ge0$: $\sqrt{ab}=\sqrt{a}\cdot\sqrt{b}$ dan $\sqrt{\dfrac{a}{b}}=\dfrac{\sqrt{a}}{\sqrt{b}}$ untuk $b>0$. Untuk akar pangkat tiga ambil kelompok tiga: $\sqrt[3]{54}=\sqrt[3]{2\cdot3^3}=3\sqrt[3]{2}$. **Menjumlahkan bentuk akar.** Hanya akar yang senama, yaitu yang indeks dan radikannya sama, yang dapat digabung: $3\sqrt{2}+5\sqrt{2}=8\sqrt{2}$. Dua akar yang tampak berbeda bisa ternyata senama setelah disederhanakan: $\sqrt{50}+\sqrt{8}=5\sqrt{2}+2\sqrt{2}=7\sqrt{2}$. Tetapi $\sqrt{a+b}$ bukan $\sqrt{a}+\sqrt{b}$: $\sqrt{9+16}=5$, bukan $3+4$. Coba bilangan apa pun di bawah. Ganti indeksnya untuk melihat akar pangkat tiga dan akar yang lebih tinggi. ## Bagaimana merasionalkan penyebut? **Untuk merasionalkan penyebut, kalikan pembilang dan penyebut pecahan dengan bilangan yang menghilangkan akar dari penyebut: dengan akarnya sendiri untuk $\dfrac{a}{\sqrt{b}}$, dan dengan bentuk sekawan untuk $\dfrac{a}{p+\sqrt{q}}$.** Mengalikan pembilang dan penyebut dengan bilangan tak nol yang sama tidak mengubah nilai pecahan. - **Satu akar.** $\dfrac{6}{\sqrt{3}}=\dfrac{6\cdot\sqrt{3}}{\sqrt{3}\cdot\sqrt{3}}=\dfrac{6\sqrt{3}}{3}=2\sqrt{3}$, karena $\sqrt{3}\cdot\sqrt{3}=3$. - **Jumlah atau selisih.** Bentuk sekawan dari $p+\sqrt{q}$ adalah $p-\sqrt{q}$ (balik tandanya). Hasil kali keduanya adalah selisih kuadrat, yang tidak lagi memuat akar: $(p+\sqrt{q})(p-\sqrt{q})=p^2-q$. Misalnya $\dfrac{1}{1+\sqrt{2}}=\dfrac{1\cdot(1-\sqrt{2})}{(1+\sqrt{2})(1-\sqrt{2})}=\dfrac{1-\sqrt{2}}{1-2}=\dfrac{1-\sqrt{2}}{-1}=\sqrt{2}-1$. **Cara merasionalkan penyebut**, singkatnya: (1) pilih akarnya, atau bentuk sekawan bila penyebut berupa jumlah atau selisih; (2) kalikan pembilang dan penyebut dengannya; (3) sederhanakan, dan coret faktor persekutuan. Merasionalkan adalah kesepakatan, bukan koreksi: $\dfrac{1}{\sqrt{2}}$ dan $\dfrac{\sqrt{2}}{2}$ adalah bilangan yang sama. Bentuk kedua adalah bentuk yang diharapkan, dan lebih mudah ditaksir dengan tangan, sebab $\sqrt{2}\approx1{,}414$ memberi sekitar $0{,}707$. ## Bagaimana akar dan eksponen pecahan berhubungan? **Akar adalah eksponen pecahan: $\sqrt[n]{a}=a^{1/n}$ dan $\sqrt[n]{a^m}=\left(\sqrt[n]{a}\right)^m=a^{m/n}$, sehingga setiap hukum eksponen juga berlaku untuk akar.** | Bentuk akar | Bentuk eksponen | Nilai | |---|---|---| | $\sqrt{9}$ | $9^{1/2}$ | 3 | | $\sqrt[3]{27}$ | $27^{1/3}$ | 3 | | $\sqrt[3]{8^2}$ | $8^{2/3}$ | 4 | | $\dfrac{1}{\sqrt{16}}$ | $16^{-1/2}$ | $\dfrac14$ | | $\sqrt[4]{16^3}$ | $16^{3/4}$ | 8 | **Cara menghitung $a^{m/n}$:** 1. Ambil akar pangkat $n$ dari basis (penyebut eksponen): $8^{2/3}$ dimulai dengan $\sqrt[3]{8}=2$. 2. Pangkatkan hasilnya dengan $m$ (pembilang): $2^2=4$. 3. Bila eksponennya negatif, ambil kebalikannya: $8^{-2/3}=\dfrac{1}{8^{2/3}}=\dfrac14$. Mengambil akar lebih dulu menjaga bilangan tetap kecil, itulah sebabnya urutan ini terbaik bila dihitung dengan tangan. Bentuk eksponen juga satu-satunya cara menggabungkan akar dengan indeks berbeda. Karena $\sqrt{2}=2^{1/2}$ dan $\sqrt[3]{2}=2^{1/3}$, hukum perkalian memberi $\sqrt{2}\cdot\sqrt[3]{2}=2^{1/2+1/3}=2^{5/6}=\sqrt[6]{32}$. Coba milikmu sendiri di bawah. ## Bagaimana menyelesaikan persamaan dengan eksponen dan akar? **Untuk menyelesaikan persamaan eksponen, tulis kedua ruas dengan basis yang sama lalu samakan eksponennya; untuk menyelesaikan persamaan akar, pisahkan akarnya, pangkatkan kedua ruas dengan indeksnya, selesaikan, dan periksa setiap jawaban, karena memangkatkan dapat menimbulkan penyelesaian palsu.** **Persamaan eksponen (basis sama).** - $2^x=32\;\Rightarrow\;2^x=2^5\;\Rightarrow\;x=5$. - $9^x=27$, jadi $(3^2)^x=3^3$, jadi $3^{2x}=3^3$, jadi $2x=3$, jadi $x=\dfrac32$. - Pangkat pada bilangan yang dicari: $x^3=27\;\Rightarrow\;x=3$ (pangkat ganjil punya satu akar real), tetapi $x^2=9\;\Rightarrow\;x=\pm3$ (pangkat genap punya dua). **Persamaan akar.** $\sqrt{x+1}=3\;\Rightarrow\;x+1=9\;\Rightarrow\;x=8$, dan pemeriksaan $\sqrt{8+1}=3$ berlaku. **Selalu periksa.** Mengkuadratkan kedua ruas dapat menambah jawaban yang tidak cocok dengan persamaan semula, disebut penyelesaian asing. Ambil $\sqrt{x+2}=x$: 1. Kuadratkan kedua ruas: $x+2=x^2$. 2. Susun ulang: $x^2-x-2=0$, yang difaktorkan menjadi $(x-2)(x+1)=0$, sehingga $x=2$ atau $x=-1$. 3. Periksa $x=2$: $\sqrt{4}=2$ ✓. Periksa $x=-1$: $\sqrt{1}=1$, yang bukan $-1$ ✗. Hanya $x=2$ yang merupakan penyelesaian. Tanda akar tidak pernah negatif, sehingga ruas kanan pun tidak boleh negatif. ## Bagaimana menulis bilangan dalam notasi ilmiah? **Notasi ilmiah menulis bilangan sebagai $a\times10^k$ dengan $1\le a<10$ dan $k$ bilangan bulat: geser koma desimal sampai tersisa satu angka bukan nol di kirinya, dan biarkan $k$ menghitung tempat yang digeser.** Menggeser ke kiri membuat $k$ positif dan menggeser ke kanan membuatnya negatif. | Besaran | Bilangan biasa | Notasi ilmiah | |---|---|---| | Kecepatan cahaya dalam vakum | 299.792.458 m/s | $2{,}99792458\times10^{8}$ m/s | | Tetapan Avogadro | 602.214.076.000.000.000.000.000 per mol | $6{,}02214076\times10^{23}$ per mol | | Satu satuan astronomi | 149.597.870.700 m | $1{,}495978707\times10^{11}$ m | | Panjang yang kecil | 0,00045 m | $4{,}5\times10^{-4}$ m | Tiga nilai pertama persis menurut definisi dalam Sistem Satuan Internasional. Notasi ilmiah adalah hukum eksponen yang bekerja. Untuk mengalikan, kalikan bilangannya dan jumlahkan eksponennya: $(3\times10^{5})(2\times10^{4})=6\times10^{9}$. Untuk membagi, bagi bilangannya dan kurangkan eksponennya. Untuk menjumlahkan, lebih dulu samakan pangkat 10 kedua bilangan. ## Bagaimana menghitung eksponen dan akar di Python dan JavaScript? **Di Python dan JavaScript operator pangkat adalah tanda bintang ganda, bukan tanda sisipan (yang merupakan XOR bitwise), dan akar adalah pangkat `1/n` atau sebuah fungsi seperti `math.sqrt` dan `Math.cbrt`.** ```python >>> 2 ** 10 1024 >>> 2 ** -3 0.125 >>> 16 ** 0.5 4.0 >>> 27 ** (1/3) 3.0 >>> import math >>> math.sqrt(72) 8.48528137423857 >>> math.isqrt(72) # whole-number square root, rounded down 8 >>> (-8) ** (1/3) # a negative base with a fractional exponent (1.0000000000000002+1.7320508075688772j) >>> 2 ^ 3 # XOR, not a power 1 ``` ```javascript 2 ** 10 // 1024 2 ** -3 // 0.125 Math.sqrt(72) // 8.48528137423857 Math.cbrt(-8) // -2 (-8) ** (1 / 3) // NaN (-2) ** 2 // 4 (-2 ** 2 is a SyntaxError) Math.sqrt(2) ** 2 // 2.0000000000000004 2n ** 100n // 1267650600228229401496703205376n (BigInt stays exact) ``` ```cpp #include #include #include using namespace std; int isqrt(int n) { // the whole-number square root, rounded down int r = 0; while ((r + 1) * (r + 1) <= n) r++; return r; } int main() { printf("%.0f %.3f %.0f\n", pow(2, 10), pow(2, -3), pow(16, 0.5)); printf("%.12f\n", sqrt(72)); cout << isqrt(72) << endl; printf("%.12f %.12f\n", pow(27, 1.0 / 3), -pow(8, 1.0 / 3)); // a cube root of a negative: take the sign out // pow(-8, 1.0 / 3) is nan: a negative base needs a whole-number exponent cout << (2 ^ 3) << endl; // XOR, not a power printf("%.16f\n", sqrt(2) * sqrt(2)); // rounding, not a bug int p = 1; for (int i = 0; i < 30; i++) p *= 2; // 2^30 fits in an int; 2^31 would overflow cout << p << endl; return 0; } /* output: 1024 0.125 4 8.485281374239 8 3.000000000000 -2.000000000000 1 2.0000000000000004 1073741824 */ ``` Jebakannya, berurutan dari yang paling sering menggigit: | Jebakan | Yang terjadi | Yang sebaiknya dilakukan | |---|---|---| | `^` untuk pangkat | itu XOR: `2 ^ 3` bernilai 1 | pakai `**`, atau `pow(2, 3)` di Python dan `Math.pow(2, 3)` di JavaScript | | `-2 ** 2` | Python memberi −4; JavaScript menolaknya sebagai SyntaxError | tulis `(-2) ** 2` atau `-(2 ** 2)` agar maknanya jelas | | Basis negatif, eksponen pecahan | Python mengembalikan bilangan kompleks; JavaScript mengembalikan NaN | pakai `Math.cbrt` untuk akar pangkat tiga; periksa tandanya lebih dulu | | Akar dan pembulatan | `Math.sqrt(2) ** 2` bernilai `2.0000000000000004` | bandingkan dengan toleransi, seperti pada [artikel bilangan real](https://nunada.my.id/artikel/bilangan-real/#real-numbers-in-code) | | Pangkat yang sangat besar | bilangan JavaScript kehilangan ketepatan di atas 2⁵³; bilangan bulat Python tidak | pakai `BigInt` di JavaScript, atau `int` Python | | `0 ** 0` | bernilai 1 di kedua bahasa | ingat bahwa itu kesepakatan, bukan teorema | Pakai `math.isqrt` di Python bila kamu membutuhkan bagian bulat dari akar kuadrat: ia eksak untuk bilangan bulat sebesar apa pun, sedangkan `math.sqrt` bekerja dengan bilangan floating point (float). ## Apa kesalahan umum pada eksponen dan akar? **Kesalahan paling umum pada eksponen dan akar adalah sembilan hal berikut, masing-masing dengan pernyataan yang benar dan bilangan yang menunjukkan alasannya.** | Kesalahan | Yang benar | |---|---| | ❌ $(a+b)^2=a^2+b^2$ | $(a+b)^2=a^2+2ab+b^2$. Periksa: $(1+2)^2=9$, bukan $1+4=5$. Lihat [menjabarkan kurung](https://nunada.my.id/artikel/bentuk-aljabar/#expand). | | ❌ $\sqrt{a+b}=\sqrt{a}+\sqrt{b}$ | Salah pada umumnya: $\sqrt{9+16}=5$, bukan $3+4=7$. | | ❌ $-3^2=9$ | $-3^2=-(3\cdot3)=-9$. Hanya $(-3)^2=9$. | | ❌ $2^{-3}=-8$ | $2^{-3}=\dfrac18$. Eksponen negatif adalah kebalikan. | | ❌ $a^m\cdot a^n=a^{mn}$ | Eksponen dijumlahkan: $a^{m+n}$. Yang mengalikan eksponen adalah $(a^m)^n$. | | ❌ $2^3\cdot3^3=6^6$ | $2^3\cdot3^3=6^3$. Basis dikalikan hanya bila eksponennya sama. | | ❌ $\sqrt{x^2}=x$ | $\sqrt{x^2}=|x|$. Periksa: $\sqrt{(-5)^2}=5$, bukan $-5$. | | ❌ $a^0=0$ | $a^0=1$ untuk $a\neq0$. | | ❌ $\dfrac{1}{\sqrt{2}}$ sudah paling sederhana | Nilainya benar, tetapi bentuk yang diharapkan tidak punya akar di bawah: $\dfrac{\sqrt{2}}{2}$. | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: eksponen dan akar sekilas - **Eksponen:** $a^n$ adalah $n$ faktor $a$; basisnya $a$ dan eksponennya $n$. - **Lima hukum:** $a^ma^n=a^{m+n}$, $\dfrac{a^m}{a^n}=a^{m-n}$, $(a^m)^n=a^{mn}$, $(ab)^n=a^nb^n$, $\left(\dfrac ab\right)^n=\dfrac{a^n}{b^n}$. - **Nilai yang dipaksakan:** $a^0=1$ ($a\neq0$), $a^{-n}=\dfrac1{a^n}$, $a^{1/n}=\sqrt[n]{a}$, $a^{m/n}=\left(\sqrt[n]{a}\right)^m$. - **Akar:** $\sqrt{x^2}=|x|$; akar genap dari bilangan negatif bukan bilangan real; $\sqrt{a+b}\neq\sqrt{a}+\sqrt{b}$. - **Sederhanakan** dengan mengeluarkan kelompok berisi $n$ faktor prima yang sama dari akar pangkat $n$; **rasionalkan** dengan akarnya atau bentuk sekawannya. - **Persamaan:** basis sama berarti eksponen sama; periksa setiap penyelesaian akar. - **Notasi ilmiah:** $a\times10^k$ dengan $1\le a<10$; dalam kode pakai `**`, bukan `^`. ## Glosarium: istilah penting - **Eksponen (pangkat)**: Bilangan kecil di atas yang menyatakan berapa kali basis dikalikan dengan dirinya sendiri, seperti 5 pada 2 pangkat 5. - **Basis (bilangan pokok)**: Bilangan yang dikalikan dengan dirinya sendiri dalam sebuah pangkat, seperti 2 pada 2 pangkat 5. - **Akar (radikal)**: Akar pangkat n dari sebuah bilangan adalah nilai yang menghasilkan bilangan itu bila dipangkatkan n, ditulis dengan tanda akar. - **Radikan**: Bilangan yang ditulis di bawah tanda akar, seperti 72 pada akar kuadrat 72. - **Indeks akar**: Bilangan kecil pada tanda akar yang menyatakan akar mana yang diambil; 2 adalah akar kuadrat dan 3 adalah akar pangkat tiga. - **Akar kuadrat utama**: Akar kuadrat yang tidak negatif, yaitu arti tanda akar: akar kuadrat dari 9 adalah 3, bukan plus atau minus 3. - **Kuadrat sempurna**: Bilangan bulat yang merupakan kuadrat dari bilangan bulat, seperti 1, 4, 9, 16, dan 25. - **Eksponen rasional (pangkat pecahan)**: Eksponen pecahan m per n, yang berarti akar pangkat n dari basis dipangkatkan m. - **Bentuk sekawan**: Untuk p ditambah akar q, ekspresi p dikurangi akar q; hasil kali keduanya tidak memuat akar. - **Merasionalkan penyebut**: Mengalikan pembilang dan penyebut sebuah pecahan dengan bilangan yang menghilangkan akar dari penyebut. - **Notasi ilmiah (bentuk baku)**: Cara menulis bilangan sebagai a kali 10 pangkat k, dengan a sekurang-kurangnya 1 dan kurang dari 10. - **Penyelesaian asing**: Nilai yang menyelesaikan persamaan setelah kedua ruas dikuadratkan tetapi gagal pada persamaan semula. ## Pertanyaan yang sering diajukan ### Apa itu eksponen? Eksponen adalah bilangan kecil di atas dalam sebuah pangkat seperti 2 pangkat 5. Ia menyatakan berapa kali basis dipakai sebagai faktor, sehingga 2 pangkat 5 adalah 2 kali 2 kali 2 kali 2 kali 2, yaitu 32. ### Apa arti eksponen negatif? Eksponen negatif berarti kebalikan dari pangkat dengan eksponen positif: 2 pangkat minus 3 adalah 1 per 2 pangkat tiga, yaitu 1/8. Ia tidak membuat bilangannya negatif. Aturan ini menjaga hukum eksponen tetap berlaku. ### Mengapa bilangan apa pun pangkat 0 sama dengan 1? Karena hukum perkalian harus tetap berlaku. Mengalikan a pangkat m dengan a pangkat 0 memberi a pangkat m ditambah 0, yaitu a pangkat m lagi, sehingga a pangkat 0 harus 1. Ini berlaku untuk setiap a kecuali 0. ### Berapakah 0 pangkat 0? Dalam aljabar ia tidak terdefinisi, karena aturan bahwa apa pun pangkat 0 adalah 1 dan aturan bahwa 0 pangkat bilangan positif adalah 0 saling bertentangan. Dalam pemrograman dan kombinatorika ia didefinisikan sebagai 1 menurut kesepakatan, dan Python serta JavaScript sama-sama mengembalikan 1. ### Berapakah akar kuadrat dari bilangan negatif? Itu bukan bilangan real, karena tidak ada bilangan real yang kuadratnya negatif. Para matematikawan mendefinisikan satuan imajiner i dengan i kuadrat sama dengan minus 1, sehingga akar kuadrat dari minus 4 adalah 2i. Bilangan ini termasuk bilangan kompleks. ### Mengapa akar kuadrat dari x kuadrat adalah nilai mutlak x? Tanda akar kuadrat selalu memberi akar yang tidak negatif. Jika x negatif, misalnya minus 5, maka x kuadrat adalah 25 dan akar kuadratnya 5, yaitu minus x. Jadi jawabannya x bila x sekurang-kurangnya 0 dan minus x bila tidak: nilai mutlak x. ### Bagaimana menyederhanakan akar kuadrat? Faktorkan bilangan di bawah akar menjadi bilangan prima, pasangkan bilangan prima yang sama, keluarkan satu dari tiap pasangan dari akar, lalu kalikan yang keluar. Untuk 72 itu 2 kali 2 kali 2 kali 3 kali 3, sehingga akar kuadrat 72 adalah 2 kali 3 kali akar 2, atau 6 akar 2. ### Bagaimana merasionalkan penyebut? Kalikan pembilang dan penyebut pecahan dengan bilangan yang menghilangkan akar dari penyebut. Untuk satu akar seperti 6 per akar 3, kalikan dengan akar 3 untuk mendapat 2 akar 3. Untuk jumlah seperti 1 per 1 ditambah akar 2, kalikan dengan bentuk sekawannya, 1 dikurangi akar 2. ### Apa arti eksponen pecahan? Eksponen pecahan adalah akar yang digabung dengan pangkat. Eksponen 1 per n berarti akar pangkat n, dan m per n berarti ambil akar pangkat n lalu pangkatkan dengan m. Jadi 8 pangkat 2 per 3 adalah akar pangkat tiga dari 8, yaitu 2, dikuadratkan, yaitu 4. ### Apakah akar 2 ditambah akar 3 sama dengan akar 5? Tidak. Akar dari sebuah jumlah bukan jumlah dari akar-akarnya. Ruas kiri sekitar 1,414 ditambah 1,732, yaitu 3,146, sedangkan akar 5 sekitar 2,236. Akar hanya dapat dijumlahkan bila senama. ### Apa beda (−2)² dan −2²? Minus 2 dalam kurung, dikuadratkan, adalah minus 2 kali minus 2, yaitu 4. Tanpa kurung, eksponen hanya berlaku untuk 2, sehingga minus 2 kuadrat adalah minus (2 kali 2), yaitu minus 4. Kurunglah yang menentukan apa yang dikuadratkan. ### Bagaimana menulis bilangan dalam notasi ilmiah? Geser koma desimal sampai tepat satu angka bukan nol berada di kirinya, lalu kalikan dengan 10 pangkat banyaknya tempat yang digeser. Menggeser ke kiri memberi eksponen positif dan ke kanan memberi eksponen negatif, sehingga 45.000 adalah 4,5 kali 10 pangkat 4 dan 0,00045 adalah 4,5 kali 10 pangkat minus 4. ### Bagaimana menghitung pangkat di Python? Pakai operator dua tanda bintang, yang memberi 1024 untuk dua pangkat sepuluh, atau fungsi pow. Tanda sisipan bukan pangkat di Python: itu XOR bitwise. Untuk akar kuadrat pakai math.sqrt, dan untuk bagian bulat dari akar kuadrat pakai math.isqrt. ### Apakah semua bentuk akar adalah bilangan irasional? Tidak. Akar dari bilangan bulat irasional hanya bila bilangan itu bukan pangkat sempurna dari indeksnya. Akar kuadrat 16 adalah 4 dan akar pangkat tiga 27 adalah 3, keduanya rasional, sedangkan akar kuadrat 2 dan akar pangkat tiga 5 irasional. --- # Numbers in Chinese: Mandarin Numerals from 0 to Billions Source: https://nunada.my.id/articles/chinese-numbers/ Updated: 2026-10-09 ## Quick answer **Chinese numbers are built from eleven basic words — 零 líng (0), 一 yī, 二 èr, 三 sān, 四 sì, 五 wǔ, 六 liù, 七 qī, 八 bā, 九 jiǔ and 十 shí (10) — and the place words 百 (100), 千 (1,000), 万 (10,000) and 亿 (100,000,000).** Names above ten are fully regular: 十二 is "ten-two", which is 12. Chinese groups digits in fours rather than threes, so 100,000 is 十万, "ten wàn". ### Key takeaways - The ten digits and zero are 零 to 十, and every number from 11 to 99 is built from them with 十: 十一 is 11, 二十 is 20, 三十五 is 35. - Digits are grouped in fours: 万 (wàn) is 10,000 and 亿 (yì) is 100,000,000, so "100,000" is 十万, not "a hundred thousand". - A gap of zeros is read as one 零, a lone 2 before 千, 万 or 亿 is 两 rather than 二, and 十 loses its 一 only at the very start of a number. - Fractions, percentages and ordinals are patterns (三分之一, 百分之五十, 第三), while years and phone numbers are read digit by digit. - Formal numerals (壹 贰 叁 …) protect checks and contracts from alteration, and Chinese counting rods were an early decimal place-value system with zero left as a gap. - Because the names are so regular, researchers have linked them to children learning to count sooner (Miller and colleagues, 1995). ## How do you count from 0 to 10 in Chinese? **In Mandarin Chinese the numbers 0 to 10 are 零 (líng), 一 (yī), 二 (èr), 三 (sān), 四 (sì), 五 (wǔ), 六 (liù), 七 (qī), 八 (bā), 九 (jiǔ) and 十 (shí).** Each one is a single character, and each is said with one of the four tones of Mandarin, which the marks above the pinyin letters show. | Number | Character | Pinyin | Worth knowing | |---|---|---|---| | 0 | 零 | líng | also written 〇 in years and dates | | 1 | 一 | yī | said yāo (written 幺) in phone numbers | | 2 | 二 | èr | 两 (liǎng) is used for quantities | | 3 | 三 | sān | three horizontal strokes | | 4 | 四 | sì | sounds like 死 (sǐ, "death") | | 5 | 五 | wǔ | — | | 6 | 六 | liù | sounds like 流 (liú, "to flow smoothly") | | 7 | 七 | qī | — | | 8 | 八 | bā | sounds like 发 (fā, "to get rich") | | 9 | 九 | jiǔ | sounds like 久 (jiǔ, "long-lasting") | | 10 | 十 | shí | two crossing strokes | **Pinyin** is the standard way of writing Mandarin sounds with the Latin alphabet. Mandarin has four tones — high and level (ā), rising (á), dipping (ǎ) and falling (à) — and a neutral tone, and a different tone is a different word: sì (4, falling) and sǐ (death, dipping) differ only in tone. The marks are not decoration; learn each number with its tone. > **Why 一 sounds different in speech** > > Textbooks give each character its own tone, as this article does. In speech 一 (yī) changes: it becomes yí before a falling tone (一万 yí wàn) and yì before the other tones (一百 yì bǎi, 一千 yì qiān). The writing never changes, only the sound. ## How do the numbers 11 to 99 work in Chinese? **Numbers from 11 to 99 are built by saying the tens first and the ones second: 十一 is "ten-one" (11), 二十 is "two-ten" (20) and 三十五 is "three-ten-five" (35).** There is nothing to memorize beyond 零 to 十 and one rule: for 10 to 19 say 十 and then the digit, and for 20 to 99 say the tens digit, then 十, then the ones digit (leave it out when it is 0). | Number | Chinese | Pinyin | Literally | |---|---|---|---| | 11 | 十一 | shí yī | ten-one | | 12 | 十二 | shí èr | ten-two | | 20 | 二十 | èr shí | two-ten | | 21 | 二十一 | èr shí yī | two-ten-one | | 35 | 三十五 | sān shí wǔ | three-ten-five | | 99 | 九十九 | jiǔ shí jiǔ | nine-ten-nine | Compare this with English, which has the special words eleven, twelve, thirteen and twenty, and with Indonesian, where 11 is sebelas and 12 is dua belas (belas marks the teens) and 20 is dua puluh. Chinese has no such exceptions at all. | Number | Chinese | Indonesian | English | |---|---|---|---| | 11 | 十一 | sebelas | eleven | | 12 | 十二 | dua belas | twelve | | 20 | 二十 | dua puluh | twenty | | 21 | 二十一 | dua puluh satu | twenty-one | | 35 | 三十五 | tiga puluh lima | thirty-five | Researchers have linked such regular names to how children learn to count. In a 1995 study by Miller and colleagues, Chinese-speaking children counted further than American children of the same age, and the difference showed mainly in the numbers beyond ten, where English names stop being regular. ## How do you say hundreds, thousands and zero in Chinese? **Hundreds and thousands use the place words 百 (bǎi) and 千 (qiān) after the digit, and a gap of zeros is read as a single 零 (líng): 105 is 一百零五.** Unlike 十, the words 百 and 千 always need their digit, so 100 is 一百 and never just 百. | Number | Chinese | Pinyin | What to notice | |---|---|---|---| | 100 | 一百 | yī bǎi | 一 is kept before 百 | | 101 | 一百零一 | yī bǎi líng yī | one 零 for the empty tens place | | 110 | 一百一十 | yī bǎi yī shí | 一十, not 十, because 十 is not at the start | | 305 | 三百零五 | sān bǎi líng wǔ | 零 for the empty tens place | | 1,000 | 一千 | yī qiān | the zeros at the end are not read | | 1,001 | 一千零一 | yī qiān líng yī | two empty places, but one 零 | | 1,010 | 一千零一十 | yī qiān líng yī shí | one 零 for the empty hundreds place | | 2,000 | 两千 | liǎng qiān | 两, not 二, before 千 | | 2,345 | 两千三百四十五 | liǎng qiān sān bǎi sì shí wǔ | | **The zero rule.** Say 零 once for each gap of one or more zeros that sits between two non-zero digits. Never say it for zeros at the end of a number: 1,000 is 一千, not "一千零". **Two words for 2.** Use 二 (èr) when 2 is a digit or the last digit of a group (二十, 十二, 第二). Use 两 (liǎng) when a lone 2 comes before 千, 万 or 亿 (两千, 两万, 两亿) and before a measure word (两个人, "two people"). Before 百 both are heard: 二百 and 两百. **In speech the last unit is often dropped.** 一百五 usually means 150 (一百五十) and 三千五 means 3,500. That is why 105 must keep its 零: 一百零五 is 105, but 一百五 is 150. ## Why does Chinese count in 万 and 亿 instead of thousands and millions? **Chinese groups digits in fours, not threes: after 千 (1,000) the next new word is 万 (wàn, 10,000), and the next after that is 亿 (yì, 100,000,000).** English, Indonesian and most European languages add a new word every three digits (thousand, million, billion). Chinese adds one every four, so a number is a short list of numbers up to 9999, each followed by 万 or 亿. | Value | Chinese | English | Indonesian | |---|---|---|---| | 10,000 | 一万 | ten thousand | sepuluh ribu | | 100,000 | 十万 | one hundred thousand | seratus ribu | | 1,000,000 | 一百万 | one million | satu juta | | 10,000,000 | 一千万 | ten million | sepuluh juta | | 100,000,000 | 一亿 | one hundred million | seratus juta | | 1,000,000,000 | 十亿 | one billion | satu miliar | | 1,000,000,000,000 | 一万亿 | one trillion | satu triliun | The two systems agree only at 10 to the power 12, where 万亿 (10,000 × 100,000,000) is one trillion. In between, a speaker has to translate: "100,000" is not "a hundred thousand" but "ten wàn". The scholars' word myriad for 10,000 is the same unit as 万. **A quick way to read any number.** Count the digits from the right in fours. The first four are the plain group, the next four are the 万 group, and the next four are the 亿 group. The widget below shows both groupings at once. ## How do you write any number in Chinese, step by step? **To write a number in Chinese, split its digits into groups of four from the right, read each group with 千 百 十, put 亿 or 万 after the groups, and say 零 once for each gap of zeros.** Take 20,508,030: 1. Write the digits and cut them into groups of four from the right: 2050 | 8030. 2. Read each group as a number up to 9999 with 千, 百 and 十. 2050 is 两千零五十 and 8030 is 八千零三十. 3. Put 万 after the second group from the right and 亿 after the third. The last group has no unit: 两千零五十万 八千零三十. 4. Say 零 once for each gap of zeros, including a gap between groups (when a group starts below 1,000, or a whole group is empty). 5. Check the special cases: 两 for a lone 2 before 千, 万 or 亿; drop the 一 only before a leading 十 (十, 十一, 十万); and do not read zeros at the end. So 20,508,030 is 两千零五十万八千零三十 (liǎng qiān líng wǔ shí wàn bā qiān líng sān shí). Try your own numbers below, and switch between simplified, traditional and formal writing. > **Traditional characters** > > Taiwan, Hong Kong and Macau write with traditional characters. Only three number characters differ from the simplified ones used on the mainland: 两 becomes 兩, 万 becomes 萬 and 亿 becomes 億. Everything else, and every rule above, is the same. ## How can you practice reading Chinese numbers? **To read a Chinese number, find 亿 and 万, read each part as a number up to 9999, and write each part with four digits.** Reading is the writing steps run backward: 1. Find 亿 and 万 in the number and cut it after each of them. 2. Read each part on its own: 千 is thousands, 百 hundreds, 十 tens, and what is left is the ones. 3. Write every part except the first with four digits, putting zeros in front where needed (零 tells you a place is empty). 4. Join the parts. For example 两千零五十万八千零三十 is 2050 | 8030, which is 20,508,030. Practice with the widget below: eight numbers of growing size, with pinyin on request. The wrong answers are the mistakes people really make — a place too many or too few, two digits swapped, one digit off. ## How do you say fractions, decimals, percentages, years and phone numbers? **Fractions, decimals, percentages, negatives and ordinals follow fixed patterns built from the same number words, while years and phone numbers are read digit by digit.** | Meaning | Pattern | Example | Pinyin | |---|---|---|---| | Decimal | whole part + 点 + digits one by one | 3.14 = 三点一四 | sān diǎn yī sì | | Fraction | denominator + 分之 + numerator | 1/3 = 三分之一 | sān fēn zhī yī | | Fraction | denominator first, always | 2/3 = 三分之二 | sān fēn zhī èr | | Percentage | 百分之 + number | 25% = 百分之二十五 | bǎi fēn zhī èr shí wǔ | | Negative | 负 + number | −5 = 负五 | fù wǔ | | Ordinal | 第 + number | 3rd = 第三 | dì sān | | Half | 半 | half an hour = 半小时 | bàn xiǎoshí | | Year | digit by digit + 年 | 2025 = 二〇二五年 | èr líng èr wǔ nián | | Phone number | digit by digit, 1 = 幺 | 110 = 幺幺〇 | yāo yāo líng | A [fraction](https://nunada.my.id/articles/rational-numbers/) is said "of three parts, one": 三分之一 means "one of three parts". A [percentage](https://nunada.my.id/articles/rational-numbers/#decimals-percent) is "of a hundred parts": 百分之五十 is 50%. The digits after 点 are never grouped: 3.14 is "three point one four", never "three point fourteen". A year is a label, not a quantity, so it is read as separate digits and written with 〇 (or 零): 二〇二五年. The quantity "two thousand and twenty-five" would be 两千零二十五. ## What are the formal Chinese numerals 壹, 贰, 叁? **Formal Chinese numerals (大写数字, dàxiě shùzì) are a second set of characters for the same numbers, used on checks, receipts and contracts because they are hard to alter.** The ordinary 一 can become 三 with one stroke, and 十 can become 千; 壹 and 叁 cannot. | Number | Ordinary | Formal | Pinyin | |---|---|---|---| | 0 | 零 | 零 | líng | | 1 | 一 | 壹 | yī | | 2 | 二 | 贰 | èr | | 3 | 三 | 叁 | sān | | 4 | 四 | 肆 | sì | | 5 | 五 | 伍 | wǔ | | 6 | 六 | 陆 | lù | | 7 | 七 | 柒 | qī | | 8 | 八 | 捌 | bā | | 9 | 九 | 玖 | jiǔ | | 10 | 十 | 拾 | shí | | 100 | 百 | 佰 | bǎi | | 1,000 | 千 | 仟 | qiān | The reading rules are the same, with two differences: the formal form of 2 is always 贰 (never 两), and 10 is written 壹拾 with its 壹 kept. A check for 1,205 yuan reads 壹仟贰佰零伍元整 (yī qiān èr bǎi líng wǔ yuán zhěng), where 整 means "exactly", closing the amount so nothing can be added after it. The converter above has a formal setting. This is the same idea as writing an amount in words on a check in English or Indonesian. ## What are Chinese counting rods and Suzhou numerals? **Counting rods (算筹, suànchóu) were small sticks of bamboo, bone or ivory laid out in columns on a flat surface to calculate; they form an early decimal place-value system in which an empty place is a gap.** Bundles of rods have been found in tombs of the Han dynasty (206 BCE to 220 CE), and the Sunzi suanjing, written between the 3rd and 5th centuries CE, describes how the digits are laid out. The rods were gradually replaced by the abacus (算盘, suànpán), which was widespread by the Ming dynasty (1368 to 1644). How a number is laid out: - Each place gets its own column, with the highest place on the left, exactly like written digits. - The digits 1 to 5 are that many rods. For 6 to 9, one rod laid across stands for 5, and the remaining rods are added to it. - The direction alternates from place to place: rods stand upright in the ones, hundreds and ten-thousands places and lie flat in the tens, thousands and hundred-thousands places, so two neighboring digits are never mixed up. - Zero is an empty column. A written circle for zero appears in Chinese mathematical books by the 13th century, for example in Qin Jiushao's Shùshū Jiǔzhāng (1247). - Red rods are positive and black rods negative in the Nine Chapters on the Mathematical Art, so a column of rods can hold a debt: see the history of [negative numbers](https://nunada.my.id/articles/integers/#what-are-integers) in the article on integers. **Suzhou numerals** (苏州码子, Sūzhōu mǎzi) are the written shorthand that grew out of the rods, long used by traders and still seen on some market price tags: 〇 〡 〢 〣 〤 〥 〦 〧 〨 〩 for 0 to 9. The widget draws the rods for a number beside its Suzhou numerals. > **A drawing convention** > > Old sources differ in small details, such as which end carries the rod that stands for five in the lying-down form. The widget draws one common form so the idea is clear; it is not a facsimile of any particular text. ## Why are some numbers lucky or unlucky in Chinese? **Numbers are lucky or unlucky in Chinese because of how they sound: a number that sounds like a good word is lucky, and one that sounds like a bad word is avoided.** The meaning comes from the sound, not from the number. | Number | Pinyin | Sounds like | Meaning | |---|---|---|---| | 8 | bā | 发 (fā) "to get rich" | the luckiest number: prices, car plates, dates | | 6 | liù | 流 (liú) "to flow smoothly" | lucky: everything goes smoothly | | 9 | jiǔ | 久 (jiǔ) "long-lasting" | lucky, common at weddings | | 4 | sì | 死 (sǐ) "death" | unlucky: some buildings have no 4th floor | | 520 | wǔ èr líng | 我爱你 (wǒ ài nǐ) "I love you" | used on 20 May, "520 day" | | 1314 | yī sān yī sì | 一生一世 (yī shēng yī shì) "for a lifetime" | used in messages of love | | 666 | liù liù liù | smooth, smooth, smooth | internet slang for "awesome" | | 88 | bā bā | 拜拜 (bàibài) "bye-bye" | used at the end of text messages | The Beijing Summer Olympics opened on 8 August 2008 at 8:08 pm, a date and time chosen for all those eights. ## How do you show numbers with one hand in China? **Chinese speakers show the numbers 1 to 10 with one hand, using a sign for each number that does not depend on language, which lets a market seller and a buyer agree a price across a noisy street.** These are common signs; details vary by region and by person. | Number | Common sign | |---|---| | 1 to 5 | that many fingers raised: 1 is the index finger, 2 adds the middle finger, and 5 is the open hand | | 6 | thumb and little finger out, the other fingers folded | | 7 | thumb and fingertips pinched together | | 8 | thumb and index finger out, in an L shape | | 9 | index finger bent like a hook | | 10 | a fist, or the two index fingers crossed to draw 十 | The sign for 10 draws the character itself: two crossing lines, 十. ## What are the common mistakes with Chinese numbers? **The most common mistakes with Chinese numbers are the seven below, each with the correct form.** | Mistake | Correct | |---|---| | ❌ "10,000 is 十千." | 10,000 is 一万. Chinese has a word for 10 to the power 4, so 十千 is never said. | | ❌ "105 is 一百五." | 一百五 is 150, because the last unit is dropped in speech. 105 is 一百零五. | | ❌ "30,000 is 三千万." | 三千万 is 30,000,000. 30,000 is 三万. | | ❌ "100 is just 百." | 100 is 一百. Only 十 can lose its 一, and only at the start of a number. | | ❌ "Two people is 二个人." | Say 两个人. Use 两 before a measure word. | | ❌ "2025 is 两千零二十五年." | A year is read digit by digit: 二〇二五年. | | ❌ "Say 零 for every zero." | Say 零 once per gap, and never for zeros at the end. | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: Chinese numbers at a glance - **0 to 10** are 零 一 二 三 四 五 六 七 八 九 十; **11 to 99** are the digits joined with 十 (十一, 二十, 三十五). - **Hundreds and thousands** use 百 and 千 after the digit; 100 is 一百, never 百. - **Zero:** say 零 once per gap of zeros, including across 万 and 亿; never for zeros at the end. - **Two:** 二 as a digit, 两 before 千, 万, 亿 and measure words; 二百 and 两百 are both heard. - **Groups of four:** 万 is 10,000 and 亿 is 100,000,000, so 100,000 is 十万 and one billion is 十亿. - **Patterns:** 三分之一 (1/3), 百分之五十 (50%), 第三 (3rd), 负五 (−5); years and phone numbers are digit by digit. - **Formal numerals** 壹 贰 叁 … are for checks and contracts; **counting rods** and **Suzhou numerals** are older written systems with zero left empty. ## Glossary: key terms - **Pinyin**: The standard system for writing the sounds of Mandarin with the Latin alphabet and tone marks, such as sān for 3. - **Tone**: The pitch pattern of a Mandarin syllable; there are four tones and a neutral tone, and changing the tone changes the word. - **Hanzi (汉字)**: The Chinese characters; each number word is written with one character, such as 三 for 3. - **万 (wàn)**: The Chinese word for 10,000, the unit that follows 千 and that groups digits in fours. - **亿 (yì)**: The Chinese word for 100,000,000, ten thousand times 万. - **零 (líng)**: Zero; it is also read once for each gap of zeros between two non-zero digits. - **两 (liǎng)**: The form of 2 used for quantities and before 千, 万 and 亿 instead of 二. - **Formal numerals (大写)**: A second set of characters for numbers, such as 壹 贰 叁, used on checks and contracts because they are hard to alter. - **Counting rods (算筹)**: Small sticks laid out in columns to calculate, an early decimal place-value system in which zero is an empty place. - **Suzhou numerals**: A written shorthand derived from counting rods, used by traders, with 〡 to 〩 for 1 to 9 and 〇 for 0. - **Myriad**: An older English word for 10,000, the same unit as 万. - **Place value**: The principle that a digit is worth more or less depending on where it stands in the number. ## Frequently asked questions ### How do you count from 1 to 10 in Chinese? In Mandarin the numbers 1 to 10 are 一 yī, 二 èr, 三 sān, 四 sì, 五 wǔ, 六 liù, 七 qī, 八 bā, 九 jiǔ and 十 shí. Zero is 零 líng. Each number is one character, and the tone marks in pinyin show how it is pronounced. ### How do you say 100 in Chinese? One hundred is 一百, pronounced yī bǎi. The 一 cannot be left out before 百, so 百 alone is not 100. Compare 10, which is just 十, and 101, which is 一百零一 with a 零 for the empty tens place. ### How do you say 10,000 in Chinese? Ten thousand is 一万, pronounced yī wàn. Chinese has its own word, 万, for 10,000, so there is no "ten thousand" built from 十 and 千. One hundred thousand is 十万 and one million is 一百万. ### Why does Chinese use 万 and 亿 instead of thousand and million? Chinese groups digits in fours: 万 is 10,000 and 亿 is 100,000,000, each four digits above the last. English and Indonesian group digits in threes with thousand, million and billion. Neither grouping is more correct; they are different conventions for naming large numbers. ### What is the difference between 二 and 两? Both mean 2. Use 二 (èr) for the digit itself, in 二十, 十二 and ordinals like 第二. Use 两 (liǎng) for a quantity, before measure words as in 两个人, and before 千, 万 and 亿 as in 两千 and 两万. Before 百 both 二百 and 两百 are heard. ### How do you say zero in Chinese? Zero is 零, pronounced líng. In years and dates it is often written 〇, a circle, with the same sound. Inside a number, 零 is also said once for a gap of zeros, as in 一百零五 for 105. ### How do you say 2025 in Chinese? As a year, 2025 is read digit by digit: 二〇二五年, èr líng èr wǔ nián. As a quantity, such as 2,025 people, it is 两千零二十五, liǎng qiān líng èr shí wǔ. The year is a label, so it is not read as one number. ### How do you say one million and one billion in Chinese? One million is 一百万, yī bǎi wàn, literally "one hundred wàn". One billion is 十亿, shí yì, literally "ten yì". One trillion is 一万亿, yī wàn yì. Count the digits in fours from the right to find the unit. ### Are Chinese numbers easier to learn than English numbers? Above ten they are more regular, since 12 is ten-two and 21 is two-ten-one, with no words like eleven or twenty. A 1995 study by Miller and colleagues found Chinese-speaking children counted further than American peers. Large numbers with 万 and 亿 need practice, though. ### What are the formal Chinese numerals? Formal numerals are a second set of characters used on checks and contracts: 壹 贰 叁 肆 伍 陆 柒 捌 玖 拾 for 1 to 10, with 佰 for 100 and 仟 for 1,000. They are hard to alter, unlike 一 二 三, which can be changed with a stroke. ### How do you say a phone number in Chinese? A phone number is read digit by digit, and the digit 1 is said yāo (幺) instead of yī so it is not confused with 7, qī. The police number 110 is therefore yāo yāo líng. ### Which numbers are lucky in Chinese culture? Eight is the luckiest because bā sounds like fā, "to get rich". Six sounds like "smooth" and nine like "long-lasting". Four is unlucky because sì sounds like sǐ, "death", so some buildings skip the fourth floor. The luck comes from the sound of the word. ### Do all Chinese languages use the same numbers? The written characters are the same, but the pronunciation differs by language. Cantonese says 一 as yāt and 三 as sāam, and often uses 廿 for 20 where Mandarin says 二十. This article teaches Mandarin, the standard language of mainland China, Taiwan and Singapore. --- # Bilangan dalam Bahasa China: Angka Mandarin 0 sampai Miliaran Source: https://nunada.my.id/artikel/bilangan-bahasa-china/ Updated: 2026-10-09 ## Jawaban singkat **Bilangan dalam bahasa China dibangun dari sebelas kata dasar — 零 líng (0), 一 yī, 二 èr, 三 sān, 四 sì, 五 wǔ, 六 liù, 七 qī, 八 bā, 九 jiǔ, dan 十 shí (10) — serta kata tempat 百 (100), 千 (1.000), 万 (10.000), dan 亿 (100.000.000).** Nama bilangan di atas sepuluh sepenuhnya teratur: 十二 berarti "sepuluh-dua", yaitu 12. Bahasa China mengelompokkan angka empat-empat, bukan tiga-tiga, sehingga 100.000 adalah 十万, "sepuluh wàn". ### Poin penting - Kesepuluh angka dan nol adalah 零 sampai 十, dan setiap bilangan dari 11 sampai 99 dibangun darinya dengan 十: 十一 adalah 11, 二十 adalah 20, 三十五 adalah 35. - Angka dikelompokkan empat-empat: 万 (wàn) adalah 10.000 dan 亿 (yì) adalah 100.000.000, sehingga "100.000" adalah 十万, bukan "seratus ribu". - Celah berisi nol dibaca satu 零, angka 2 yang berdiri sendiri sebelum 千, 万, atau 亿 menjadi 两 dan bukan 二, dan 十 kehilangan 一-nya hanya di awal sebuah bilangan. - Pecahan, persen, dan bilangan urutan mengikuti pola (三分之一, 百分之五十, 第三), sedangkan tahun dan nomor telepon dibaca angka demi angka. - Angka formal (壹 贰 叁 …) melindungi cek dan kontrak dari pengubahan, dan batang hitung China adalah sistem nilai tempat desimal awal dengan nol dibiarkan sebagai celah. - Karena namanya begitu teratur, para peneliti mengaitkannya dengan anak yang lebih cepat belajar berhitung (Miller dan kawan-kawan, 1995). ## Bagaimana menghitung dari 0 sampai 10 dalam bahasa China? **Dalam bahasa Mandarin, bilangan 0 sampai 10 adalah 零 (líng), 一 (yī), 二 (èr), 三 (sān), 四 (sì), 五 (wǔ), 六 (liù), 七 (qī), 八 (bā), 九 (jiǔ), dan 十 (shí).** Masing-masing satu aksara, dan masing-masing diucapkan dengan salah satu dari empat nada bahasa Mandarin, yang ditunjukkan oleh tanda di atas huruf pinyin. | Bilangan | Aksara | Pinyin | Perlu diketahui | |---|---|---|---| | 0 | 零 | líng | juga ditulis 〇 dalam tahun dan tanggal | | 1 | 一 | yī | dibaca yāo (ditulis 幺) pada nomor telepon | | 2 | 二 | èr | 两 (liǎng) dipakai untuk jumlah | | 3 | 三 | sān | tiga goresan mendatar | | 4 | 四 | sì | bunyinya mirip 死 (sǐ, "mati") | | 5 | 五 | wǔ | — | | 6 | 六 | liù | bunyinya mirip 流 (liú, "mengalir lancar") | | 7 | 七 | qī | — | | 8 | 八 | bā | bunyinya mirip 发 (fā, "menjadi kaya") | | 9 | 九 | jiǔ | bunyinya mirip 久 (jiǔ, "awet") | | 10 | 十 | shí | dua goresan yang bersilang | **Pinyin** adalah cara baku menulis bunyi bahasa Mandarin dengan huruf Latin. Bahasa Mandarin punya empat nada — tinggi mendatar (ā), naik (á), turun-naik (ǎ), dan turun (à) — serta nada netral, dan nada yang berbeda berarti kata yang berbeda: sì (4, turun) dan sǐ (mati, turun-naik) hanya berbeda nada. Tanda itu bukan hiasan; pelajari setiap bilangan beserta nadanya. > **Mengapa 一 terdengar berbeda saat diucapkan** > > Buku pelajaran memberi tiap aksara nadanya sendiri, seperti artikel ini. Saat diucapkan, 一 (yī) berubah: menjadi yí sebelum nada turun (一万 yí wàn) dan yì sebelum nada lainnya (一百 yì bǎi, 一千 yì qiān). Tulisannya tidak pernah berubah, hanya bunyinya. ## Bagaimana cara kerja bilangan 11 sampai 99 dalam bahasa China? **Bilangan dari 11 sampai 99 dibangun dengan menyebut puluhan lebih dulu dan satuan kemudian: 十一 adalah "sepuluh-satu" (11), 二十 adalah "dua-sepuluh" (20), dan 三十五 adalah "tiga-sepuluh-lima" (35).** Tidak ada yang perlu dihafal selain 零 sampai 十 dan satu aturan: untuk 10 sampai 19 ucapkan 十 lalu angkanya, dan untuk 20 sampai 99 ucapkan angka puluhan, lalu 十, lalu angka satuan (dihilangkan bila 0). | Bilangan | Aksara | Pinyin | Secara harfiah | |---|---|---|---| | 11 | 十一 | shí yī | sepuluh-satu | | 12 | 十二 | shí èr | sepuluh-dua | | 20 | 二十 | èr shí | dua-sepuluh | | 21 | 二十一 | èr shí yī | dua-sepuluh-satu | | 35 | 三十五 | sān shí wǔ | tiga-sepuluh-lima | | 99 | 九十九 | jiǔ shí jiǔ | sembilan-sepuluh-sembilan | Bandingkan dengan bahasa Inggris, yang punya kata khusus eleven, twelve, thirteen, dan twenty, serta dengan bahasa Indonesia, tempat 11 adalah sebelas, 12 adalah dua belas (belas menandai belasan), dan 20 adalah dua puluh. Bahasa China sama sekali tidak punya pengecualian seperti itu. | Bilangan | Bahasa China | Bahasa Indonesia | Bahasa Inggris | |---|---|---|---| | 11 | 十一 | sebelas | eleven | | 12 | 十二 | dua belas | twelve | | 20 | 二十 | dua puluh | twenty | | 21 | 二十一 | dua puluh satu | twenty-one | | 35 | 三十五 | tiga puluh lima | thirty-five | Para peneliti mengaitkan nama bilangan yang teratur seperti ini dengan cara anak belajar berhitung. Dalam studi tahun 1995 oleh Miller dan kawan-kawan, anak-anak berbahasa China berhitung lebih jauh daripada anak-anak Amerika seusianya, dan perbedaannya terutama tampak pada bilangan di atas sepuluh, tempat nama dalam bahasa Inggris tidak lagi teratur. ## Bagaimana menyebut ratusan, ribuan, dan nol dalam bahasa China? **Ratusan dan ribuan memakai kata tempat 百 (bǎi) dan 千 (qiān) setelah angkanya, dan celah berisi nol dibaca satu 零 (líng): 105 adalah 一百零五.** Berbeda dengan 十, kata 百 dan 千 selalu membutuhkan angkanya, jadi 100 adalah 一百 dan tidak pernah hanya 百. | Bilangan | Aksara | Pinyin | Yang perlu diperhatikan | |---|---|---|---| | 100 | 一百 | yī bǎi | 一 dipertahankan sebelum 百 | | 101 | 一百零一 | yī bǎi líng yī | satu 零 untuk tempat puluhan yang kosong | | 110 | 一百一十 | yī bǎi yī shí | 一十, bukan 十, karena 十 tidak berada di awal | | 305 | 三百零五 | sān bǎi líng wǔ | 零 untuk tempat puluhan yang kosong | | 1.000 | 一千 | yī qiān | nol di ujung tidak dibaca | | 1.001 | 一千零一 | yī qiān líng yī | dua tempat kosong, tetapi satu 零 | | 1.010 | 一千零一十 | yī qiān líng yī shí | satu 零 untuk tempat ratusan yang kosong | | 2.000 | 两千 | liǎng qiān | 两, bukan 二, sebelum 千 | | 2.345 | 两千三百四十五 | liǎng qiān sān bǎi sì shí wǔ | | **Aturan nol.** Ucapkan 零 satu kali untuk setiap celah berisi satu atau lebih angka nol yang berada di antara dua angka bukan nol. Jangan pernah mengucapkannya untuk nol di ujung bilangan: 1.000 adalah 一千, bukan "一千零". **Dua kata untuk 2.** Pakai 二 (èr) ketika 2 adalah sebuah angka atau angka terakhir sebuah kelompok (二十, 十二, 第二). Pakai 两 (liǎng) ketika angka 2 yang berdiri sendiri berada sebelum 千, 万, atau 亿 (两千, 两万, 两亿) dan sebelum kata penggolong (两个人, "dua orang"). Sebelum 百 keduanya terdengar: 二百 dan 两百. **Dalam percakapan, satuan terakhir sering dihilangkan.** 一百五 biasanya berarti 150 (一百五十) dan 三千五 berarti 3.500. Itulah sebabnya 105 harus mempertahankan 零-nya: 一百零五 adalah 105, tetapi 一百五 adalah 150. ## Mengapa bahasa China menghitung dengan 万 dan 亿, bukan ribuan dan jutaan? **Bahasa China mengelompokkan angka empat-empat, bukan tiga-tiga: setelah 千 (1.000) kata baru berikutnya adalah 万 (wàn, 10.000), dan setelah itu 亿 (yì, 100.000.000).** Bahasa Inggris, Indonesia, dan kebanyakan bahasa Eropa menambah kata baru setiap tiga angka (ribu, juta, miliar). Bahasa China menambah satu setiap empat angka, jadi sebuah bilangan adalah daftar pendek bilangan sampai 9999, masing-masing diikuti 万 atau 亿. | Nilai | Bahasa China | Bahasa Inggris | Bahasa Indonesia | |---|---|---|---| | 10.000 | 一万 | ten thousand | sepuluh ribu | | 100.000 | 十万 | one hundred thousand | seratus ribu | | 1.000.000 | 一百万 | one million | satu juta | | 10.000.000 | 一千万 | ten million | sepuluh juta | | 100.000.000 | 一亿 | one hundred million | seratus juta | | 1.000.000.000 | 十亿 | one billion | satu miliar | | 1.000.000.000.000 | 一万亿 | one trillion | satu triliun | Kedua sistem bertemu hanya pada 10 pangkat 12, tempat 万亿 (10.000 × 100.000.000) adalah satu triliun. Di antaranya, penutur harus menerjemahkan: "100.000" bukan "seratus ribu" melainkan "sepuluh wàn". Kata myriad yang dipakai para sarjana untuk 10.000 adalah satuan yang sama dengan 万. **Cara cepat membaca bilangan apa pun.** Hitung angka dari kanan, empat demi empat. Empat angka pertama adalah kelompok biasa, empat berikutnya adalah kelompok 万, dan empat berikutnya lagi adalah kelompok 亿. Widget di bawah memperlihatkan kedua pengelompokan sekaligus. ## Bagaimana menulis bilangan apa pun dalam bahasa China, langkah demi langkah? **Untuk menulis sebuah bilangan dalam bahasa China, bagi angkanya menjadi kelompok empat-empat dari kanan, baca tiap kelompok dengan 千 百 十, taruh 亿 atau 万 setelah kelompok, dan ucapkan 零 satu kali untuk setiap celah berisi nol.** Ambil 20.508.030: 1. Tulis angkanya dan potong menjadi kelompok empat-empat dari kanan: 2050 | 8030. 2. Baca tiap kelompok sebagai bilangan sampai 9999 dengan 千, 百, dan 十. 2050 adalah 两千零五十 dan 8030 adalah 八千零三十. 3. Taruh 万 setelah kelompok kedua dari kanan dan 亿 setelah kelompok ketiga. Kelompok terakhir tidak punya satuan: 两千零五十万 八千零三十. 4. Ucapkan 零 satu kali untuk setiap celah berisi nol, termasuk celah di antara kelompok (ketika sebuah kelompok dimulai di bawah 1.000, atau seluruh kelompok kosong). 5. Periksa kasus khusus: 两 untuk angka 2 yang berdiri sendiri sebelum 千, 万, atau 亿; hilangkan 一 hanya sebelum 十 di awal (十, 十一, 十万); dan jangan baca nol di ujung. Jadi 20.508.030 adalah 两千零五十万八千零三十 (liǎng qiān líng wǔ shí wàn bā qiān líng sān shí). Coba bilanganmu sendiri di bawah, dan ganti antara tulisan sederhana, tradisional, dan formal. > **Aksara tradisional** > > Taiwan, Hong Kong, dan Makau menulis dengan aksara tradisional. Hanya tiga aksara bilangan yang berbeda dari aksara sederhana yang dipakai di daratan: 两 menjadi 兩, 万 menjadi 萬, dan 亿 menjadi 億. Selebihnya, dan setiap aturan di atas, sama saja. ## Bagaimana berlatih membaca bilangan China? **Untuk membaca bilangan China, cari 亿 dan 万, baca tiap bagian sebagai bilangan sampai 9999, dan tulis tiap bagian dengan empat angka.** Membaca adalah langkah menulis yang dijalankan terbalik: 1. Cari 亿 dan 万 dalam bilangan itu dan potong setelah masing-masing. 2. Baca tiap bagian sendiri-sendiri: 千 adalah ribuan, 百 ratusan, 十 puluhan, dan sisanya satuan. 3. Tulis setiap bagian kecuali yang pertama dengan empat angka, dengan nol di depan bila perlu (零 memberi tahu bahwa sebuah tempat kosong). 4. Gabungkan bagian-bagiannya. Misalnya 两千零五十万八千零三十 adalah 2050 | 8030, yaitu 20.508.030. Berlatihlah dengan widget di bawah: delapan bilangan dengan ukuran yang makin besar, dengan pinyin bila diminta. Jawaban yang salah adalah kesalahan yang memang sering dibuat — satu tempat terlalu banyak atau terlalu sedikit, dua angka tertukar, atau satu angka meleset. ## Bagaimana menyebut pecahan, desimal, persen, tahun, dan nomor telepon? **Pecahan, desimal, persen, bilangan negatif, dan bilangan urutan mengikuti pola tetap yang dibangun dari kata bilangan yang sama, sedangkan tahun dan nomor telepon dibaca angka demi angka.** | Arti | Pola | Contoh | Pinyin | |---|---|---|---| | Desimal | bagian bulat + 点 + angka satu per satu | 3,14 = 三点一四 | sān diǎn yī sì | | Pecahan | penyebut + 分之 + pembilang | 1/3 = 三分之一 | sān fēn zhī yī | | Pecahan | penyebut selalu lebih dulu | 2/3 = 三分之二 | sān fēn zhī èr | | Persen | 百分之 + bilangan | 25% = 百分之二十五 | bǎi fēn zhī èr shí wǔ | | Negatif | 负 + bilangan | −5 = 负五 | fù wǔ | | Urutan | 第 + bilangan | ke-3 = 第三 | dì sān | | Setengah | 半 | setengah jam = 半小时 | bàn xiǎoshí | | Tahun | angka demi angka + 年 | 2025 = 二〇二五年 | èr líng èr wǔ nián | | Nomor telepon | angka demi angka, 1 = 幺 | 110 = 幺幺〇 | yāo yāo líng | [Pecahan](https://nunada.my.id/artikel/bilangan-rasional/) dibaca "dari tiga bagian, satu": 三分之一 berarti "satu dari tiga bagian". [Persen](https://nunada.my.id/artikel/bilangan-rasional/#decimals-percent) adalah "dari seratus bagian": 百分之五十 adalah 50%. Angka setelah 点 tidak pernah dikelompokkan: 3,14 dibaca "tiga koma satu empat", bukan "tiga koma empat belas". Tahun adalah label, bukan jumlah, sehingga dibaca sebagai angka-angka terpisah dan ditulis dengan 〇 (atau 零): 二〇二五年. Jumlah "dua ribu dua puluh lima" adalah 两千零二十五. ## Apa itu angka formal China 壹, 贰, 叁? **Angka formal China (大写数字, dàxiě shùzì) adalah set aksara kedua untuk bilangan yang sama, dipakai pada cek, kuitansi, dan kontrak karena sulit diubah.** 一 yang biasa dapat menjadi 三 dengan satu goresan, dan 十 dapat menjadi 千; 壹 dan 叁 tidak bisa. | Bilangan | Biasa | Formal | Pinyin | |---|---|---|---| | 0 | 零 | 零 | líng | | 1 | 一 | 壹 | yī | | 2 | 二 | 贰 | èr | | 3 | 三 | 叁 | sān | | 4 | 四 | 肆 | sì | | 5 | 五 | 伍 | wǔ | | 6 | 六 | 陆 | lù | | 7 | 七 | 柒 | qī | | 8 | 八 | 捌 | bā | | 9 | 九 | 玖 | jiǔ | | 10 | 十 | 拾 | shí | | 100 | 百 | 佰 | bǎi | | 1.000 | 千 | 仟 | qiān | Aturan bacanya sama, dengan dua perbedaan: bentuk formal 2 selalu 贰 (tidak pernah 两), dan 10 ditulis 壹拾 dengan 壹 tetap ada. Sebuah cek senilai 1.205 yuan dibaca 壹仟贰佰零伍元整 (yī qiān èr bǎi líng wǔ yuán zhěng), tempat 整 berarti "tepat", menutup jumlah itu agar tidak ada yang bisa ditambahkan di belakangnya. Konverter di atas punya pengaturan formal. Gagasannya sama dengan menulis jumlah dengan huruf pada cek dalam bahasa Inggris atau Indonesia. ## Apa itu batang hitung China dan angka Suzhou? **Batang hitung (算筹, suànchóu) adalah batang kecil dari bambu, tulang, atau gading yang disusun dalam kolom di permukaan datar untuk berhitung; ia membentuk sistem nilai tempat desimal awal, tempat sebuah tempat yang kosong adalah celah.** Seikat batang hitung ditemukan di makam dinasti Han (206 SM sampai 220 M), dan Sunzi suanjing, yang ditulis antara abad ke-3 dan ke-5 M, menjelaskan cara menyusun angkanya. Batang hitung berangsur digantikan oleh sempoa (算盘, suànpán), yang sudah meluas pada masa dinasti Ming (1368 sampai 1644). Cara sebuah bilangan disusun: - Setiap tempat mendapat kolomnya sendiri, dengan tempat tertinggi di kiri, persis seperti angka yang ditulis. - Angka 1 sampai 5 adalah sebanyak itu batang. Untuk 6 sampai 9, satu batang yang dibaringkan melintang mewakili 5, dan batang sisanya ditambahkan padanya. - Arahnya bergantian dari tempat ke tempat: batang berdiri tegak di tempat satuan, ratusan, dan puluh ribuan, dan berbaring mendatar di tempat puluhan, ribuan, dan ratus ribuan, sehingga dua angka bertetangga tidak pernah tertukar. - Nol adalah kolom kosong. Lingkaran tertulis untuk nol muncul dalam buku matematika China pada abad ke-13, misalnya dalam Shùshū Jiǔzhāng karya Qin Jiushao (1247). - Batang merah positif dan batang hitam negatif dalam Nine Chapters on the Mathematical Art, sehingga satu kolom batang dapat menyimpan utang: lihat sejarah [bilangan negatif](https://nunada.my.id/artikel/bilangan-bulat/#what-are-integers) pada artikel bilangan bulat. **Angka Suzhou** (苏州码子, Sūzhōu mǎzi) adalah tulisan singkat yang tumbuh dari batang hitung, lama dipakai para pedagang dan masih terlihat pada beberapa label harga di pasar: 〇 〡 〢 〣 〤 〥 〦 〧 〨 〩 untuk 0 sampai 9. Widget menggambar batang hitung untuk sebuah bilangan di samping angka Suzhou-nya. > **Sebuah konvensi gambar** > > Sumber-sumber lama berbeda dalam rincian kecil, misalnya ujung mana yang membawa batang pewakil lima pada bentuk berbaring. Widget menggambar satu bentuk yang umum agar gagasannya jelas; ia bukan tiruan persis dari teks tertentu. ## Mengapa sebagian bilangan dianggap beruntung atau tidak beruntung dalam bahasa China? **Bilangan dianggap beruntung atau tidak beruntung dalam bahasa China karena bunyinya: bilangan yang bunyinya mirip kata yang baik dianggap beruntung, dan yang bunyinya mirip kata yang buruk dihindari.** Maknanya berasal dari bunyi, bukan dari bilangannya. | Bilangan | Pinyin | Bunyinya mirip | Makna | |---|---|---|---| | 8 | bā | 发 (fā) "menjadi kaya" | bilangan paling beruntung: harga, pelat mobil, tanggal | | 6 | liù | 流 (liú) "mengalir lancar" | beruntung: semuanya berjalan lancar | | 9 | jiǔ | 久 (jiǔ) "awet" | beruntung, umum pada pernikahan | | 4 | sì | 死 (sǐ) "mati" | tidak beruntung: sebagian gedung tidak punya lantai 4 | | 520 | wǔ èr líng | 我爱你 (wǒ ài nǐ) "aku cinta kamu" | dipakai pada 20 Mei, "hari 520" | | 1314 | yī sān yī sì | 一生一世 (yī shēng yī shì) "seumur hidup" | dipakai dalam pesan cinta | | 666 | liù liù liù | lancar, lancar, lancar | bahasa gaul internet untuk "keren sekali" | | 88 | bā bā | 拜拜 (bàibài) "dadah" | dipakai di ujung pesan teks | Olimpiade Musim Panas Beijing dibuka pada 8 Agustus 2008 pukul 20:08, tanggal dan waktu yang dipilih karena semua angka delapan itu. ## Bagaimana menunjukkan bilangan dengan satu tangan di China? **Penutur bahasa China menunjukkan bilangan 1 sampai 10 dengan satu tangan, memakai tanda untuk setiap bilangan yang tidak bergantung pada bahasa, sehingga penjual dan pembeli di pasar bisa sepakat soal harga di jalan yang bising.** Ini adalah tanda yang umum; rinciannya berbeda menurut daerah dan orangnya. | Bilangan | Tanda yang umum | |---|---| | 1 sampai 5 | sebanyak itu jari diangkat: 1 adalah jari telunjuk, 2 menambah jari tengah, dan 5 adalah telapak terbuka | | 6 | ibu jari dan kelingking terbuka, jari lainnya dilipat | | 7 | ibu jari dan ujung-ujung jari dijepitkan | | 8 | ibu jari dan telunjuk terbuka, membentuk huruf L | | 9 | jari telunjuk ditekuk seperti kait | | 10 | kepalan tangan, atau dua telunjuk disilangkan untuk menggambar 十 | Tanda untuk 10 menggambar aksaranya sendiri: dua garis yang bersilang, 十. ## Apa kesalahan umum dengan bilangan China? **Kesalahan paling umum dengan bilangan China adalah tujuh hal berikut, masing-masing dengan bentuk yang benar.** | Kesalahan | Yang benar | |---|---| | ❌ "10.000 adalah 十千." | 10.000 adalah 一万. Bahasa China punya kata untuk 10 pangkat 4, jadi 十千 tidak pernah diucapkan. | | ❌ "105 adalah 一百五." | 一百五 adalah 150, karena satuan terakhir dihilangkan dalam percakapan. 105 adalah 一百零五. | | ❌ "30.000 adalah 三千万." | 三千万 adalah 30.000.000. 30.000 adalah 三万. | | ❌ "100 cukup 百." | 100 adalah 一百. Hanya 十 yang boleh kehilangan 一-nya, dan hanya di awal bilangan. | | ❌ "Dua orang adalah 二个人." | Ucapkan 两个人. Pakai 两 sebelum kata penggolong. | | ❌ "2025 adalah 两千零二十五年." | Tahun dibaca angka demi angka: 二〇二五年. | | ❌ "Ucapkan 零 untuk setiap nol." | Ucapkan 零 satu kali per celah, dan jangan untuk nol di ujung. | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: bilangan China sekilas - **0 sampai 10** adalah 零 一 二 三 四 五 六 七 八 九 十; **11 sampai 99** adalah angka-angka yang digabung dengan 十 (十一, 二十, 三十五). - **Ratusan dan ribuan** memakai 百 dan 千 setelah angkanya; 100 adalah 一百, tidak pernah 百. - **Nol:** ucapkan 零 satu kali per celah berisi nol, termasuk melewati 万 dan 亿; jangan untuk nol di ujung. - **Dua:** 二 sebagai angka, 两 sebelum 千, 万, 亿, dan kata penggolong; 二百 dan 两百 sama-sama terdengar. - **Kelompok empat:** 万 adalah 10.000 dan 亿 adalah 100.000.000, jadi 100.000 adalah 十万 dan satu miliar adalah 十亿. - **Pola:** 三分之一 (1/3), 百分之五十 (50%), 第三 (ke-3), 负五 (−5); tahun dan nomor telepon dibaca angka demi angka. - **Angka formal** 壹 贰 叁 … untuk cek dan kontrak; **batang hitung** dan **angka Suzhou** adalah sistem tulis lebih tua dengan nol dibiarkan kosong. ## Glosarium: istilah penting - **Pinyin**: Sistem baku untuk menulis bunyi bahasa Mandarin dengan huruf Latin dan tanda nada, seperti sān untuk 3. - **Nada**: Pola tinggi-rendah suara pada suku kata Mandarin; ada empat nada dan satu nada netral, dan mengubah nada mengubah kata. - **Hanzi (汉字)**: Aksara China; setiap kata bilangan ditulis dengan satu aksara, seperti 三 untuk 3. - **万 (wàn)**: Kata China untuk 10.000, satuan yang mengikuti 千 dan yang mengelompokkan angka empat-empat. - **亿 (yì)**: Kata China untuk 100.000.000, sepuluh ribu kali 万. - **零 (líng)**: Nol; ia juga dibaca satu kali untuk setiap celah berisi nol di antara dua angka bukan nol. - **两 (liǎng)**: Bentuk 2 yang dipakai untuk jumlah dan sebelum 千, 万, dan 亿 sebagai pengganti 二. - **Angka formal (大写)**: Set aksara kedua untuk bilangan, seperti 壹 贰 叁, dipakai pada cek dan kontrak karena sulit diubah. - **Batang hitung (算筹)**: Batang kecil yang disusun dalam kolom untuk berhitung, sistem nilai tempat desimal awal tempat nol adalah tempat yang kosong. - **Angka Suzhou**: Tulisan singkat turunan batang hitung, dipakai para pedagang, dengan 〡 sampai 〩 untuk 1 sampai 9 dan 〇 untuk 0. - **Myriad**: Kata bahasa Inggris yang lebih tua untuk 10.000, satuan yang sama dengan 万. - **Nilai tempat**: Prinsip bahwa sebuah angka bernilai lebih besar atau lebih kecil bergantung pada letaknya dalam bilangan. ## Pertanyaan yang sering diajukan ### Bagaimana menghitung dari 1 sampai 10 dalam bahasa China? Dalam bahasa Mandarin, bilangan 1 sampai 10 adalah 一 yī, 二 èr, 三 sān, 四 sì, 五 wǔ, 六 liù, 七 qī, 八 bā, 九 jiǔ, dan 十 shí. Nol adalah 零 líng. Setiap bilangan satu aksara, dan tanda nada pada pinyin menunjukkan cara pengucapannya. ### Bagaimana mengucapkan 100 dalam bahasa China? Seratus adalah 一百, dibaca yī bǎi. Aksara 一 tidak boleh dihilangkan sebelum 百, jadi 百 saja bukan 100. Bandingkan dengan 10 yang cukup 十, dan 101 yang adalah 一百零一 dengan 零 untuk tempat puluhan yang kosong. ### Bagaimana mengucapkan 10.000 dalam bahasa China? Sepuluh ribu adalah 一万, dibaca yī wàn. Bahasa China punya kata sendiri, 万, untuk 10.000, sehingga tidak ada "sepuluh ribu" yang disusun dari 十 dan 千. Seratus ribu adalah 十万 dan satu juta adalah 一百万. ### Mengapa bahasa China memakai 万 dan 亿, bukan ribu dan juta? Bahasa China mengelompokkan angka empat-empat: 万 adalah 10.000 dan 亿 adalah 100.000.000, masing-masing empat angka di atas sebelumnya. Bahasa Inggris dan Indonesia mengelompokkan angka tiga-tiga dengan ribu, juta, dan miliar. Tidak ada pengelompokan yang lebih benar; keduanya hanyalah konvensi berbeda untuk menamai bilangan besar. ### Apa beda 二 dan 两? Keduanya berarti 2. Pakai 二 (èr) untuk angka itu sendiri, dalam 二十, 十二, dan bilangan urutan seperti 第二. Pakai 两 (liǎng) untuk jumlah, sebelum kata penggolong seperti 两个人, dan sebelum 千, 万, dan 亿 seperti 两千 dan 两万. Sebelum 百 keduanya terdengar: 二百 dan 两百. ### Bagaimana mengucapkan nol dalam bahasa China? Nol adalah 零, dibaca líng. Dalam tahun dan tanggal sering ditulis 〇, sebuah lingkaran, dengan bunyi yang sama. Di dalam sebuah bilangan, 零 juga diucapkan satu kali untuk celah berisi nol, seperti 一百零五 untuk 105. ### Bagaimana mengucapkan 2025 dalam bahasa China? Sebagai tahun, 2025 dibaca angka demi angka: 二〇二五年, èr líng èr wǔ nián. Sebagai jumlah, misalnya 2.025 orang, bunyinya 两千零二十五, liǎng qiān líng èr shí wǔ. Tahun adalah label, jadi tidak dibaca sebagai satu bilangan. ### Bagaimana mengucapkan satu juta dan satu miliar dalam bahasa China? Satu juta adalah 一百万, yī bǎi wàn, secara harfiah "seratus wàn". Satu miliar adalah 十亿, shí yì, secara harfiah "sepuluh yì". Satu triliun adalah 一万亿, yī wàn yì. Hitung angka empat-empat dari kanan untuk menemukan satuannya. ### Apakah bilangan China lebih mudah dipelajari daripada bilangan Inggris? Di atas sepuluh, bilangan China lebih teratur, karena 12 adalah sepuluh-dua dan 21 adalah dua-sepuluh-satu, tanpa kata seperti eleven atau twenty. Studi tahun 1995 oleh Miller dan kawan-kawan menemukan anak-anak berbahasa China berhitung lebih jauh daripada teman sebaya Amerika. Bilangan besar dengan 万 dan 亿 tetap perlu latihan. ### Apa itu angka formal China? Angka formal adalah set aksara kedua yang dipakai pada cek dan kontrak: 壹 贰 叁 肆 伍 陆 柒 捌 玖 拾 untuk 1 sampai 10, dengan 佰 untuk 100 dan 仟 untuk 1.000. Angka ini sulit diubah, berbeda dari 一 二 三 yang dapat diubah dengan satu goresan. ### Bagaimana mengucapkan nomor telepon dalam bahasa China? Nomor telepon dibaca angka demi angka, dan angka 1 diucapkan yāo (幺) dan bukan yī agar tidak tertukar dengan 7, qī. Nomor polisi 110 karena itu dibaca yāo yāo líng. ### Bilangan apa yang beruntung dalam budaya China? Delapan paling beruntung karena bā berbunyi mirip fā, "menjadi kaya". Enam berbunyi mirip "lancar" dan sembilan mirip "awet". Empat tidak beruntung karena sì berbunyi mirip sǐ, "mati", sehingga sebagian gedung melewatkan lantai empat. Keberuntungannya berasal dari bunyi katanya. ### Apakah semua bahasa China memakai bilangan yang sama? Aksaranya sama, tetapi pengucapannya berbeda menurut bahasanya. Bahasa Kanton mengucapkan 一 sebagai yāt dan 三 sebagai sāam, dan sering memakai 廿 untuk 20 tempat bahasa Mandarin mengucapkan 二十. Artikel ini mengajarkan bahasa Mandarin, bahasa baku di daratan China, Taiwan, dan Singapura. --- # Real Numbers: Definition, Types, Examples and Properties Source: https://nunada.my.id/articles/real-numbers/ Updated: 2026-10-10 ## Quick answer **Real numbers** are all the numbers that sit on the number line. They are the numbers we use every day — integers, fractions, and decimals that terminate or eventually repeat periodically, all called rational numbers — together with numbers such as $\sqrt{2}$ and $\pi$ that no fraction can equal, called irrational numbers. The set of real numbers is written $\mathbb{R}$. A real number is rational when its decimal expansion terminates or eventually repeats periodically, and irrational when its decimal expansion is infinite and never periodic. ### Key takeaways - Every point on the number line is a real number, and every real number is a point: $\mathbb{R}$ is the number line. - The number sets nest: $\mathbb{N}\subset W\subset\mathbb{Z}\subset\mathbb{Q}\subset\mathbb{R}$, and the irrational numbers are the real numbers outside $\mathbb{Q}$. - A fraction in lowest terms has a terminating decimal expansion exactly when its denominator has no prime factor other than 2 and 5. Otherwise the expansion eventually repeats periodically. - $\sqrt{2}$ is irrational, and the proof is short. So are $\pi$ and $e$, and for a positive integer $n$, $\sqrt{n}$ is irrational exactly when $n$ is not a perfect square. - Between any two real numbers there are infinitely many rational and infinitely many irrational numbers, yet the rationals alone leave gaps that the real numbers fill. - A computer keeps only a finite binary approximation of a real number, which is why `0.1 + 0.2 == 0.3` is False in Python and JavaScript. Compare with a tolerance. ## What is a real number? A **real number** is any number that can be placed on the number line. Equivalently, it is any number that has a decimal expansion: one that terminates, one that eventually repeats periodically, or one that is infinite and never periodic: $3$, $-0.5$, $\frac{1}{3}=0.333\ldots$ and $\sqrt{2}=1.41421\ldots$ are all real numbers. The set of all real numbers is written $\mathbb{R}$. Every time you measure something — the length of a table, the temperature at noon, the time a race took — the answer is a real number. Another way to say the same thing is geometric. Draw a straight line, mark a point for 0 and another for 1, and every point on the line stands for exactly one real number. The line is the **number line**. Intuitively it has no gaps; that property is called **completeness**, and the section on the number line below says exactly what it means. Real numbers are the numbers used in measurement, in calculus, in physics, and in almost every program that does arithmetic. Knowing how they are organized — which are fractions, which are not, and how a computer stores them — prevents a long list of mistakes, from a wrong exam answer to a wrong bank balance. **A note on notation.** In this article the natural numbers $\mathbb{N}$ are $1,2,3,\ldots$ and the whole numbers $W$ are $0,1,2,3,\ldots$. Some books count 0 as a natural number, so check the convention when you read elsewhere. The word integer always means a number in $\mathbb{Z}$, and decimal expansion means the full list of digits of a number, however long. **Real numbers at a glance** | Fact | Detail | |---|---| | Symbol | $\mathbb{R}$ | | What it contains | all rational and all irrational numbers | | Decimal expansion | terminates, eventually repeats periodically, or is infinite and never periodic | | Operations | closed under addition, subtraction, multiplication and division (never by 0) | | Size | uncountably infinite (Cantor, 1874) | | Built rigorously by | Dedekind and Cantor, both in 1872 | | Not real numbers | $\infty$, and $\sqrt{-1}$ (a complex number) | *Rational and irrational numbers share one number line: −3/2 is a fraction, √2 and π are not.* > **Definition for the curious** > > In university mathematics, $\mathbb{R}$ is the **complete ordered field**. Field means you can add, subtract, multiply and divide (except by 0) with the usual rules. Ordered means any two numbers can be compared. Complete means the line has no gaps: every non-empty set that is bounded above has a least upper bound. Dedekind (1872) and Cantor (1872) each showed how to build such a number system from the rational numbers, and Rudin (1976, chapter 1) gives the standard modern treatment. ## What are the types of real numbers? **The types of real numbers are the natural, whole, integer, rational and irrational numbers.** They are built up in layers: each layer contains the one before it and adds numbers the earlier layers could not express. | Set | Symbol | What it contains | Examples | |---|---|---|---| | Natural numbers | ℕ | the counting numbers $1, 2, 3, \ldots$ | 1, 7, 250 | | Whole numbers | W | the natural numbers together with 0: $0, 1, 2, 3, \ldots$ | 0, 3, 12 | | Integers | ℤ | whole numbers and their negatives | −5, 0, 8 | | Rational numbers | ℚ | every number $\frac{p}{q}$ with integers $p$ and $q\neq 0$ | $\frac{2}{3}$, −0.75, 4 | | Irrational numbers | ℝ∖ℚ | real numbers that are not rational | $\sqrt{2}$, $\pi$, $e$ | | Real numbers | ℝ | all of the above together | everything on the number line | Every [integer](https://nunada.my.id/articles/integers/) is rational, because $5=\frac{5}{1}$, and the [article on rational numbers](https://nunada.my.id/articles/rational-numbers/) shows how fractions are compared, added and simplified. Every rational number is real. And the two big families, rational and irrational, do not overlap: a real number is exactly one of them. > **Does ℕ include 0?** > > It depends on the book. Indonesian school mathematics uses bilangan asli for $1, 2, 3, \ldots$ and bilangan cacah for $0, 1, 2, \ldots$, which is how this article uses ℕ and W. Many international textbooks write ℕ for the set that starts at 0. Always check which convention a source uses. Not every number is real. The equation $x^2=-1$ has no real solution, because a real number squared is never negative. Mathematicians add a new number $i$ with $i^2=-1$ and get the **complex numbers** $\mathbb{C}$, which contain $\mathbb{R}$ — but that is another article. One trap before you try the next activity. A root sign does not make a number irrational: $\sqrt{16}=4$ is a natural number. And a decimal does not make a number irrational either: $1.4142$ terminates, so it is the fraction $\frac{14142}{10000}$. ## What is a rational number? Fractions and decimals A **rational number** is a number that can be written as a fraction $\frac{p}{q}$ of two integers, with $q\neq 0$. The word comes from ratio. Every rational number can also be written as a decimal, and its decimal expansion always behaves in one of two ways: - It **terminates**: $\frac{1}{8}=0.125$ and $\frac{3}{40}=0.075$. - It **eventually repeats periodically**, with one block of digits repeating without end: $\frac{1}{3}=0.333\ldots=0.\overline{3}$ and $\frac{3}{11}=0.272727\ldots=0.\overline{27}$. The bar over the digits marks the repeating block. Which of the two happens is decided by the denominator, once the fraction is in lowest terms. > **The prime-factor rule** > > Write the fraction in lowest terms and factorize its denominator into primes. If the **only** primes are 2 and 5, the decimal expansion terminates. If any other prime appears, it eventually repeats periodically. > > For example $\frac{7}{20}$: $20=2^2\times 5$, so it terminates ($0.35$). For $\frac{5}{12}$: $12=2^2\times 3$, and the 3 forces a repeat ($0.41\overline{6}$). The reason: dividing by $2^a5^b$ is the same as multiplying to reach a power of 10, and powers of 10 contain only 2s and 5s. **Why must a decimal repeat?** Do the long division of $\frac{p}{q}$. After each digit a remainder is left, and it is always one of $0, 1, \ldots, q-1$. If the remainder is ever 0, the decimal terminates. If not, there are only $q-1$ possible non-zero remainders, so within $q$ steps one of them must come back — and from that moment the digits repeat, because the same remainder leads to the same next digit. This is why the block of $\frac{1}{7}=0.\overline{142857}$ is exactly 6 digits long, one less than 7. **How to turn a repeating decimal into a fraction.** Follow these steps, shown for $x=0.\overline{27}$: 1. Name the number: let $x=0.\overline{27}$. 2. Multiply by $10^n$, where $n$ is the length of the repeating block (here 2, so multiply by 100): $100x=27.\overline{27}$. 3. Subtract the original number, so the endless tails cancel: $100x-x=27$, which is $99x=27$. 4. Solve and simplify: $x=\frac{27}{99}=\frac{3}{11}$. When some digits do not repeat, as in $0.41\overline{6}$, use two shifts: $100x=41.\overline{6}$ and $1000x=416.\overline{6}$. Subtracting gives $900x=375$, so $x=\frac{375}{900}=\frac{5}{12}$. > **0.999… equals 1** > > Let $x=0.\overline{9}$. Then $10x=9.\overline{9}$, and $10x-x=9$ gives $9x=9$, so $x=1$. The two decimals $0.999\ldots$ and $1$ are two names for the same number. Any terminating decimal has such a twin: $0.5=0.4999\ldots$. ## What is an irrational number? (with a proof for √2) An **irrational number** is a real number that is **not** rational: no fraction of two integers equals it. Its decimal expansion is infinite and never periodic. Famous examples: - $\sqrt{2}=1.41421356\ldots$, the diagonal of a square with side 1. - $\pi=3.14159265\ldots$, the ratio of a circle's circumference to its diameter. - $e=2.71828182\ldots$, the base of natural logarithms, which appears in growth and decay. - $\varphi=\dfrac{1+\sqrt{5}}{2}=1.61803398\ldots$, the golden ratio. There is a simple test for square roots: for a positive integer $n$, $\sqrt{n}$ is irrational exactly when $n$ is not a perfect square (and when it is, $\sqrt{n}$ is a whole number). Factorize $n$ into [primes](https://nunada.my.id/articles/integers/#primes); if every prime appears an even number of times, $n$ is a perfect square and the root is a whole number. So $\sqrt{50}=5\sqrt{2}$ is irrational, while $\sqrt{49}=7$ is not; [simplifying radicals](https://nunada.my.id/articles/exponents-and-radicals/#simplify-radicals) shows how $\sqrt{50}$ becomes $5\sqrt2$, and the article on [irrational numbers](https://nunada.my.id/articles/irrational-numbers/) goes further, into $\pi$, $e$ and rational approximations. *The diagonal of a unit square is √2, by the Pythagorean theorem: 1² + 1² = 2.* **Proof that √2 is irrational** The ancient Greeks already knew this, and the argument is still the best first example of a proof by contradiction. Suppose $\sqrt{2}=\frac{a}{b}$ where $a$ and $b$ are positive integers that are **coprime**, meaning they have no common factor greater than 1 (a fraction in lowest terms). We will show that this is impossible. 1. Square both sides: $2=\frac{a^2}{b^2}$, so $a^2=2b^2$. 2. So $a^2$ is even. An odd number squared is odd, so $a$ itself must be even: $a=2k$ for some integer $k$. 3. Substitute: $(2k)^2=2b^2$, so $4k^2=2b^2$ and $b^2=2k^2$. 4. So $b^2$ is even, and by the same reasoning $b$ is even. 5. Now $a$ and $b$ are both even, so they share the factor 2. That contradicts the assumption that they are coprime. The assumption led to a contradiction, so no such fraction exists: $\sqrt{2}$ is irrational. ∎ The same idea of proof does not work for $\pi$ and $e$, which are much harder. Euler showed in 1737 that $e$ is irrational, and Lambert showed in 1761 that $\pi$ is (his paper appeared in 1768). Later Hermite (1873) and Lindemann (1882) proved something stronger: $e$ and $\pi$ are not even roots of any polynomial with integer coefficients, which is called being **transcendental**. This is what finally ended the ancient problem of squaring the circle. Now try the decimal digits yourself. The widget below finds $\sqrt{2}$ one digit at a time: at each step, choose the largest digit whose square stays at or below 2. You can do this for ever, and the digits never settle into a pattern. > **π is not 3.14 and not 22/7** > > Both are rational approximations. $3.14=\frac{314}{100}$ and $\frac{22}{7}=3.\overline{142857}$ are fractions, and $\pi$ is not. They are close — $\frac{22}{7}$ is off by about $0.0013$ — but never equal. Use the $\pi$ key on a calculator, or the exact symbol $\pi$, when the answer needs to be exact. **Almost every real number is irrational.** The rational numbers can be listed one after another in a sequence (they are countable), but Cantor proved in 1874 that the real numbers cannot (they are uncountable). If you picked a real number between 0 and 1 completely at random, the probability that it is rational would be 0. The irrational numbers are not the exotic ones; the rationals are the thin thread we happen to write down most often. ## How are real numbers arranged on the number line? **On the number line, the rational numbers are dense but not complete, while the real numbers are both dense and complete.** Two properties of the real numbers sound alike and are not. **Density.** A set is dense in the real numbers when every stretch of the line, however short, contains at least one of its members. The rational numbers are dense, and so are the irrational numbers: between any two different real numbers there is another one — in fact infinitely many rational numbers and infinitely many irrational numbers. If $ab$ is true. Order is transitive ($a-3$. **Intervals.** A stretch of the number line is written as an interval. A square bracket means the end is included, a round bracket means it is not, and $\infty$ always gets a round bracket because it is not a real number. | Interval | Meaning | Inequality | |---|---|---| | $(a,b)$ | open: both ends left out | $aa$ | | $(-\infty,b]$ | everything up to and including $b$ | $x\le b$ | | $(-\infty,\infty)$ | the whole line, $\mathbb{R}$ | any $x$ | **Absolute value.** $|x|$ is the distance from $x$ to 0, so it is never negative: $|x|=x$ if $x\ge0$ and $|x|=-x$ if $x<0$. More generally $|a-b|$ is the distance between $a$ and $b$. The inequality $|x|<3$ means "within 3 of zero", which is the interval $(-3,3)$. ## Why does 0.1 + 0.2 not equal 0.3 in code? **In code, 0.1 + 0.2 does not equal 0.3 because computers store real numbers as 64-bit binary floating-point numbers (floats for short), and 0.1 cannot be stored exactly.** A computer has finite memory, and a real number can need infinitely many digits. So programs store an **approximation**. Almost all languages use the IEEE 754 binary64 format (IEEE 754-2019; see Goldberg, 1991), called a `double` or a Python `float`: 1 sign bit, 11 exponent bits and 52 fraction bits, which gives 53 bits of precision — about 15 to 17 significant decimal digits. The catch is that the format is binary (see [binary numbers](https://nunada.my.id/articles/binary-numbers/#binary-fractions) for how fractions are written in base 2). The decimal $0.1$ is $\frac{1}{10}$, and $10$ has the prime factor 5, so in base 2 the expansion of $0.1$ is periodic without end, just as the expansion of $\frac{1}{3}$ is in base 10. The computer cannot keep an infinite expansion, so it stores the nearest value the format can represent, and the value actually stored is $$0.1000000000000000055511151231257827\ldots$$ Add two such rounded values and the tiny errors show up: ```python >>> 0.1 + 0.2 0.30000000000000004 >>> 0.1 + 0.2 == 0.3 False >>> import math >>> math.sqrt(2) ** 2 2.0000000000000004 >>> math.isclose(0.1 + 0.2, 0.3) True ``` ```javascript 0.1 + 0.2 // 0.30000000000000004 0.1 + 0.2 === 0.3 // false Math.abs(0.1 + 0.2 - 0.3) < Number.EPSILON // true 2 ** 53 + 1 === 2 ** 53 // true: integers lose exactness beyond 2^53 ``` ```cpp #include #include #include using namespace std; int main() { printf("%.17f\n", 0.1 + 0.2); // 0.30000000000000004 cout << (0.1 + 0.2 == 0.3) << endl; // 0 printf("%.16f\n", sqrt(2) * sqrt(2)); // 2.0000000000000004 cout << (fabs(0.1 + 0.2 - 0.3) < 1e-9) << endl; // 1: compare with a tolerance return 0; } /* output: 0.30000000000000004 0 2.0000000000000004 1 */ ``` This is not a bug in Python or JavaScript, and it is not rare. It is the behavior of binary floating point everywhere, in every language that uses it. A useful fact follows from it: every number a computer can store as a float is a **rational** number (a fraction whose denominator is a power of 2). A computer never holds $\sqrt{2}$ or $\pi$ — only a nearby rational number. What to do about it: | Situation | Better approach | |---|---| | Are two results equal? | compare with a tolerance: `math.isclose(a, b)` in Python, or `abs(a - b) < eps` | | Money | store whole cents as integers, or use `decimal.Decimal` | | Exact fractions | `fractions.Fraction` in Python keeps `1/10 + 2/10` exactly `3/10` | | Very large integers | Python `int` is exact at any size; use `BigInt` in JavaScript | | Summing many numbers | `math.fsum` reduces accumulated rounding error | Try it below. The widget calculates both expressions with 64-bit floating point, shows the exact value stored, and checks them the three ways a program might. ## What are the common mistakes about real numbers? **The most common mistakes about real numbers are the eight below, each with the correct fact.** | Myth | Reality | |---|---| | ❌ "π equals 3.14 or 22/7." | Both are rational approximations. π is irrational. | | ❌ "A number with a root sign is irrational." | $\sqrt{16}=4$ is rational. For a positive integer $n$, $\sqrt{n}$ is irrational exactly when $n$ is not a perfect square. | | ❌ "0.999… is just below 1." | It equals 1 exactly. | | ❌ "Irrational numbers are rare." | Almost every real number is irrational. | | ❌ "A long, messy decimal must be irrational." | $\frac{1}{97}$ repeats only after 96 digits and is rational. What matters is whether it ever repeats. | | ❌ "0.1 + 0.2 ≠ 0.3 means the computer is broken." | It is how binary floating point works. Compare with a tolerance. | | ❌ "∞ is a real number." | It is not. It is a symbol for "without bound". | | ❌ "Every number is real." | $\sqrt{-1}$ is not. It is a complex number. | ## Practice: test your understanding These questions mix everything above. A wrong answer costs nothing here: read the hint and try again. ## Summary: real numbers at a glance - **Real numbers** $\mathbb{R}$ are all the points on the number line: rational plus irrational. - **Rational** means a fraction of integers; its decimal expansion terminates or eventually repeats periodically. **Irrational** means it is not: $\sqrt{2}$, $\pi$, $e$. - The chain of sets is $\mathbb{N}\subset W\subset\mathbb{Z}\subset\mathbb{Q}\subset\mathbb{R}$. - A reduced fraction terminates exactly when the denominator has only the primes 2 and 5. - For a positive integer $n$, $\sqrt{n}$ is irrational exactly when $n$ is not a perfect square; $\sqrt{2}$ is irrational by contradiction. - Rational + irrational is irrational; irrational + irrational can be either. - The rationals are dense but have gaps; the reals are dense and complete. - Computers store finite binary approximations, so compare floats with a tolerance and use integers, `Fraction` or `Decimal` for exact work. ## Glossary: key terms - **Real number**: A number that corresponds to a point on the number line; every real number is either rational or irrational. - **Rational number**: A number that can be written as a fraction of two integers with a non-zero denominator; its decimal expansion terminates or eventually repeats periodically. - **Irrational number**: A real number that cannot be written as a fraction of two integers; its decimal expansion is infinite and never periodic. - **Integer**: A number in the set ℤ: a whole number or its negative, …, −2, −1, 0, 1, 2, …. - **Natural number**: A counting number 1, 2, 3, …; some books also include 0. - **Whole number**: A natural number or zero: 0, 1, 2, 3, …. - **Terminating decimal**: A decimal with finitely many digits after the point, such as 0.125. - **Repeating decimal**: A decimal expansion that eventually repeats periodically: from some digit onward a block of digits repeats without end, such as 0.272727…. - **Transcendental number**: A real number that is not a root of any non-zero polynomial with integer coefficients, such as π and e. - **Floating-point number**: The approximation of a real number that a computer stores, usually a 64-bit binary value with about 15 to 17 significant decimal digits. - **Interval**: An unbroken stretch of the real number line, written with brackets, such as [a, b). - **Dense set**: A set is dense in the real numbers when every stretch of the number line, however short, contains at least one of its members; the rational and the irrational numbers are both dense. - **Completeness**: The property that every non-empty set of real numbers with an upper bound has a least upper bound, which means the real number line has no gaps. - **Absolute value**: The distance from a number to 0 on the number line, written |x|. ## Frequently asked questions ### What is a real number? A real number is any number that corresponds to a point on the number line. It can be written as a decimal, finite or infinite. Real numbers include integers, fractions, terminating and repeating decimals, and irrational numbers such as √2 and π. ### What is the difference between rational and irrational numbers? A rational number can be written as a fraction of two integers, and its decimal expansion terminates or eventually repeats periodically. An irrational number cannot be written that way, and its decimal expansion is infinite and never periodic. Every real number is exactly one of the two. ### Is zero a real number? Is it rational? Yes to both. Zero is a real number, an integer and a whole number, and it is rational because 0 = 0/1. Whether zero counts as a natural number depends on the convention: Indonesian school books say no, many international books say yes. ### Is √2 a rational number? No. √2 is irrational. If it were a fraction a/b in lowest terms, squaring would give a² = 2b², which forces both a and b to be even, contradicting lowest terms. The ancient Greeks knew this proof. ### Is π rational? No. π is irrational, which Johann Lambert proved in 1761, and it is even transcendental, which Ferdinand von Lindemann proved in 1882. The values 3.14 and 22/7 are only rational approximations of π. ### Is 0.999… equal to 1? Yes, exactly. If x = 0.999…, then 10x = 9.999…, and subtracting gives 9x = 9, so x = 1. The two decimals are different spellings of the same real number. ### Is infinity a real number? No. Infinity is not a real number; it is a symbol meaning "without bound". That is why interval notation always puts a round bracket next to ∞ and −∞. ### How many real numbers are there? Infinitely many, and in a stronger sense than the integers. The integers and the rational numbers can be listed in a sequence, but Georg Cantor proved in 1874 that the real numbers cannot. There are uncountably many of them, and almost all of them are irrational. ### Why does 0.1 + 0.2 not equal 0.3 on a computer? Computers store numbers in binary floating point, and 0.1 has an infinite periodic expansion in binary, so it is stored as the nearest representable value. The stored 0.1 plus the stored 0.2 comes out as 0.30000000000000004, which differs from the stored 0.3. Compare floats with a tolerance instead of using equality. ### What are examples of real numbers? Examples of real numbers include the integer −3, the fraction 2/3, the terminating decimal 0.75, the repeating decimal 0.333…, and the irrational numbers √2, π and e. Every point on the number line is a real number. ### What are the properties of real numbers? Real numbers are closed under addition, subtraction, multiplication and division by a non-zero number, and they are commutative, associative and distributive. They have the identities 0 and 1, additive and multiplicative inverses, and an order in which any two numbers can be compared. ### Are all integers real numbers? Yes. Every integer n is a rational number because n = n/1, and every rational number is a real number. The sets nest: natural numbers, whole numbers, integers, rational numbers and real numbers, each contained in the next. ### What is not a real number? Infinity is not a real number, and neither is the square root of −1, which is an imaginary number belonging to the complex numbers. Division by zero is undefined, so 1/0 is not a real number either. ### What is the symbol for real numbers? The set of real numbers is written ℝ, a blackboard-bold capital R, or \mathbb{R} in LaTeX. Related symbols are ℚ for rational numbers, ℤ for integers and ℕ for natural numbers. --- # Bilangan Real: Pengertian, Jenis, Contoh, dan Sifat-sifatnya Source: https://nunada.my.id/artikel/bilangan-real/ Updated: 2026-10-10 ## Jawaban singkat **Bilangan real** adalah semua bilangan yang terletak pada garis bilangan. Bilangan real mencakup bilangan yang digunakan sehari-hari, seperti bilangan bulat, pecahan, dan desimal yang berakhir atau akhirnya berulang secara periodik, yang semuanya disebut bilangan rasional — serta bilangan seperti $\sqrt{2}$ dan $\pi$ yang tidak dapat dinyatakan sebagai pecahan dua bilangan bulat, yang disebut bilangan irasional. Himpunan bilangan real ditulis $\mathbb{R}$. Sebuah bilangan real itu rasional jika ekspansi desimalnya berakhir atau akhirnya berulang secara periodik, dan irasional jika ekspansi desimalnya tak berhingga dan tidak pernah periodik. ### Poin penting - Setiap titik pada garis bilangan adalah bilangan real, dan setiap bilangan real adalah sebuah titik: $\mathbb{R}$ adalah garis bilangan itu sendiri. - Himpunan bilangan bersarang: $\mathbb{N}\subset W\subset\mathbb{Z}\subset\mathbb{Q}\subset\mathbb{R}$, dan bilangan irasional adalah bilangan real di luar $\mathbb{Q}$. - Pecahan paling sederhana punya ekspansi desimal yang berakhir tepat ketika penyebutnya tidak punya faktor prima selain 2 dan 5. Jika tidak, ekspansinya akhirnya berulang secara periodik. - $\sqrt{2}$ itu irasional, dan buktinya singkat. Begitu juga $\pi$ dan $e$, dan untuk bilangan bulat positif $n$, $\sqrt{n}$ irasional tepat ketika $n$ bukan kuadrat sempurna. - Di antara dua bilangan real mana pun ada tak berhingga banyak bilangan rasional dan tak berhingga banyak bilangan irasional, tetapi bilangan rasional saja meninggalkan celah yang diisi oleh bilangan real. - Komputer hanya menyimpan hampiran biner yang berhingga dari sebuah bilangan real, itulah sebabnya `0.1 + 0.2 == 0.3` bernilai False di Python dan JavaScript. Bandingkan dengan toleransi. ## Apa itu bilangan real? **Bilangan real** adalah bilangan apa pun yang dapat diletakkan pada garis bilangan. Dengan kata lain, setiap bilangan real punya ekspansi desimal: yang berakhir, yang akhirnya berulang secara periodik, atau yang tak berhingga dan tidak pernah periodik: $3$, $-0{,}5$, $\frac{1}{3}=0{,}333\ldots$ dan $\sqrt{2}=1{,}41421\ldots$ semuanya bilangan real. Himpunan semua bilangan real ditulis $\mathbb{R}$. Setiap kali kamu mengukur sesuatu — panjang meja, suhu siang hari, waktu yang dipakai dalam lomba lari — hasil pengukuran tersebut dapat dinyatakan dengan bilangan real. Cara lain mengatakannya bersifat geometris. Gambarlah garis lurus, tandai satu titik untuk 0 dan satu titik lain untuk 1, maka setiap titik pada garis itu mewakili tepat satu bilangan real. Garis tersebut disebut **garis bilangan**. Secara intuitif garis ini tidak memiliki celah; sifat ini disebut **kelengkapan (completeness)**, dan bagian tentang garis bilangan di bawah menjelaskan artinya secara tepat. Bilangan real digunakan dalam pengukuran, kalkulus, fisika, dan berbagai komputasi numerik. Mengetahui bagaimana bilangan real tersusun — mana yang pecahan, mana yang bukan, dan bagaimana komputer menyimpannya — membantu memahami berbagai persoalan perhitungan, termasuk kesalahan pembulatan dalam komputasi. **Catatan notasi.** Di artikel ini bilangan asli $\mathbb{N}$ adalah $1,2,3,\ldots$ dan bilangan cacah $W$ adalah $0,1,2,3,\ldots$. Sebagian buku menganggap 0 sebagai bilangan asli, jadi periksa konvensinya bila membaca di tempat lain. Kata bilangan bulat selalu berarti bilangan dalam $\mathbb{Z}$, dan ekspansi desimal berarti seluruh deretan angka sebuah bilangan, sepanjang apa pun. **Bilangan real sekilas** | Fakta | Keterangan | |---|---| | Simbol | $\mathbb{R}$ | | Isinya | semua bilangan rasional dan semua bilangan irasional | | Ekspansi desimal | berakhir, akhirnya berulang secara periodik, atau tak berhingga dan tidak pernah periodik | | Operasi | tertutup terhadap penjumlahan, pengurangan, perkalian, dan pembagian (tidak pernah dengan 0) | | Ukuran | tak terhitung banyaknya (Cantor, 1874) | | Dibangun secara ketat oleh | Dedekind dan Cantor, keduanya pada 1872 | | Bukan bilangan real | $\infty$, dan $\sqrt{-1}$ (bilangan kompleks) | *Bilangan rasional dan irasional berbagi satu garis bilangan: −3/2 adalah pecahan, sedangkan √2 dan π bukan.* > **Definisi bagi yang penasaran** > > Dalam matematika perguruan tinggi, $\mathbb{R}$ adalah **medan terurut lengkap**. Medan berarti kamu dapat menjumlah, mengurang, mengalikan, dan membagi (kecuali dengan 0) dengan aturan biasa. Terurut berarti dua bilangan mana pun dapat dibandingkan. Lengkap berarti garisnya tidak punya celah: setiap himpunan tak kosong yang terbatas ke atas memiliki batas atas terkecil. Dedekind (1872) dan Cantor (1872) masing-masing menunjukkan cara membangun sistem bilangan seperti itu dari bilangan rasional, dan Rudin (1976, bab 1) memberikan pembahasan modern yang baku. ## Apa saja jenis bilangan real? **Jenis-jenis bilangan real adalah bilangan asli, cacah, bulat, rasional, dan irasional.** Himpunan-himpunan tersebut tersusun secara bertingkat: setiap himpunan memuat himpunan sebelumnya dan menambahkan bilangan yang tidak dapat dinyatakan oleh himpunan sebelumnya. | Himpunan | Simbol | Isinya | Contoh | |---|---|---|---| | Bilangan asli | ℕ | bilangan yang digunakan untuk menghitung: $1, 2, 3$, dan seterusnya | 1, 7, 250 | | Bilangan cacah | W | bilangan asli beserta 0: $0, 1, 2, 3, \ldots$ | 0, 3, 12 | | Bilangan bulat | ℤ | bilangan cacah beserta negatifnya | −5, 0, 8 | | Bilangan rasional | ℚ | setiap bilangan $\frac{p}{q}$ dengan $p$ dan $q\neq 0$ bilangan bulat | $\frac{2}{3}$, −0,75, 4 | | Bilangan irasional | ℝ∖ℚ | bilangan real yang bukan rasional | $\sqrt{2}$, $\pi$, $e$ | | Bilangan real | ℝ | gabungan semuanya | semua titik pada garis bilangan | Setiap [bilangan bulat](https://nunada.my.id/artikel/bilangan-bulat/) itu rasional, karena $5=\frac{5}{1}$, dan [artikel bilangan rasional](https://nunada.my.id/artikel/bilangan-rasional/) menunjukkan cara membandingkan, menjumlahkan, dan menyederhanakan pecahan. Setiap bilangan rasional itu real. Dan dua kelompok utama, rasional dan irasional, tidak beririsan: sebuah bilangan real tepat salah satunya. > **Apakah ℕ memuat 0?** > > Tergantung bukunya. Matematika sekolah di Indonesia memakai bilangan asli untuk $1, 2, 3, \ldots$ dan bilangan cacah untuk $0, 1, 2, \ldots$, sesuai cara artikel ini memakai ℕ dan W. Banyak buku internasional menulis ℕ untuk himpunan yang dimulai dari 0. Selalu periksa konvensi mana yang dipakai sebuah sumber. Tidak semua bilangan itu real. Persamaan $x^2=-1$ tidak punya solusi real, karena bilangan real yang dikuadratkan tidak pernah negatif. Para matematikawan menambahkan bilangan baru $i$ dengan $i^2=-1$ dan memperoleh **bilangan kompleks** $\mathbb{C}$, yang memuat $\mathbb{R}$ — tetapi itu artikel lain. Satu jebakan sebelum mencoba aktivitas berikut. Tanda akar tidak otomatis membuat bilangan irasional: $\sqrt{16}=4$ adalah bilangan asli. Dan bentuk desimal juga tidak otomatis membuatnya irasional: $1{,}4142$ berakhir, jadi ia adalah pecahan $\frac{14142}{10000}$. ## Apa itu bilangan rasional? Pecahan dan desimal **Bilangan rasional** adalah bilangan yang dapat ditulis sebagai pecahan $\frac{p}{q}$ dari dua bilangan bulat, dengan $q\neq 0$. Kata ini berasal dari rasio. Setiap bilangan rasional juga dapat ditulis sebagai desimal, dan ekspansi desimalnya memiliki salah satu dari dua sifat berikut: - Ekspansinya **berakhir**: $\frac{1}{8}=0{,}125$ dan $\frac{3}{40}=0{,}075$. - Ekspansinya **akhirnya berulang secara periodik**, dengan satu kelompok angka berulang tanpa akhir: $\frac{1}{3}=0{,}333\ldots=0{,}\overline{3}$ dan $\frac{3}{11}=0{,}272727\ldots=0{,}\overline{27}$. Garis di atas angka menandai kelompok angka yang berulang. Mana dari keduanya yang terjadi ditentukan oleh penyebutnya, setelah pecahannya disederhanakan. > **Aturan faktor prima** > > Tulis pecahan dalam bentuk paling sederhana lalu faktorkan penyebutnya menjadi bilangan prima. Jika **satu-satunya** prima adalah 2 dan 5, ekspansi desimalnya berakhir. Jika ada prima lain, ekspansinya akhirnya berulang secara periodik. > > Contohnya $\frac{7}{20}$: $20=2^2\times 5$, jadi berakhir ($0{,}35$). Untuk $\frac{5}{12}$: $12=2^2\times 3$, dan faktor 3 memaksa desimalnya berulang ($0{,}41\overline{6}$). Alasannya: membagi dengan $2^a5^b$ sama dengan mengalikan hingga mencapai pangkat 10, dan pangkat 10 hanya mengandung faktor 2 dan 5. **Mengapa desimal harus berulang?** Lakukan pembagian bersusun $\frac{p}{q}$. Setelah tiap angka tersisa sebuah sisa, dan sisa itu selalu salah satu dari $0, 1, \ldots, q-1$. Jika suatu saat sisanya 0, desimalnya berakhir. Jika tidak, hanya ada $q-1$ kemungkinan sisa tak nol, sehingga dalam $q$ langkah salah satunya pasti muncul lagi — dan sejak saat itu angkanya berulang, karena sisa yang sama menghasilkan angka berikutnya yang sama. Itulah sebabnya kelompok angka pada $\frac{1}{7}=0{,}\overline{142857}$ panjangnya tepat 6 angka, satu kurang dari 7. **Cara mengubah desimal berulang menjadi pecahan.** Ikuti langkah berikut, ditunjukkan untuk $x=0{,}\overline{27}$: 1. Beri nama bilangannya: misalkan $x=0{,}\overline{27}$. 2. Kalikan dengan $10^n$, dengan $n$ panjang kelompok angka yang berulang (di sini 2, jadi kalikan 100): $100x=27{,}\overline{27}$. 3. Kurangkan bilangan semula agar ekor tak berhingga saling meniadakan: $100x-x=27$, yaitu $99x=27$. 4. Selesaikan dan sederhanakan: $x=\frac{27}{99}=\frac{3}{11}$. Jika ada angka yang tidak berulang, seperti pada $0{,}41\overline{6}$, gunakan dua kali pergeseran: $100x=41{,}\overline{6}$ dan $1000x=416{,}\overline{6}$. Pengurangan memberi $900x=375$, sehingga $x=\frac{375}{900}=\frac{5}{12}$. > **0,999… sama dengan 1** > > Misalkan $x=0{,}\overline{9}$. Maka $10x=9{,}\overline{9}$, dan $10x-x=9$ memberi $9x=9$, sehingga $x=1$. Dua desimal $0{,}999\ldots$ dan $1$ adalah dua nama untuk bilangan yang sama. Setiap desimal yang berakhir punya kembaran seperti itu: $0{,}5=0{,}4999\ldots$. ## Apa itu bilangan irasional? (dengan bukti untuk √2) **Bilangan irasional** adalah bilangan real yang **bukan** rasional: tidak ada pecahan dua bilangan bulat yang sama dengannya. Ekspansi desimalnya tak berhingga dan tidak pernah periodik. Contoh bilangan irasional yang terkenal antara lain: - $\sqrt{2}=1{,}41421356\ldots$, diagonal persegi dengan sisi 1. - $\pi=3{,}14159265\ldots$, perbandingan keliling lingkaran terhadap diameternya. - $e=2{,}71828182\ldots$, bilangan dasar logaritma natural, yang muncul pada pertumbuhan dan peluruhan. - $\varphi=\dfrac{1+\sqrt{5}}{2}=1{,}61803398\ldots$, rasio emas. Ada uji sederhana untuk akar kuadrat: untuk bilangan bulat positif $n$, $\sqrt{n}$ irasional tepat ketika $n$ bukan kuadrat sempurna (dan jika $n$ kuadrat sempurna, $\sqrt{n}$ adalah bilangan bulat). Faktorkan $n$ menjadi [bilangan prima](https://nunada.my.id/artikel/bilangan-bulat/#primes); jika setiap prima muncul sebanyak bilangan genap, $n$ adalah kuadrat sempurna dan akarnya bilangan bulat. Jadi $\sqrt{50}=5\sqrt{2}$ irasional, sedangkan $\sqrt{49}=7$ tidak; [menyederhanakan bentuk akar](https://nunada.my.id/artikel/eksponen-dan-akar/#simplify-radicals) menunjukkan bagaimana $\sqrt{50}$ menjadi $5\sqrt2$, dan artikel [bilangan irasional](https://nunada.my.id/artikel/bilangan-irasional/) membahas lebih jauh, tentang $\pi$, $e$, dan hampiran rasional. *Diagonal persegi satuan adalah √2, menurut teorema Pythagoras: 1² + 1² = 2.* **Bukti bahwa √2 irasional** Orang Yunani kuno sudah mengetahui hal ini, dan argumennya masih menjadi contoh klasik pembuktian dengan kontradiksi. Misalkan $\sqrt{2}=\frac{a}{b}$ dengan $a$ dan $b$ bilangan bulat positif yang **saling prima**, yaitu tidak punya faktor persekutuan lebih dari 1 (pecahan paling sederhana). Kita akan menunjukkan bahwa hal itu mustahil. 1. Kuadratkan kedua ruas: $2=\frac{a^2}{b^2}$, sehingga $a^2=2b^2$. 2. Jadi $a^2$ genap. Bilangan ganjil yang dikuadratkan tetap ganjil, sehingga $a$ sendiri harus genap: $a=2k$ untuk suatu bilangan bulat $k$. 3. Substitusikan: $(2k)^2=2b^2$, sehingga $4k^2=2b^2$ dan $b^2=2k^2$. 4. Jadi $b^2$ genap, dan dengan alasan yang sama $b$ genap. 5. Sekarang $a$ dan $b$ keduanya genap, sehingga keduanya punya faktor 2. Itu bertentangan dengan pengandaian bahwa keduanya saling prima. Pengandaian tadi menimbulkan kontradiksi, jadi pecahan seperti itu tidak ada: $\sqrt{2}$ irasional. ∎ Gagasan bukti yang sama tidak berlaku untuk $\pi$ dan $e$, yang jauh lebih sulit. Euler menunjukkan pada 1737 bahwa $e$ irasional, dan Lambert menunjukkan pada 1761 bahwa $\pi$ irasional (makalahnya terbit pada 1768). Kemudian Hermite (1873) dan Lindemann (1882) membuktikan sesuatu yang lebih kuat: $e$ dan $\pi$ bahkan bukan akar polinomial mana pun dengan koefisien bulat, yang disebut **transendental**. Inilah yang akhirnya mengakhiri masalah kuno menguadratkan lingkaran. Sekarang coba sendiri angka-angka desimalnya. Widget di bawah ini menemukan $\sqrt{2}$ satu angka demi satu angka: pada tiap langkah, pilih angka terbesar yang kuadratnya masih tidak lebih dari 2. Kamu bisa melakukannya tanpa akhir, dan angka-angkanya tidak pernah jatuh ke sebuah pola. > **π bukan 3,14 dan bukan 22/7** > > Keduanya adalah hampiran rasional. $3{,}14=\frac{314}{100}$ dan $\frac{22}{7}=3{,}\overline{142857}$ adalah pecahan, sedangkan $\pi$ bukan. Keduanya dekat — $\frac{22}{7}$ meleset sekitar $0{,}0013$ — tetapi tidak pernah sama. Pakai tombol $\pi$ di kalkulator, atau lambang eksak $\pi$, ketika jawabannya harus eksak. **Hampir setiap bilangan real itu irasional.** Bilangan rasional dapat didaftar satu per satu dalam sebuah barisan (ia terhitung), tetapi Cantor membuktikan pada 1874 bahwa bilangan real tidak dapat (ia tak terhitung). Jika kamu memilih bilangan real antara 0 dan 1 sepenuhnya secara acak, peluang bahwa ia rasional adalah 0. Bilangan irasional bukanlah yang eksotis; bilangan rasionallah benang tipis yang kebetulan paling sering kita tuliskan. ## Bagaimana bilangan real tersusun pada garis bilangan? **Pada garis bilangan, bilangan rasional itu rapat (dense) tetapi tidak lengkap (complete), sedangkan bilangan real rapat sekaligus lengkap.** Dua sifat bilangan real terdengar mirip tetapi berbeda. **Kerapatan (dense).** Sebuah himpunan disebut rapat dalam bilangan real jika setiap bagian garis, sependek apa pun, memuat sedikitnya satu anggotanya. Bilangan rasional rapat, begitu juga bilangan irasional: di antara dua bilangan real yang berbeda selalu ada bilangan lain — bahkan tak berhingga banyak bilangan rasional dan tak berhingga banyak bilangan irasional. Jika $ab$ yang benar. Urutan bersifat transitif ($a-3$. **Interval.** Suatu bagian dari garis bilangan dapat dinyatakan dalam bentuk interval. Kurung siku berarti ujungnya termasuk, kurung biasa berarti tidak termasuk, dan $\infty$ selalu memakai kurung biasa karena ia bukan bilangan real. | Interval | Arti | Pertidaksamaan | |---|---|---| | $(a,b)$ | terbuka: kedua ujung tidak termasuk | $aa$ | | $(-\infty,b]$ | semua sampai dan termasuk $b$ | $x\le b$ | | $(-\infty,\infty)$ | seluruh garis, $\mathbb{R}$ | sembarang $x$ | **Nilai mutlak.** $|x|$ adalah jarak $x$ ke 0, sehingga tidak pernah negatif: $|x|=x$ jika $x\ge0$ dan $|x|=-x$ jika $x<0$. Lebih umum, $|a-b|$ adalah jarak antara $a$ dan $b$. Pertidaksamaan $|x|<3$ berarti jarak $x$ dari nol kurang dari 3, yaitu interval $(-3,3)$. ## Mengapa 0,1 + 0,2 tidak selalu sama dengan 0,3 dalam komputer? **Dalam kode, 0,1 + 0,2 tidak sama dengan 0,3 karena komputer merepresentasikan bilangan menggunakan format bilangan titik-mengambang (floating-point number, disingkat float) biner 64-bit, dan 0,1 tidak dapat disimpan secara eksak.** Komputer memiliki kapasitas penyimpanan terbatas, sedangkan sebuah bilangan real bisa membutuhkan tak berhingga banyak angka. Maka program menyimpan **hampiran**. Hampir semua bahasa memakai format IEEE 754 binary64 (IEEE 754-2019; lihat Goldberg, 1991), yang disebut `double` atau `float` di Python: 1 bit tanda, 11 bit eksponen, dan 52 bit bagian pecahan (fraction), sehingga memberi presisi 53 bit — sekitar 15 sampai 17 angka signifikan desimal. Masalahnya, formatnya biner (lihat [bilangan biner](https://nunada.my.id/artikel/bilangan-biner/#binary-fractions) untuk cara menulis pecahan dalam basis 2). Desimal $0{,}1$ adalah $\frac{1}{10}$, dan $10$ punya faktor prima 5, sehingga dalam basis 2 ekspansi $0{,}1$ periodik tanpa akhir, sama seperti ekspansi $\frac{1}{3}$ dalam basis 10. Komputer tidak dapat menyimpan ekspansi yang tak berhingga itu, sehingga ia menyimpan nilai terdekat yang dapat diwakili oleh format tersebut, dan nilai yang benar-benar tersimpan adalah $$0{,}1000000000000000055511151231257827\ldots$$ Ketika kedua nilai hampiran tersebut dijumlahkan, galat pembulatan dapat terlihat pada hasilnya: ```python >>> 0.1 + 0.2 0.30000000000000004 >>> 0.1 + 0.2 == 0.3 False >>> import math >>> math.sqrt(2) ** 2 2.0000000000000004 >>> math.isclose(0.1 + 0.2, 0.3) True ``` ```javascript 0.1 + 0.2 // 0.30000000000000004 0.1 + 0.2 === 0.3 // false Math.abs(0.1 + 0.2 - 0.3) < Number.EPSILON // true 2 ** 53 + 1 === 2 ** 53 // true: integers lose exactness beyond 2^53 ``` ```cpp #include #include #include using namespace std; int main() { printf("%.17f\n", 0.1 + 0.2); // 0.30000000000000004 cout << (0.1 + 0.2 == 0.3) << endl; // 0 printf("%.16f\n", sqrt(2) * sqrt(2)); // 2.0000000000000004 cout << (fabs(0.1 + 0.2 - 0.3) < 1e-9) << endl; // 1: compare with a tolerance return 0; } /* output: 0.30000000000000004 0 2.0000000000000004 1 */ ``` Perilaku ini bukan kesalahan khusus Python atau JavaScript, melainkan konsekuensi representasi bilangan titik-mengambang. Perilaku ini terjadi di mana pun, pada setiap bahasa yang memakainya. Hal penting yang perlu dipahami adalah bahwa setiap bilangan yang dapat disimpan komputer sebagai float adalah bilangan **rasional** (pecahan dengan penyebut pangkat 2). Komputer tidak pernah menyimpan $\sqrt{2}$ atau $\pi$ — hanya bilangan rasional di dekatnya. Cara menangani perhitungan numerik: | Situasi | Pendekatan yang lebih baik | |---|---| | Apakah dua hasil sama? | bandingkan dengan toleransi: `math.isclose(a, b)` di Python, atau `abs(a - b) < eps` | | Uang | simpan sen utuh sebagai bilangan bulat, atau pakai `decimal.Decimal` | | Pecahan eksak | `fractions.Fraction` di Python menjaga `1/10 + 2/10` tepat `3/10` | | Bilangan bulat sangat besar | `int` Python eksak pada ukuran berapa pun; pakai `BigInt` di JavaScript | | Menjumlahkan banyak bilangan | `math.fsum` mengurangi akumulasi galat pembulatan | Coba gunakan aktivitas berikut. Widget ini menghitung kedua ekspresi dengan floating point 64-bit, menampilkan nilai persis yang tersimpan, dan memeriksanya dengan tiga cara yang mungkin dipakai program. ## Apa kesalahan umum tentang bilangan real? **Kesalahan paling umum tentang bilangan real adalah delapan hal berikut, masing-masing dengan faktanya.** | Mitos | Kenyataan | |---|---| | ❌ "π sama dengan 3,14 atau 22/7." | Keduanya hampiran rasional. π irasional. | | ❌ "Bilangan dengan tanda akar itu irasional." | $\sqrt{16}=4$ rasional. Untuk bilangan bulat positif $n$, $\sqrt{n}$ irasional tepat ketika $n$ bukan kuadrat sempurna. | | ❌ "0,999… sedikit di bawah 1." | Ia sama dengan 1 tepat. | | ❌ "Bilangan irasional itu langka." | Hampir setiap bilangan real adalah irasional. | | ❌ "Desimal yang panjang dan acak pasti irasional." | $\frac{1}{97}$ baru berulang setelah 96 angka dan ia rasional. Yang menentukan adalah apakah ia pernah berulang. | | ❌ "0,1 + 0,2 ≠ 0,3 berarti komputernya rusak." | Begitulah cara kerja floating point biner. Bandingkan dengan toleransi. | | ❌ "∞ adalah bilangan real." | Bukan. Ia adalah lambang untuk "tanpa batas". | | ❌ "Setiap bilangan itu real." | $\sqrt{-1}$ bukan. Ia bilangan kompleks. | ## Latihan: uji pemahamanmu Soal-soal ini mencampur semua yang dibahas di atas. Jika jawabanmu belum tepat, perhatikan petunjuk yang tersedia, lalu coba kembali. ## Ringkasan: bilangan real sekilas - **Bilangan real** $\mathbb{R}$ adalah semua titik pada garis bilangan: rasional ditambah irasional. - **Rasional** berarti pecahan bilangan bulat; ekspansi desimalnya berakhir atau akhirnya berulang secara periodik. **Irasional** berarti bukan: $\sqrt{2}$, $\pi$, $e$. - Rantai himpunannya adalah $\mathbb{N}\subset W\subset\mathbb{Z}\subset\mathbb{Q}\subset\mathbb{R}$. - Pecahan sederhana berakhir tepat ketika penyebutnya hanya punya prima 2 dan 5. - Untuk bilangan bulat positif $n$, $\sqrt{n}$ irasional tepat ketika $n$ bukan kuadrat sempurna; $\sqrt{2}$ irasional lewat kontradiksi. - Rasional + irasional adalah irasional; irasional + irasional bisa keduanya. - Bilangan rasional rapat tetapi berlubang; bilangan real rapat dan lengkap. - Komputer menyimpan hampiran biner yang berhingga, jadi bandingkan float dengan toleransi dan pakai bilangan bulat, `Fraction`, atau `Decimal` untuk hitungan eksak. ## Glosarium: istilah penting - **Bilangan real**: Bilangan yang sesuai dengan sebuah titik pada garis bilangan; setiap bilangan real adalah rasional atau irasional. - **Bilangan rasional**: Bilangan yang dapat ditulis sebagai pecahan dua bilangan bulat dengan penyebut tak nol; ekspansi desimalnya berakhir atau akhirnya berulang secara periodik. - **Bilangan irasional**: Bilangan real yang tidak dapat ditulis sebagai pecahan dua bilangan bulat; ekspansi desimalnya tak berhingga dan tidak pernah periodik. - **Bilangan bulat**: Bilangan dalam himpunan ℤ, yaitu bilangan cacah atau negatifnya: …, −2, −1, 0, 1, 2, …. - **Bilangan asli**: Bilangan hitung 1, 2, 3, …; sebagian buku juga memasukkan 0. - **Bilangan cacah**: Bilangan asli atau nol: 0, 1, 2, 3, …. - **Desimal berakhir**: Desimal dengan angka di belakang koma yang berhingga banyaknya, seperti 0,125. - **Desimal berulang**: Ekspansi desimal yang akhirnya berulang secara periodik: mulai dari suatu angka, sekelompok angka berulang tanpa akhir, seperti 0,272727…. - **Bilangan transendental**: Bilangan real yang bukan akar polinomial tak nol mana pun dengan koefisien bulat, seperti π dan e. - **Bilangan floating point**: Hampiran bilangan real yang disimpan komputer, biasanya nilai biner 64-bit dengan sekitar 15 sampai 17 angka signifikan desimal. - **Interval**: Bagian garis bilangan real yang tak terputus, ditulis dengan tanda kurung, seperti [a, b). - **Himpunan rapat (dense)**: Himpunan disebut rapat dalam bilangan real jika setiap bagian garis bilangan, sependek apa pun, memuat sedikitnya satu anggotanya; bilangan rasional dan bilangan irasional sama-sama rapat. - **Kelengkapan (completeness)**: Sifat bahwa setiap himpunan bilangan real yang tak kosong dan terbatas ke atas memiliki batas atas terkecil, yang berarti garis bilangan real tidak memiliki celah. - **Nilai mutlak**: Jarak sebuah bilangan ke 0 pada garis bilangan, ditulis |x|. ## Pertanyaan yang sering diajukan ### Apa itu bilangan real? Bilangan real adalah bilangan apa pun yang sesuai dengan sebuah titik pada garis bilangan. Ia punya ekspansi desimal, berhingga maupun tak berhingga. Bilangan real mencakup bilangan bulat, pecahan, desimal berakhir dan berulang, serta bilangan irasional seperti √2 dan π. ### Apa beda bilangan rasional dan irasional? Bilangan rasional dapat ditulis sebagai pecahan dua bilangan bulat, dan ekspansi desimalnya berakhir atau akhirnya berulang secara periodik. Bilangan irasional tidak dapat ditulis seperti itu, dan ekspansi desimalnya tak berhingga dan tidak pernah periodik. Setiap bilangan real tepat salah satu dari keduanya. ### Apakah nol bilangan real? Apakah ia rasional? Ya untuk keduanya. Nol adalah bilangan real, bilangan bulat, dan bilangan cacah, dan ia rasional karena 0 = 0/1. Apakah nol termasuk bilangan asli bergantung pada konvensi: buku sekolah Indonesia mengatakan tidak, banyak buku internasional mengatakan ya. ### Apakah √2 bilangan rasional? Bukan. √2 irasional. Jika ia pecahan a/b yang paling sederhana, mengkuadratkannya memberi a² = 2b², yang memaksa a dan b keduanya genap, bertentangan dengan bentuk paling sederhana. Orang Yunani kuno mengetahui bukti ini. ### Apakah π bilangan rasional? Bukan. π irasional, yang dibuktikan Johann Lambert pada 1761, dan ia bahkan transendental, yang dibuktikan Ferdinand von Lindemann pada 1882. Nilai 3,14 dan 22/7 hanyalah hampiran rasional dari π. ### Apakah 0,999… sama dengan 1? Ya, tepat sama. Jika x = 0,999…, maka 10x = 9,999…, dan pengurangan memberi 9x = 9, sehingga x = 1. Kedua desimal itu hanyalah dua cara menulis bilangan real yang sama. ### Apakah tak hingga bilangan real? Bukan. Tak hingga bukan bilangan real; ia adalah lambang yang berarti "tanpa batas". Itulah sebabnya notasi interval selalu memakai kurung biasa di samping ∞ dan −∞. ### Ada berapa banyak bilangan real? Tak berhingga banyak, dalam arti yang lebih kuat daripada bilangan bulat. Bilangan bulat dan bilangan rasional dapat didaftar dalam sebuah barisan, tetapi Georg Cantor membuktikan pada 1874 bahwa bilangan real tidak dapat. Bilangan real tak terhitung banyaknya, dan hampir semuanya irasional. ### Mengapa 0,1 + 0,2 tidak sama dengan 0,3 di komputer? Komputer menyimpan bilangan dalam floating point biner, dan 0,1 punya ekspansi biner yang periodik tanpa akhir, sehingga ia disimpan sebagai nilai terdekat yang dapat diwakili. Nilai 0,1 yang tersimpan ditambah nilai 0,2 yang tersimpan menghasilkan 0,30000000000000004, yang berbeda dari 0,3 yang tersimpan. Untuk membandingkan hasil bilangan titik-mengambang, gunakan toleransi galat, bukan hanya operator kesamaan. ### Apa saja contoh bilangan real? Contoh bilangan real antara lain bilangan bulat −3, pecahan 2/3, desimal berakhir 0,75, desimal berulang 0,333…, dan bilangan irasional √2, π, dan e. Setiap titik pada garis bilangan adalah bilangan real. ### Apa saja sifat-sifat bilangan real? Bilangan real tertutup terhadap penjumlahan, pengurangan, perkalian, dan pembagian dengan bilangan tak nol, serta bersifat komutatif, asosiatif, dan distributif. Bilangan real punya identitas 0 dan 1, invers penjumlahan dan perkalian, serta urutan sehingga dua bilangan mana pun dapat dibandingkan. ### Apakah semua bilangan bulat adalah bilangan real? Ya. Setiap bilangan bulat n adalah bilangan rasional karena n = n/1, dan setiap bilangan rasional adalah bilangan real. Himpunannya bersarang: bilangan asli, cacah, bulat, rasional, dan real, masing-masing termuat dalam himpunan berikutnya. ### Apa yang bukan bilangan real? Tak hingga bukan bilangan real, begitu juga akar kuadrat dari −1, yang merupakan bilangan imajiner milik bilangan kompleks. Pembagian dengan nol tidak terdefinisi, sehingga 1/0 juga bukan bilangan real. ### Apa simbol untuk bilangan real? Himpunan bilangan real ditulis ℝ, huruf R kapital tebal ganda, atau \mathbb{R} dalam LaTeX. Simbol terkait adalah ℚ untuk bilangan rasional, ℤ untuk bilangan bulat, dan ℕ untuk bilangan asli.