\DocumentMetadata{
  lang = en-US,
  pdfstandard = ua-2,
  pdfversion = 2.0,
  testphase = {latest}
}

\documentclass[12pt]{article}

\tagpdfsetup{math/alt/use=true}

% -------------------------
% Course / assignment metadata
% Edit these once per assignment
% -------------------------
\newcommand{\coursecode}{EE 520}
\newcommand{\coursetitle}{Random Processes}
\newcommand{\quartername}{Fall 2026}
\newcommand{\assignmenttype}{Homework}
\newcommand{\assignmentnumber}{7}
\newcommand{\assignmenttitle}{Processes: the same formula, infinite index}
\newcommand{\duedate}{December 4, 2026}
\newcommand{\studentname}{}
\newcommand{\instructorname}{John Lipor}

% Derived metadata strings
\newcommand{\fullcoursename}{\coursecode: \coursetitle}
\newcommand{\assignmentname}{\assignmenttype\ \assignmentnumber}
\newcommand{\fullassignmentname}{\assignmentname\ifx\assignmenttitle\empty\else: \assignmenttitle\fi}

% -------------------------
% Packages
% -------------------------
\usepackage[english]{babel}
\usepackage[margin=1in]{geometry}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{microtype}
\usepackage{xcolor}
\usepackage{xparse}
\usepackage{etoolbox}
\usepackage{amsmath,amssymb,amsthm,amsfonts}
\usepackage{bbm}
\usepackage{graphicx}
\usepackage{algorithm}
\usepackage{algorithmic}
% \usepackage{enumitem}
\usepackage{titlesec}

% Links and PDF metadata
\usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue,citecolor=blue]{hyperref}
\usepackage{bookmark}
\urlstyle{same}
\hypersetup{
  pdftitle={\coursecode\ \fullassignmentname},
  pdfauthor={\instructorname},
  pdfsubject={\fullcoursename\ assignment},
  pdfcreator={LaTeX},
  pdfproducer={LaTeX with hyperref},
  pdfdisplaydoctitle=true
}

% Improve math environment tagging
\usepackage{tagpdf}
\tagpdfsetup{activate-all,uncompress}

% Header command
\newcommand{\makehomeworkheader}{%
  \thispagestyle{plain}
  \begingroup
  \setlength{\fboxsep}{8pt}
  \noindent\fbox{%
    \begin{minipage}{\dimexpr\textwidth-2\fboxsep-2\fboxrule\relax}

      \noindent\textbf{\fullcoursename}\hfill \quartername\par

      \begin{center}
        {\LARGE \assignmentname\par}
        \ifx\assignmenttitle\empty\else
          {\large \assignmenttitle\par}
        \fi
        {\large Due: \duedate, 11:59 PM PT\par}
      \end{center}

      \noindent\textit{Student Name: \studentname}\hfill \textit{Instructor: \instructorname}\par
    \end{minipage}%
  }
  \endgroup
  \vspace{4mm}
}

% Section heading format used by \problem
\titleformat{\section}
  {\normalfont\normalsize\bfseries}
  {}
  {0pt}
  {}

