Modern applications for handwritten mathematical expressions recognition are not limited to single expression input and rather provide the possibility to input several expressions at once, complex elements such as equation systems and matrices, and also support edit modifications. In this paper, we examine segmentation of mathematical expressions and present new techniques: multi-line segmentation method using special Dynamic Threshold Distance and matrix segmentation method based on projection profiling modification. The proposed methods are used for the preliminary structure analysis and utilize only geometrical features of the input strokes, therefore they can be used at the first stage of the recognition workflow. By incorporating these methods into our recognition system we make it possible to recognize multi-line expressions and matrices. The evaluation of the segmentation itself and overall recognition accuracy is performed using open benchmark CROHME datasets and in-house datasets and for matrices it demonstrates segmentation success rate 93.66% on CROHME2016. The proposed methods can be applied for other applications such as analysis of handwritten document layout, tables and charts recognition.