I [posted](https://math.stackexchange.com/questions/3243814/relation-between-the-measures-of-two-sets-defined-via-lebesgue-integration) this question on StackExchange, people have upvoted it but I have not received any response. I read up [here](https://meta.mathoverflow.net/questions/1569/posting-an-unanswered-math-se-question-on-mathoverflow) that it is okay to post unanswered StackExchange questions on Mathoverflow. So, posting it below.


Suppose $a : \mathbb R\_+ \to \{-1,1\}$ is a measurable function. Let $X\_0 =\frac12$. Consider a particle that moves on the $X-$axis as follows. 
$$X\_t = X\_0 + \int\_0^t a\_s ds$$
where the integral is a Lebesgue integral. 


Fix a $T=\frac12$. So, $X\_t \in [0,1]$ for all $t \le T$. 


Let $S \subset [0,1]$ be a set such that $\ell(S) =1$, where $\ell(\cdot)$ is the Lebesgue measure.


Define, 
$$G:= \{t \le T: X\_t \in S\}.$$


Is it the case that $\ell(G) = \ell([0,T]) = \frac12$?


That is, the particle spends almost no time outside $S$?



Relation between the measures of two sets defined via Lebesgue integration
**Yes**, by the [coarea formula](https://en.wikipedia.org/wiki/Coarea_formula). In fact it is sufficient to assume that $a(t)$ is bounded and non-zero almost everywhere.


The function $X(t)$ is Lipschitz continuous (with Lipschitz constant 1), $g(t) = \mathbb{1}\_{[0,T] \setminus G}(t)$ is integrable (in fact, bounded by $0$ and $1$), the zero-dimensional Hausdorff measure is just the counting measure, and thus
$$ \begin{aligned} \int\_0^T \mathbb{1}\_{[0,T] \setminus G}(t) |X'(t)| dt & = \int\_0^T g(t) |X'(t)| dt \\ & = \int\_0^1 \biggl(\sum\_{t \in [0, T] : X(t) = x} g(t)\biggr) dx \\ & = \int\_0^1 \# \{t \in [0, T] : X(t) = x, t \notin G\} dx \\ & = \int\_0^1 \# \{t \in [0, T] : X(t) = x, X(t) \notin S\} dx \\ & = \int\_0^1 \# \{t \in [0, T] : X(t) = x, x \notin S\} dx \\ & = \int\_{[0, 1] \setminus S} \# \{t \in [0, T] : X(t) = x\} dx = 0 .\end{aligned} $$
The interand $\mathbb{1}\_{[0,T] \setminus G}(t) |X'(t)|$ is non-negative, and hence it is equal to zero almost everywhere. However, $X'(t) = a(t) \ne 0$ almost everywhere, and hence $[0,T] \setminus G$ is necessarily a null set.


