Integral of Brownian motion in a 2-d box
Let $A=(a,b)\times (c,d) \subset \mathbb{R}^2$ with $0 \in A$ and $(B_t)$ be standard two dimensional Brownian motion. Additionally, let $\tau_A := \inf \{t\geq 0: B_t \notin A\}$ and let $g:A \to \mathbb{R}$ be a smooth bounded function which can be written as $g(x,y)=u(x)v(y)$.
I am investigating the random variable $$\int_0^{\tau_A} g(B_s) ds$$ in particular I am interested in the expectation $$E[\int_0^{\tau_A} g(B_s) ds].$$ I know that there is a connection to the Dirichlet problem but I am interested in calculating or estimating (in both directions) this expression in a stochastical way. E.g., a bound, which contains the $L^1$ norm of $g$ would be very interesting. Since the domain $A$ is an "easy" one and $B_t$ consists of two one dimensional independent Brownian motions $B_t=(B_t^1, B_t^2)$, I have tried to reduce the problem into one dimension in the following way:
\begin{align*} E[\int_0^{\tau_A} g(B_s) ds] &= E^1 E^2 [\int_0^{\tau_{(a,b)}^1 \wedge \tau_{(c,d)}^2} g(B_s^1,B_s^2) ds] \\ &= \int_0^{\infty}E^1 \big[ 1_{[0, \tau^1_{(a,b)})}(s) u(B^1_s) \big] E^2 \big[1_{[0, \tau^2_{(c,d)})}(s) v(B^2_s)\big] d s \end{align*}
The superscripts $\{1,2\}$ refer to the distributions of the respective Brownian motion. Now I have no further ideas on how to proceed and am not familiar with tools that could help me here.
I would appreciate any help!
Sorry I don't know how to be properly stochastic about things and this might not be too helpful. Let me rewrite your last equation in a form more familiar to me. \begin{equation*} \mathbb{E}\left[g\right]=\int_{0}^{\infty} \left(\int_{a}^{b}\phi_{s}(x)u(x)dx\right) \left(\int_{c}^{d}\psi_{s}(y)v(y)dy\right)ds. \end{equation*} It's not necessary but for simplicity I'll assume $\left(a,b\right)=\left(c,d\right)=\left(-\pi/2,\pi/2\right)$. Given initial conditions $\phi_{0}(x)=\delta(x)$ and $\psi_{0}(y)=\delta(y)$, we solve with \begin{equation*} \phi_{s}(x)=\frac{2}{\pi}\sum_{n=0}^{\infty} e^{-\frac{1}{2}(2n+1)^{2}s} \cos\left(\left(2n+1\right)x\right) \end{equation*} \begin{equation*} \psi_{s}(y)=\frac{2}{\pi}\sum_{n=0}^{\infty} e^{-\frac{1}{2}(2n+1)^{2}s} \cos\left(\left(2n+1\right)y\right). \end{equation*} Then with $1\leq p\leq\infty$, \begin{equation*} \int_{-\pi/2}^{\pi/2}\phi_{s}(x)u(x)dx\leq k_{p} \left(\sum_{n=0}^{\infty}e^{-\frac{1}{2}(2n+1)^{2}s}\right) \left\lVert u\right\rVert_{L^{p}} \end{equation*} where, for example, $k_{1}=2/\pi$, $k_{2}=\sqrt{2/\pi}$ and $k_{\infty}=4/\pi$.
Edit2: As @Diger has pointed out in the comments, the better way to proceed (for $p=\infty$ and $p=2$ respectively) is by \begin{eqnarray*} \int_{-\pi/2}^{\pi/2}\phi_{s}(x)\,dx&=& \frac{2}{\pi}\int_{-\pi/2}^{\pi/2} \left(\sum_{n=0}^{\infty}e^{-\frac{1}{2}(2n+1)^{2}s}\cos\left((2n+1)x\right) \right)dx\\ &=&\frac{2}{\pi}\sum_{n=0}^{\infty}e^{-\frac{1}{2}(2n+1)^{2}s} \left(\frac{2(-1)^{n}}{2n+1}\right) \end{eqnarray*} implying \begin{equation*} \lVert \phi_{s} \rVert_{L^{1}} =\frac{4}{\pi}\sum_{n=0}^{\infty}\frac{(-1)^{n} e^{-\frac{1}{2}(2n+1)^{2}s}} {2n+1}, \end{equation*} and \begin{eqnarray*} \int_{-\pi/2}^{\pi/2} \phi_{s}(x)^{2}\,dx &=&\frac{4}{\pi^{2}}\int_{-\pi/2}^{\pi/2} \Bigg(\sum_{m,n=0}^{\infty}e^{-\frac{1}{2}(2m+1)^{2}s-\frac{1}{2}(2n+1)^{2}s}\\ &&\qquad\qquad\qquad\quad \cos\left((2m+1)x\right)\cos\left((2n+1)x\right)\Bigg)dx\\ &=&\frac{4}{\pi^{2}} \sum_{m,n=0}^{\infty}e^{-\frac{1}{2}(2m+1)^{2}s-\frac{1}{2}(2n+1)^{2}s} \left(\frac{\pi}{2}\delta_{m,n}\right)\\ &=&\frac{2}{\pi}\sum_{n=0}^{\infty}e^{-(2n+1)^{2}s} \end{eqnarray*} implying \begin{equation*} \left\lVert \phi_{s}\right\rVert_{L^{2}}= \left(\frac{2}{\pi}\sum_{n=0}^{\infty}e^{-(2n+1)^{2}s}\right)^{\frac{1}{2}}. \end{equation*} I am embarrassed by the mess I have made of this answer so I'll try and put the bounty back on the question.
\begin{multline*} \int_{h}^{\infty} \left(\int_{-\pi/2}^{\pi/2}\phi_{s}(x)u(x)dx\right) \left(\int_{-\pi/2}^{\pi/2}\psi_{s}(y)v(y)dy\right) ds\\ \leq k_{p}k_{q} \left\lVert u\right\rVert_{L^{p}} \left\lVert v\right\rVert_{L^{q}} \int_{h}^{\infty} \left(\sum_{n=0}^{\infty}e^{-\frac{1}{2}(2n+1)^{2}s}\right)^{2}ds. \end{multline*} My guess is that the integral converges for $h>0$. But is it the sort of thing you are after? For the integral up to $h$ we might have to rely on the fact that $\left\lVert \phi_{s}\right\rVert_{L^{1}}\leq 1$ and therefore be more constrained in the choice of norm. \begin{equation*} \int_{-\pi/2}^{\pi/2}\phi_{s}(x)u(x)dx\leq \left\lVert \phi_{s}\right\rVert_{L^{1}} \left\lVert u\right\rVert_{L^{\infty}} \leq \left\lVert u\right\rVert_{L^{\infty}} \end{equation*} \begin{multline*} \int_{0}^{h} \left(\int_{-\pi/2}^{\pi/2}\phi_{s}(x)u(x)dx\right) \left(\int_{-\pi/2}^{\pi/2}\psi_{s}(y)v(y)dy\right) ds\\ \leq h \left\lVert u\right\rVert_{L^{\infty}} \left\lVert v\right\rVert_{L^{\infty}}= h \left\lVert g\right\rVert_{L^{\infty}}. \end{multline*} I was surprised that you wanted estimates in terms of $\left\lVert g\right\rVert_{L^{1}}$ because to me the $L^{\infty}$ norm seems more natural. We are basically integrating against distributions.
Edit1: I have changed $\epsilon$ to $h$ in the above. It was misleading notation because I did not intend $\epsilon\to 0$. In fact according to Mathematica its optimal value in this setup is about $h=0.636$. Let's assume henceforth that we are only interested in $p=q=\infty$. By the above, \begin{multline*} \mathbb{E}[g]\leq h\left\lVert u\right\rVert_{L^{\infty}}\left\lVert v\right\rVert_{L^{\infty}} +k_{\infty}k_{\infty}\lVert u\rVert_{L^{\infty}}\lVert v\rVert_{L^{\infty}} \int_{h}^{\infty} \left(\sum_{n=0}^{\infty}e^{-\frac{1}{2}(2n+1)^{2}s}\right)^{2}ds\\ =\left( h+\left(\frac{4}{\pi}\right)^{2} \int_{h}^{\infty} \left(\sum_{n=0}^{\infty}e^{-\frac{1}{2}(2n+1)^{2}s}\right)^{2}ds \right)\left\lVert g\right\rVert_{L^{\infty}}. \end{multline*} Mathematica is happy to evaluate that prefactor (with $h$ as above), giving \begin{equation*} \mathbb{E}[g]\leq 1.522 \left\lVert g\right\rVert_{L^{\infty}}. \end{equation*}
Is this likely to be a good estimate? Well let's perform the same procedure in the one-dimensional case for comparative purposes. \begin{multline*} \mathbb{E}[u]= \int_{0}^{\infty}\left( \int_{-\pi/2}^{\pi/2}\phi_{s}(x)u(x)dx\right)ds\\ \leq \left(h+ \frac{4}{\pi} \int_{h}^{\infty} \left(\sum_{n=0}^{\infty}e^{-\frac{1}{2}(2n+1)^{2}s}\right)ds \right)\lVert u \rVert_{L^{\infty}}= 2.505 \left\lVert u \right\rVert_{L^{\infty}}. \end{multline*} In the one-dimensional case, we know the expected survival time is $\pi^{2}/4$ (see @Diger's comment below). Consider $u(x)=1$. Then $\mathbb{E}[u]=\pi^{2}/4=2.467$, only slightly less than $2.505$. So these estimates aren't looking terrible!
BUT $\pi^{2}/4$ is clearly the better estimate, if only slightly. Why is that? In the above I calculated \begin{equation*} \int_{-\pi/2}^{\pi/2}\left\lvert \cos \left((2n+1) x\right)\right\rvert dx=2. \end{equation*} However in the comments @Diger calculated \begin{equation*} \int_{-\pi/2}^{\pi/2} \cos \left((2n+1) x\right) dx= 2(-1)^{n}/(2n+1). \end{equation*} In fact I think @Diger's approach is valid, and of course it gives a slightly better estimates. Its validity stems from the nonnegativity of the probability distribution throughout its domain.
Even though I think that Ali had done the spadework to tackle the problem by his PDE approach, it might be worthwhile to post my own conclusion based on this. Since it was already mentioned in the above discussion that the $L^1$ norm is problematic, as it leads to divergencies (for $h\rightarrow 0$), I decided to continue using the $L^2$ norm. In this regard, if $||\cdot||$ is the $L^2$ norm, then the following sequence of steps sets a simple upper bound. $$\mathbb{E}\left[g\right]=\int_{0}^{\infty} \left(\int_{-\pi/2}^{\pi/2}\phi_{s}(x)u(x) \, {\rm d}x\right) \left(\int_{-\pi/2}^{\pi/2}\psi_{s}(y)v(y) \, {\rm d}y\right) \, {\rm d}s \\ \leq ||u|| \, ||v|| \int_0^\infty ||\phi_s|| \, ||\psi_s|| \, {\rm d}s \\ = ||u|| \, ||v|| \int_0^\infty \left( \sqrt { \int_{-\pi/2}^{\pi/2} |\phi_s(x)|^2 \, {\rm d}x } \right)^2 {\rm d}s \\ = ||u|| \, ||v|| \, \frac{4}{\pi^2} \int_0^\infty {\rm d}s { \int_{-\pi/2}^{\pi/2} {\rm d} x \sum_{n,m=0}^\infty e^{ - (2n+1)^2/2 \, s - (2m+1)^2/2 \, s} \cos((2n+1)x)\cos((2m+1)x) } \\ = ||u|| \, ||v|| \, \frac{4}{\pi^2} \int_0^\infty {\rm d}s \sum_{n,m=0}^\infty e^{ - (2n+1)^2/2 \, s - (2m+1)^2/2 \, s} \, \frac{\pi}{2} \, \delta_{n,m} \\ = ||u|| \, ||v|| \, \frac{2}{\pi} \underbrace{\sum_{n=0}^\infty \frac{1}{(2n+1)^2}}_{\pi^2/8} \\ = \frac{\pi}{4} \, ||u|| \, ||v|| \, .$$
Here, as in Alis answer $$\phi_s(x)=\psi_s(x)=\frac{2}{\pi} \sum_{n=0}^\infty e^{-(2n+1)^2/2 \, s} \, \cos((2n+1)x) \, .$$