% Problem headings
\newcounter{problem}
\NewDocumentCommand{\problem}{O{} O{}}{%
  \refstepcounter{problem}%
  \par\medskip
  \section*{\normalfont\normalsize\bfseries
    Problem \theproblem%
    \ifstrempty{#1}{}{\,: #1}%
    \ifstrempty{#2}{}{\normalfont\; [#2]}%
  }%
  \addcontentsline{toc}{section}{Problem \theproblem}%
}

% Use alpha labels for enumerate subproblems
\renewcommand{\labelenumi}{(\alph{enumi})}
\renewcommand{\theenumi}{\alph{enumi}}

% Solution command
\newcommand{\solution}{%
  \par\smallskip
  \noindent\textbf{Solution.}\enspace
}

% My math macros
% theorem type environments
\newtheorem{thm}{Theorem}
\newtheorem{prop}{Proposition}
\newtheorem{lemma}{Lemma}
\newtheorem{cor}{Corollary}
\newtheorem{defn}{Definition}
\newtheorem{assump}{Assumption}
\newtheorem{example}{Example}
\newtheorem{conjecture}{Conjecture}

% frequently used symbols
\newcommand{\bE}{\mathbb{E}}
\newcommand{\bP}{\mathbb{P}}
\newcommand{\bQ}{\mathbb{Q}}
\newcommand{\bR}{\mathbb{R}}
\newcommand{\bS}{\mathbb{S}}
\newcommand{\bN}{\mathbb{N}}
\newcommand{\bZ}{\mathbb{Z}}
\newcommand{\sC}{{\mathcal C}}
\newcommand{\sD}{{\mathcal D}}
\newcommand{\sE}{{\mathcal E}}
\newcommand{\sF}{{\mathcal F}}
\newcommand{\sL}{{\mathcal L}}
\newcommand{\sH}{{\mathcal H}}
\newcommand{\sN}{{\mathcal N}}
\newcommand{\sO}{{\mathcal O}}
\newcommand{\sP}{{\mathcal P}}
\newcommand{\sR}{{\mathcal R}}
\newcommand{\sS}{{\mathcal S}}
\newcommand{\sU}{{\mathcal U}}
\newcommand{\sX}{{\mathcal X}}
\newcommand{\sY}{{\mathcal Y}}
\newcommand{\sZ}{{\mathcal Z}}

% operators
\newcommand{\sign}{\mathop{\mathrm{sign}}}
\newcommand{\supp}{\mathop{\mathrm{supp}}}
\newcommand{\argmin}{\operatornamewithlimits{arg\,min}}
\newcommand{\argmax}{\operatornamewithlimits{arg\,max}}
\newcommand{\dist}{\operatorname{dist}}
\newcommand{\tr}{\operatorname{tr}}
\newcommand{\vecop}{\operatorname{vec}}
\newcommand{\st}{\operatorname{s.t.}}
\newcommand{\cut}{\setminus}
\newcommand{\ind}[1]{\mathbbm{1}\left\{#1\right\}}
\newcommand{\given}{\,|\,}

% grouping operators
\newcommand{\brac}[1]{\left[#1\right]}
\newcommand{\set}[1]{\left\{#1\right\}}
\newcommand{\abs}[1]{\left\lvert #1 \right\rvert}
\newcommand{\paren}[1]{\left(#1\right)}
\newcommand{\norm}[1]{\left\|#1\right\|}
\newcommand{\ip}[2]{\left\langle #1,#2 \right\rangle}

% code commands
\newcommand{\matlab}{\textsc{Matlab}}
\newcommand{\python}{\textsc{Python}}


\begin{document}

% body-level convenience (preamble untouched), as in the s17 lecture
\newcommand{\sinc}{\operatorname{sinc}}

\makehomeworkheader

\section*{Instructions}
Submit your work as a PDF through the course submission system. If you need an accommodation or an alternate format, contact the instructor.

\noindent \textbf{Note:} For all questions asked in this course, unless the question is simply asking about definitions, please justify all answers. Stating the correct answer without justification will earn no credit. For example, if you write down a string of equations, each successive equation should be accompanied by some justification such as ``by the additivity axiom'' or ``because the outcomes are equally likely'' or ``by the distributive property of set operations.'' You do not need to justify algebra.

% ============================================================
% Problem 1 -- NEW (off-spec, instructor request 2026-11-25). Improve the tutor.
% Ported from EE 518 HW3 P3 ("Sparkly Gems"); replaces the spec's Assumptions
% audit. Placed FIRST: the modification is made before Problems 2-7 are worked.
% ============================================================
\problem[Improve the tutor][5 pts]

You have now used the course tutor instructions from Homework~0 on six assignments. The goal of this problem is to start improving those instructions. \textbf{Before you work Problems~2--7,} make at least one modification to the tutor instructions that you think will improve the tutor's benefit to your work, then use your modified tutor for the rest of this assignment. Your modification must keep the tutor's homework boundaries in place (it may not write complete solutions for you), and the fifteen-minute rule from Homework~0 still applies.

\noindent\textbf{Turn in} what improvement you tried to make, what you changed in the instructions, and whether you believe it was an improvement after working through Problems~2--7 of this assignment.

% ============================================================
% Problem 2 -- NEW [D, R]. GP regression BY HAND = the HW6 conditioning
% formula on an infinite index set. Callback to HW6 Problem 3. Design
% (ell=1, obs {0,1.5}, queries {1,5}) is RESERVED disjoint from S15 UP TO RESCALING
% (redesigned 2026-11-23 from obs {0,2}, which was S15's old example scaled by 2).
% ============================================================
\problem[GP regression is Gaussian conditioning][5 pts each]

\emph{(Callback to Homework~6 Problem~3: Gaussian conditioning, now on an infinite index set.)}

\noindent Let $f$ be a zero-mean Gaussian process with squared-exponential kernel $k(t, s) = \exp\!\big(-(t - s)^2 / 2\ell^2\big)$, $\ell = 1$. You observe $f(0) = 1.2$ and $f(1.5) = -0.4$ exactly (no noise).
\begin{enumerate}
  \item Write the $3 \times 3$ covariance matrix of $(f(1), f(0), f(1.5))$ and compute the posterior mean and variance of $f(1)$ using the Homework~6 conditioning formula. (Numbers, not symbols.)
  \item Repeat for $f(5)$. Explain the two posterior variances in one sentence about the kernel's lengthscale.
  \item Now add measurement noise: the observations are $f(t_i) + \varepsilon_i$ with $\varepsilon_i \sim \sN(0, 0.1)$ iid. State exactly which matrix in your part-(a) computation changes, and how. (This is $Y = HX + N$ wearing a new hat: say why.)
\end{enumerate}

% ============================================================
% Problem 3 -- LIFT of old HW7 "Valid Correlations" (a)-(d) + NEW part (e)
% sinc + the read-character-off-the-spectrum sentence. CANONICAL adjudication
% of the five kernels (S16 asserted them in the bestiary without argument).
% ============================================================
\problem[Which kernels are legal?][4 pts each]

A stationary GP kernel must be a valid autocorrelation function. For each candidate $R(\tau)$ below, decide whether it is valid and justify your answer; Bochner's theorem (a valid $R$ is the inverse transform of a nonnegative, integrable spectrum $S(f) \geq 0$) is the intended tool where it applies. \emph{Session~16's bestiary asserted the legality of several of these without argument; here you supply the arguments.}
\begin{enumerate}
  \item $\sin(\tau)$
  \item $\cos(\tau)$
  \item $\exp(-\tau^2 / 2)$
  \item $\exp(-\abs{\tau})$
  \item $\sinc(\tau) = \sin(\pi \tau) / (\pi \tau)$
\end{enumerate}
For each \emph{valid} kernel, add one sentence: what kind of functions does a GP with this kernel produce (smoothness? periodicity? roughness?), reading the answer off the spectrum.

% ============================================================
% Problem 4 -- REFRAME of old HW7 "Integrated Process" / old HW8 "Wiener
% Process": the OU kernel factory. CANONICAL and SOLE HOME (S17 ran the same
% factory on an ideal low-pass filter and reserved the OU case here).
% ============================================================
\problem[The kernel factory][10 pts]

White noise $X_t$ with power spectral density $S_X(f) = N_0 / 2$ drives a first-order (RC-type) filter with impulse response $h(t) = e^{-\lambda t}\, u(t)$, where $u(t)$ is the unit step and $\lambda > 0$. Let $Y_t$ be the output. \emph{Session~17 ran this factory on an ideal low-pass filter to manufacture the sinc kernel; the RC case is yours.}
\begin{enumerate}
  \item Compute $S_Y(f)$ and invert it to find $R_Y(\tau)$.
  \item You have just derived the Ornstein--Uhlenbeck kernel. One sentence: in GP language, what did the filter do? (LTI systems are machines for manufacturing valid kernels from white noise.)
\end{enumerate}

% ============================================================
% Problem 5 -- LIFT of old HW7 "Wiener Filter" (MMSE via Parseval), verbatim
% incl. the Parseval hint. CANONICAL (S17 stated the formula and cited here).
% "Third appearance" of the orthogonality principle (S9 MMSE, S14 LMMSE).
% ============================================================
\problem[Wiener filter $=$ LMMSE, third appearance][10 pts]

Let $U_t$ and $V_t$ be zero-mean, jointly WSS processes. If
\[
  \hat{V}_t = \int_{-\infty}^{\infty} h(\theta)\, U_{t - \theta}\, d\theta
\]
is the estimate of $V_t$ using the Wiener filter, show that the minimum mean-squared error is
\[
  \bE\!\left[\, \abs{V_t - \hat{V}_t}^2 \,\right]
    = \int_{-\infty}^{\infty} \left[\, S_V(f) - \frac{\abs{S_{VU}(f)}^2}{S_U(f)} \,\right] df.
\]
Before computing, state in one sentence which Homework~6 principle you are about to reuse, and what plays the role of ``orthogonality'' here. \emph{(Session~17 stated this formula; the derivation is yours.)}

\noindent\textbf{Hint:} Use Parseval's relation $\int_{-\infty}^{\infty} x(t)\, y^*(t)\, dt = \int_{-\infty}^{\infty} X(f)\, Y^*(f)\, df$ when evaluating $\bE[\hat{V}_t V_t]$.

% ============================================================
% Problem 6 -- NEW [D, B, S]. Capstone: adaptive GP sampling, predict-then-
% verify. Callback to HW4 Problem 4. Part (c) ties to HW4 Problem 2 (mass-
% bisection). Design (ell=0.1, sigma_n^2=0.01, 2 starts, 15 acq) RESERVED
% disjoint from S18's demo. Reference: sol_prob6.py.
% ============================================================
\problem[Choose the next sample][15 pts]

\emph{(Callback to Homework~4 Problem~4: another predict-then-verify simulation of a Bayesian estimator.)}

\noindent Implement GP regression on a $200$-point grid over $[0, 1]$ (SE kernel, $\ell = 0.1$, noise variance $0.01$; true function: your choice of smooth $f$). Starting from $2$ random samples, acquire $15$ more points under two rules: (i) uniform random, and (ii) maximum posterior variance.
\begin{enumerate}
  \item \textbf{Before running:} predict where rule (ii) will place its samples early on, and what its posterior-variance profile will look like compared to (i).
  \item \textbf{Turn in:} posterior mean $\pm 2\sigma$ plots after $5$ and $15$ acquisitions for both rules, mean integrated posterior variance versus number of samples, your prediction versus the outcome, and your code.
  \item Two sentences: connect rule (ii) to the mass-bisection rule of Homework~4 Problem~2. In what sense are both ``querying where uncertainty lives''?
\end{enumerate}

% ============================================================
% Problem 7 -- NEW (thread E; the LAST audit). Instance: R(tau)=(1-|tau|)^+
% cos(2 pi tau), reserved S16. ZERO errors -- a correct Bochner certification,
% to be certified. Transcript typeset VERBATIM per spec -- do NOT correct,
% smooth, footnote, or annotate it. Disclosure escalates to "any number".
% ============================================================
\problem[Certify the TA-bot][5 pts]

The assistant was asked: \emph{``Is $R(\tau) = (1 - \abs{\tau})^{+} \cdot \cos(2\pi\tau)$ a valid stationary kernel?''} It answered:

\begingroup
\setlength{\fboxsep}{8pt}
\noindent\fbox{%
  \begin{minipage}{\dimexpr\textwidth-2\fboxsep-2\fboxrule\relax}
    \noindent\textbf{TA-bot writes:} Elementary checks first: $R$ is even (a product of even functions) $\checkmark$; $R(0) = 1$ and $\abs{R(\tau)} \leq (1 - \abs{\tau})^{+} \leq 1 = R(0)$ $\checkmark$. These checks are necessary but not sufficient, so apply Bochner. The triangle $(1 - \abs{\tau})^{+}$ has Fourier transform $\sinc^2(f) \geq 0$, and multiplying by $\cos(2\pi\tau)$ shifts half of that spectrum to $f = +1$ and half to $f = -1$: $S(f) = \tfrac12[\sinc^2(f - 1) + \sinc^2(f + 1)]$, nonnegative everywhere. By Bochner, $R$ is a valid kernel. A GP with this kernel produces sample paths that oscillate near frequency $1$, are rough at fine scales (the spectrum decays only like $1/f^2$), and decorrelate completely beyond lag $1$.
  \end{minipage}%
}
\endgroup

\medskip
\noindent This solution contains \textbf{any number of errors, possibly zero}.
\begin{enumerate}
  \item Audit it line by line, checking each claim against Session~16's tools, and render a verdict.
  \item If (and only if) you found an error, name the violated result in one sentence, citing the session.
  \item If you found an error, give the corrected result with justification.
  \item One sentence: which \emph{single} check would you trust most if you had to certify this transcript in one line, and why?
\end{enumerate}
\noindent\emph{Reminder: flagging a correct step as an error costs credit; certifying correctness is part of the skill.}

\end{document}
