Suppose

is a metric space, where both A and B are path-connected. Suppose as well that A and B have a common, path-connected set, K. Is S path connected as well?

I think it is. Here's a proof I worked out:

Take any p and q in S. We can assume that p is in A and q is in B since if both p and q were in A, there would exist a path between them by path-connectedness of A. Same deal if both p and q were in B. Anyway, we know that

, so take any

. By path-connectedness of A, there is a path from p to z. That is, there is a continuous map

such that f(a) = p and f(b) = z. Now, by path-connectedness of B, there is a continuous map

such that g(c) = z and g(d) = q. Let h(x) = g(x - b + c). Note that this is just the function g "shifted over". We see that g(c) = h(b) and g(d) = h(d + b - c). Thus h is a continuous map from [b, d + b - c] to B such that h(b) = g(c) = z and h(d + b - c) = g(d) = q. Thus h is a path from p to q.

Consider the function

defined as follows: I(x) = f(x) if x is in [a,b] and I(x) = h(x) = g(x -b + c) if x is in [b, d + b - c]. The only point we need only to worry about for continuity of I(x) is x = b. Note that f(b) = z

and h(b) = g(b - b + c) = g(c) = z. Thus I(x) is also continuous at

x = b and obviously for all other x in the interval, thus I(x) is continuous on [a, d + b - c]. Note I(a) = f(a) = p and I(d + b - c) = h(d + b - c) = g(d) = q. Thus I(x) is a path from p to q and the metric space S is path-connected.

I don't see any flaw in my proof, but I didn't use the fact that a subset of A and B's intersection is path-connected. So I'm wondering if my proof is okay?