Zaslat SMS: Functional analysis, calculus of variations and optimal