The task is to solve for the exact weak solution to
$$ \begin{cases} -\partial_x (k(x) \partial_x u(x)) = 0 & \text{for } x \in (-1,1),\\ u = 0 & \text{at } x = -1,\\ u = 3 & \text{at } x = 1,\\ \end{cases} $$
where $k$ is given by
$$ \begin{cases} 2 & \text{if } x \in [-1, 0], \\ 1 & \text{otherwise.} \end{cases} $$
A hint is given, providing some extra assumptions: assume $u$ is piecewise-smooth with classical derivatives in $(-1,0)$ and $(0,1)$ and that it is continuous everywhere. Also, "you will need one other property of the solution $x=0$."
I am mostly beat and my PDE chops are not so strong. The usual IBP hack doesn't pan out, and I'm assuming that this is doable without much machinery given how early on this problem is being given. Meeting with Prof. in the morning tomorrow for something else, but want to see if I can flesh something out before then as the meeting is short.
My guess is that the second property left unnamed is differentiability at $x=0$, and that, individually over $x \in (-1,0)$ and $(0,1)$ resp., I can hack together something with the fundamental solutions; ie, I'm able to break this into subdomains, if you will, and cobble together the solution over the entire domain having assumed that $u$ is continuous at $x=0$. The obvious issue, though, is that we have no knowledge of $u(0)$.
However, I have no idea how to justify such a method and have not found examples of this. Is there a clearer way to someone?
Let $u \in H^1((-1,1)) $ be the weak solution of your PDE and, following the hint, let us make the ansatz that $$u(x) = \begin{cases}u_1(x), &\text{in } (-1,0) \\ u_2(x), &\text{in } (0,1) \end{cases} $$ with $u_1\in C^\infty((-1,0))$, $u_2\in C^\infty((0,1))$, $u_1(-1)=0$, $u_2(1)=3$, and $$\lim_{x\to0^-} u_1(x) = \lim_{x\to 0^+}u_2(x)= \alpha$$ for some $\alpha \in \mathbb R$ to be chosen later. Then, for all $x\in(-1,0)$, $$ 0 = (k(x) u_1'(x))'=2u_1''(x), $$ so $u_1(x)=m_1x+c_1$ for some $m_1,c_1\in \mathbb R$. Since $u_1(-1)=0$ and $u_1(0)=\alpha$, it follows that $$u_1(x) = \alpha(x+1). $$ Similarly, for all $x\in(0,1)$, $$ 0 = (k(x) u_2'(x))'=u_2''(x), $$ so $u_2(x)=m_2x+c_2$ for some $m_2,c_2\in \mathbb R$. Using that $u_2(1)=3$ and $u_2(0)=\alpha$, it follows that $$u_2(x) = (3-\alpha)x+\alpha. $$
What the above computation suggests is that we want to consider $$u(x) = \begin{cases}\alpha(x+1), &\text{in } (-1,0) \\ (3-\alpha)x+\alpha, &\text{in } (0,1) \end{cases} $$ and choose $\alpha$ such that $u$ solves the PDE. Note we know only one $\alpha$ can work because, by uniqueness, there is only one solution in $H^1((-1,1))$ to the BVP. Also, note that it is not obvious a priori that $u$ is actually in $H^1((-1,1)$, but by a simple calculation you can check this is the case for all $\alpha$, and that $$u'(x) =\begin{cases}\alpha, &\text{in } (-1,0) \\ 3-\alpha, &\text{in } (0,1). \end{cases} $$ Now recall $u\in H^1((-1,1))$ satisfies the PDE if for all $\varphi \in C^\infty_0((-1,1)$, we have that $$ 0 = \int_{-1}^1 k u'\varphi ' \, dx .$$ Moreover, from the definiton of $k$ and the above formula for $u'$, we have that \begin{align*}\int_{-1}^1 k u'\varphi ' \, dx &= 2\alpha\int_{-1}^0 \varphi'\, dx +(3-\alpha)\int_0^1\varphi'\, dx \\ &=2\alpha (\varphi(0)-\varphi(-1)) +(3-\alpha)(\varphi(1)-\varphi(0)) \\ &=3(\alpha-1)\varphi(0). \end{align*} In the last line, we used that $\varphi$ has compact support in $(-1,1)$, so $\varphi(-1)=\varphi(1)=0$. Hence, we must have $\alpha=1$. Thus, this computation shows that the unique solution $u$ to the BVP, is $$u(x) = \begin{cases}x+1, &\text{in } (-1,0) \\ 2x+1, &\text{in } (0,1). \end{cases} $$ Note that $u$ satisfies the boundary conditions since $u \in C([-1,1])$, so in this case the value of $u$ on the boundary in the trace-sense is simply its value on the boundary.