Skip to content

미분 (Derivative)

미분은 현대 과학과 공학의 핵심 도구이다. 특히 컴퓨터 과학에서는 다음과 같이 활용한다:

  • 최적화: 경사하강법(Gradient Descent)의 기초
  • 머신러닝: 역전파(Backpropagation) 알고리즘의 핵심
  • 컴퓨터 그래픽스: 곡선과 표면의 부드러운 렌더링
  • 수치해석: 미분방정식의 수치적 해법

Proof of Polynomial Differentiation

함수 가 점 에서 미분가능하다는 조건은 다음 극한이 존재함이다:

이 값을 에서의 도함수(derivative) 또는 미분계수라 한다.

정리: (상수)일 때,

증명:

단계 2: 멱함수의 미분 (Power Rule)

Section titled “단계 2: 멱함수의 미분 (Power Rule)”

정리: (단, )일 때,

증명:

이항정리를 적용하면:

여기서 는 이항계수이다.

전개하면:

따라서:

마지막 등식은 일 때 를 포함하는 모든 항이 0으로 수렴하기 때문이다.

단계 3: 선형성 (Linearity of Differentiation)

Section titled “단계 3: 선형성 (Linearity of Differentiation)”

정리:

증명:

3.2 상수배의 법칙 (Constant Multiple Rule)

Section titled “3.2 상수배의 법칙 (Constant Multiple Rule)”

정리: (단, 는 상수)

증명:

정리: 다항함수 에 대해:

증명: 위의 법칙들을 조합하면:

마지막 등식에서 항은 0이므로 합에서 제외한다.

머신러닝에서 손실함수 를 최소화할 때 미분을 활용한다:

def gradient_descent(f, df, x0, learning_rate=0.01, iterations=100):
"""
f: 목적함수
df: f의 도함수
x0: 초기값
"""
x = x0
history = [x]
for _ in range(iterations):
grad = df(x) # 미분 계산
x = x - learning_rate * grad # 파라미터 업데이트
history.append(x)
return x, history
# 예시: f(x) = x^2 - 4x + 4 최소화
def f(x): return x**2 - 4*x + 4
def df(x): return 2*x - 4 # 도함수
minimum, path = gradient_descent(f, df, x0=0)
print(f"최솟값 위치: {minimum}") # 2에 수렴

2. 자동 미분 (Automatic Differentiation)

Section titled “2. 자동 미분 (Automatic Differentiation)”

현대 딥러닝 프레임워크는 자동으로 도함수를 계산한다:

import torch
# PyTorch의 자동 미분
x = torch.tensor([2.0], requires_grad=True)
y = x**3 - 2*x**2 + x - 1 # f(x) = x³ - 2x² + x - 1
y.backward() # 자동으로 dy/dx 계산
print(f"x=2에서의 도함수: {x.grad}") # f'(2) = 3(2)² - 4(2) + 1 = 5

비교

방법장점단점시간복잡도
수치 미분구현 간단, 모든 함수 가능오차 발생, 계산 비용 높음
해석적 미분정확, 빠름수식 필요, 복잡한 함수 어려움
자동 미분정확, 복잡한 함수 가능메모리 사용량 증가
class Polynomial:
"""다항식과 그 도함수를 다루는 클래스"""
def __init__(self, coefficients):
"""
coefficients: [a0, a1, a2, ...] for a0 + a1*x + a2*x^2 + ...
"""
self.coeffs = coefficients
def __call__(self, x):
"""다항식 값 계산"""
return sum(coeff * x**i for i, coeff in enumerate(self.coeffs))
def derivative(self):
"""도함수 반환"""
if len(self.coeffs) <= 1:
return Polynomial([0])
new_coeffs = [i * coeff for i, coeff in enumerate(self.coeffs)][1:]
return Polynomial(new_coeffs)
def __str__(self):
terms = []
for i, coeff in enumerate(self.coeffs):
if coeff != 0:
if i == 0:
terms.append(str(coeff))
elif i == 1:
terms.append(f"{coeff}x")
else:
terms.append(f"{coeff}x^{i}")
return " + ".join(terms) if terms else "0"
# 사용 예시
p = Polynomial([1, -2, 3]) # 1 - 2x + 3x^2
print(f"P(x) = {p}")
print(f"P'(x) = {p.derivative()}") # -2 + 6x
print(f"P(2) = {p(2)}") # 9
print(f"P'(2) = {p.derivative()(2)}") # 10

이 문서에서 다룬 멱의 법칙은 양의 정수 에 대해 증명하였다. 이 결과는 다음과 같이 확장할 수 있다:

  1. 음의 정수 지수: 에 대해 연쇄법칙 적용
  2. 유리수 지수: 에 대해 음함수 미분 적용
  3. 실수 지수: 지수함수와 로그함수를 통한 일반화

다항함수의 미분은 계수만 조정하므로 시간에 계산한다. 이는 수치 미분의 보다 효율적이다.


  1. Wikipedia | “Derivative"
    "The derivative … is the slope of the tangent line …"
    "Derivatives can be generalized to functions …

  2. Wikipedia | “Differential (mathematics)"
    "… refer to an infinitesimal (“infinitely small”) change …