Mapping from ball into cube I need to give an example of continuous mapping from ball into cube (with condition that boundary is an image of boundary), but unfortunately I can't come up with it. Any useful advice will be welcome.

For a point $x \neq \vec 0$ in a cube centered in the origin, let $d(x)$ be the distance from the origin through $x$ to the boundary of the cube. Then the function defined as $f(x) = \frac{x}{d(x)}$ will map the cube to the unit sphere (with the addition that $f(\vec{0}) = \vec{0}$).
Giving an explicit formula is as easy as finding an explicit formula for $d$. While that can be done, it requires quite some work with the Pythagorean theorem and breaking into cases depending on which face of the cube the line through the origin and $x$ intersects.
Edit: After a short discussion with @HenningMakholm, and reading his answer thouroghly, it turns out that for a non-zero vector $(x, y, z)$, the function $d$ is given by
$$
d(x, y, z) = \frac{\sqrt{x^2 + y^2 + z^2}}{\max\{|x|, |y|, |z|\}}
$$
This is still in a sense breaking into cases, depending on which coordinate is largest in magnitude, but it was easier formulated than I initially feared going into this question.
